mirror of
https://github.com/ChronosX88/psyced.git
synced 2024-11-09 20:11:00 +00:00
firstchild becomes iqchild
This commit is contained in:
parent
1541bb7ca3
commit
504050b041
@ -448,10 +448,11 @@ certificate_check_jabbername(name, cert) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* get first child of a node
|
/* get first child of a node used for <iq/>
|
||||||
* used for <iq/>
|
* "first" is actually inaccurate, since there is no defined order in mappings,
|
||||||
|
* so we select the child, that is not an error
|
||||||
*/
|
*/
|
||||||
getfirstchild(node) {
|
getiqchild(node) {
|
||||||
mixed res;
|
mixed res;
|
||||||
foreach(mixed key, mixed val : node) {
|
foreach(mixed key, mixed val : node) {
|
||||||
unless(stringp(key) && key[0] == '/') continue;
|
unless(stringp(key) && key[0] == '/') continue;
|
||||||
|
@ -716,8 +716,8 @@ jabberMsg(XMLNode node, mixed origin, mixed *su, array(mixed) tu) {
|
|||||||
break;
|
break;
|
||||||
case "iq":
|
case "iq":
|
||||||
{
|
{
|
||||||
mixed firstchild = getfirstchild(node);
|
mixed iqchild = getiqchild(node);
|
||||||
string xmlns = firstchild ? firstchild["@xmlns"] : 0;
|
string xmlns = iqchild ? iqchild["@xmlns"] : 0;
|
||||||
// TODO: maybe this should be handled by several functions
|
// TODO: maybe this should be handled by several functions
|
||||||
// iq_get, iq_set, iq_result, iq_error
|
// iq_get, iq_set, iq_result, iq_error
|
||||||
t = node["@type"];
|
t = node["@type"];
|
||||||
@ -790,8 +790,8 @@ jabberMsg(XMLNode node, mixed origin, mixed *su, array(mixed) tu) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "http://jabber.org/protocol/disco#info":
|
case "http://jabber.org/protocol/disco#info":
|
||||||
if (firstchild["@node"])
|
if (iqchild["@node"])
|
||||||
vars["_target_fragment"] = firstchild["@node"];
|
vars["_target_fragment"] = iqchild["@node"];
|
||||||
if (tu[UUser])
|
if (tu[UUser])
|
||||||
o = FIND_OBJECT(tu[UUser]);
|
o = FIND_OBJECT(tu[UUser]);
|
||||||
else
|
else
|
||||||
@ -807,8 +807,8 @@ jabberMsg(XMLNode node, mixed origin, mixed *su, array(mixed) tu) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "http://jabber.org/protocol/disco#items":
|
case "http://jabber.org/protocol/disco#items":
|
||||||
if (firstchild["@node"])
|
if (iqchild["@node"])
|
||||||
vars["_target_fragment"] = firstchild["@node"];
|
vars["_target_fragment"] = iqchild["@node"];
|
||||||
if (tu[UUser])
|
if (tu[UUser])
|
||||||
o = FIND_OBJECT(tu[UUser]);
|
o = FIND_OBJECT(tu[UUser]);
|
||||||
else
|
else
|
||||||
|
@ -558,7 +558,7 @@ iq(XMLNode node) {
|
|||||||
string target;
|
string target;
|
||||||
string friend;
|
string friend;
|
||||||
XMLNode helper;
|
XMLNode helper;
|
||||||
XMLNode firstchild;
|
XMLNode iqchild;
|
||||||
string t;
|
string t;
|
||||||
string packet;
|
string packet;
|
||||||
string template;
|
string template;
|
||||||
@ -570,8 +570,8 @@ iq(XMLNode node) {
|
|||||||
isplacemsg = stringp(target) && strlen(target) && ISPLACEMSG(target);
|
isplacemsg = stringp(target) && strlen(target) && ISPLACEMSG(target);
|
||||||
|
|
||||||
P0(("+++ %O IQ node %O\n", ME, node))
|
P0(("+++ %O IQ node %O\n", ME, node))
|
||||||
firstchild = getfirstchild(node);
|
iqchild = getiqchild(node);
|
||||||
unless(firstchild) switch(node["@type"]) {
|
unless(iqchild) switch(node["@type"]) {
|
||||||
case "get":
|
case "get":
|
||||||
case "set":
|
case "set":
|
||||||
case "result":
|
case "result":
|
||||||
@ -581,9 +581,9 @@ iq(XMLNode node) {
|
|||||||
P1(("%O got invalid iq %O\n", ME, node))
|
P1(("%O got invalid iq %O\n", ME, node))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
helper = firstchild;
|
helper = iqchild;
|
||||||
|
|
||||||
switch(firstchild["@xmlns"]) {
|
switch(iqchild["@xmlns"]) {
|
||||||
case "jabber:iq:version":
|
case "jabber:iq:version":
|
||||||
switch(node["@type"]) {
|
switch(node["@type"]) {
|
||||||
case "get":
|
case "get":
|
||||||
@ -978,16 +978,16 @@ iq(XMLNode node) {
|
|||||||
packet += "</blocklist></iq>";
|
packet += "</blocklist></iq>";
|
||||||
break;
|
break;
|
||||||
case "set":
|
case "set":
|
||||||
if (firstchild["/item"] && !nodelistp(firstchild["/item"]))
|
if (iqchild["/item"] && !nodelistp(iqchild["/item"]))
|
||||||
firstchild["/item"] = ({ firstchild["/item"] });
|
iqchild["/item"] = ({ iqchild["/item"] });
|
||||||
unless(firstchild["/item"]) { /* clear the blocklist */
|
unless(iqchild["/item"]) { /* clear the blocklist */
|
||||||
foreach(mixed p, mixed val : ppl) {
|
foreach(mixed p, mixed val : ppl) {
|
||||||
if (val[PPL_DISPLAY] == PPL_DISPLAY_NONE)
|
if (val[PPL_DISPLAY] == PPL_DISPLAY_NONE)
|
||||||
sPerson(p, PPL_DISPLAY, PPL_DISPLAY_DEFAULT);
|
sPerson(p, PPL_DISPLAY, PPL_DISPLAY_DEFAULT);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
int block = firstchild[Tag] == "block";
|
int block = iqchild[Tag] == "block";
|
||||||
foreach (helper : firstchild["/item"]) {
|
foreach (helper : iqchild["/item"]) {
|
||||||
/* add/remove each item to/from the blocklist */
|
/* add/remove each item to/from the blocklist */
|
||||||
if (block) {
|
if (block) {
|
||||||
/* TODO:
|
/* TODO:
|
||||||
|
Loading…
Reference in New Issue
Block a user