add rss.getSubscribedFeeds method
This commit is contained in:
parent
956c762979
commit
7fb323413a
51
xml-rpc.php
51
xml-rpc.php
|
@ -23,9 +23,49 @@
|
||||||
pg_query("set client_encoding = 'utf-8'");
|
pg_query("set client_encoding = 'utf-8'");
|
||||||
}
|
}
|
||||||
|
|
||||||
function subscribeToFeed($msg) {
|
function getSubscribedFeeds($msg) {
|
||||||
# $value = new xmlrpcval("OK");
|
global $link;
|
||||||
|
|
||||||
|
$login_o = $msg->getParam(0);
|
||||||
|
$pass_o = $msg->getParam(1);
|
||||||
|
|
||||||
|
$login = $login_o->scalarval();
|
||||||
|
$pass = $pass_o->scalarval();
|
||||||
|
|
||||||
|
$user_id = authenticate_user($link, $login, $pass);
|
||||||
|
|
||||||
|
if (authenticate_user($link, $login, $pass)) {
|
||||||
|
|
||||||
|
$result = db_query($link, "SELECT
|
||||||
|
id, feed_url, title, SUBSTRING(last_updated,1,19) AS last_updated
|
||||||
|
FROM ttrss_feeds WHERE owner_uid = " .
|
||||||
|
$_SESSION["uid"]);
|
||||||
|
|
||||||
|
$feeds = array();
|
||||||
|
|
||||||
|
while ($line = db_fetch_assoc($result)) {
|
||||||
|
|
||||||
|
$line_struct = new xmlrpcval(
|
||||||
|
array(
|
||||||
|
"feed_url" => new xmlrpcval($line["feed_url"]),
|
||||||
|
"title" => new xmlrpcval($line["title"]),
|
||||||
|
"last_updated" => new xmlrpcval(strtotime($line["last_updated"]))
|
||||||
|
),
|
||||||
|
"struct");
|
||||||
|
|
||||||
|
array_push($feeds, $line_struct);
|
||||||
|
}
|
||||||
|
|
||||||
|
$reply = new xmlrpcval($feeds, "array");
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$reply = new xmlrpcval("Login failed.");
|
||||||
|
}
|
||||||
|
|
||||||
|
return new xmlrpcresp($reply);
|
||||||
|
}
|
||||||
|
|
||||||
|
function subscribeToFeed($msg) {
|
||||||
global $link;
|
global $link;
|
||||||
|
|
||||||
$login_o = $msg->getParam(0);
|
$login_o = $msg->getParam(0);
|
||||||
|
@ -53,9 +93,14 @@
|
||||||
|
|
||||||
$subscribeToFeed_sig = array(array($xmlrpcString,
|
$subscribeToFeed_sig = array(array($xmlrpcString,
|
||||||
$xmlrpcString, $xmlrpcString, $xmlrpcString));
|
$xmlrpcString, $xmlrpcString, $xmlrpcString));
|
||||||
|
|
||||||
|
$getSubscribedFeeds_sig = array(array($xmlrpcString,
|
||||||
|
$xmlrpcString, $xmlrpcString));
|
||||||
|
|
||||||
$s = new xmlrpc_server(
|
$s = new xmlrpc_server(
|
||||||
array(
|
array(
|
||||||
|
"rss.getSubscribedFeeds" => array("function" => "getSubscribedFeeds",
|
||||||
|
"signature" => $getSubscribedFeeds_sig),
|
||||||
"rss.subscribeToFeed" => array("function" => "subscribeToFeed",
|
"rss.subscribeToFeed" => array("function" => "subscribeToFeed",
|
||||||
"signature" => $subscribeToFeed_sig))
|
"signature" => $subscribeToFeed_sig))
|
||||||
);
|
);
|
||||||
|
|
|
@ -9,7 +9,10 @@ try:
|
||||||
# print server.rss.getAllFeeds("fox", "sotona");
|
# print server.rss.getAllFeeds("fox", "sotona");
|
||||||
|
|
||||||
print server.rss.subscribeToFeed("admin", "password",
|
print server.rss.subscribeToFeed("admin", "password",
|
||||||
"http://tt-rss.spb.ru/forum/rss.php");
|
"http://tt-rss.spb.ru/forum/rss.php")
|
||||||
|
|
||||||
|
r = server.rss.getSubscribedFeeds("admin", "password")
|
||||||
|
print r
|
||||||
|
|
||||||
# print "Got '" + server.examples.getStateName(32) + "'"
|
# print "Got '" + server.examples.getStateName(32) + "'"
|
||||||
#
|
#
|
||||||
|
|
Loading…
Reference in New Issue