diff options
author | Adam <Adam@anope.org> | 2011-03-22 23:58:53 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2011-03-22 23:58:53 -0400 |
commit | 451fb82e544fda19888c4d5bc250431a3197cef6 (patch) | |
tree | a41599e56a43f42d37bc6481fbb86f15b2d42d6b /docs/XMLRPC | |
parent | c02d51f52348758487223856e716261a734af8fc (diff) |
Bug #1203
Diffstat (limited to 'docs/XMLRPC')
-rw-r--r-- | docs/XMLRPC/XMLRPC | 10 | ||||
-rw-r--r-- | docs/XMLRPC/xmlrpc.php | 20 |
2 files changed, 10 insertions, 20 deletions
diff --git a/docs/XMLRPC/XMLRPC b/docs/XMLRPC/XMLRPC index dad7641e3..f710f1502 100644 --- a/docs/XMLRPC/XMLRPC +++ b/docs/XMLRPC/XMLRPC @@ -1,10 +1,7 @@ Starting with Anope 1.9.4 XMLRPC using PHP's xmlrpc_encode_request and xmlrpc_decode functions is supported. This allows external applications, such as websites, to execute remote procedure calls to Anope in real time. -Currently there are 6 supported XMLRPC calls, provided by m_xmlrpc_main: - -login - Takes two parameters, the username and password. Useful only if there is a username and password setting in - the XMLRPC configuration block. If there is, clients wanting to execute RPC calls must login first using this. +Currently there are 5 supported XMLRPC calls, provided by m_xmlrpc_main: checkAuthetication - Takes two parameters, an account name and a password. Checks if the account name is valid and the password is correct for the account name, useful for making login pages on websites. @@ -20,8 +17,9 @@ channel - Takes one parameter, a channel name, and returns real time information user - Takes one parameter, a user name, and returns real time information regarding that user. -XMLRPC was designed to be used with m_mysql and db_mysql, and will not return any information that can be pulled from the SQL -database, such as accounts and registered channel information. For examples on how to use these calls in PHP, see xmlrpc.php in docs/XMLRPC for an example PHP class. +XMLRPC was designed to be used with db_mysql, and will not return any information that can be pulled from the SQL +database, such as accounts and registered channel information. It is instead used for pulling realtime data such +as users and channels currently onlive. For examples on how to use these calls in PHP, see xmlrpc.php in docs/XMLRPC. Also note that the parameter named "id" is reserved for query ID. If you pass a query to Anope containing a value for id. it will be stored by Anope and the same id will be passed back in the result. diff --git a/docs/XMLRPC/xmlrpc.php b/docs/XMLRPC/xmlrpc.php index c75319259..cffc23a0c 100644 --- a/docs/XMLRPC/xmlrpc.php +++ b/docs/XMLRPC/xmlrpc.php @@ -1,5 +1,4 @@ <?php - /* XMLRPC Functions * * (C) 2003-2011 Anope Team @@ -9,29 +8,21 @@ class AnopeXMLRPC { - private $Host, $Bind, $Port, $Username, $Pass; + private $Host, $Bind, $Port; private $Socket; - function __construct($Host, $Port, $Bind = NULL, $Username = NULL, $Pass = NULL) + function __construct($Host, $Port, $Bind = NULL) { $this->Host = $Host; $this->Port = $Port; $this->Bind = $Bind; - $this->Username = $Username; - $this->Pass = $Pass; $this->Socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); if ($Bind && socket_bind($this->Socket, $this->Bind) == false) $his->Socket = false; if (socket_connect($this->Socket, $this->Host, $this->Port) == false) $this->Socket = false; - - if ($Username && $Pass) - { - /* Login to XMLRPC, if required */ - $this->RunXMLRPC("login", array($Username, $Pass)); - } } function __destruct() @@ -52,10 +43,11 @@ class AnopeXMLRPC socket_write($this->Socket, $xmlquery); $inbuf = socket_read($this->Socket, 4096); - $inxmlrpc = xmlrpc_decode($inbuf); + $inbuf = substr($inbuf, strpos($inbuf, "\r\n\r\n") + 4); + $response = xmlrpc_decode($inbuf); - if (isset($inxmlrpc[0])) - return $inxmlrpc[0]; + if (isset($response[0])) + return $response[0]; return NULL; } |