mirror of
https://github.com/ChronosX88/psyced.git
synced 2024-11-08 19:41: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
|
||||
|
||||
/* get first child of a node
|
||||
* used for <iq/>
|
||||
/* get first child of a node 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;
|
||||
foreach(mixed key, mixed val : node) {
|
||||
unless(stringp(key) && key[0] == '/') continue;
|
||||
|
@ -716,8 +716,8 @@ jabberMsg(XMLNode node, mixed origin, mixed *su, array(mixed) tu) {
|
||||
break;
|
||||
case "iq":
|
||||
{
|
||||
mixed firstchild = getfirstchild(node);
|
||||
string xmlns = firstchild ? firstchild["@xmlns"] : 0;
|
||||
mixed iqchild = getiqchild(node);
|
||||
string xmlns = iqchild ? iqchild["@xmlns"] : 0;
|
||||
// TODO: maybe this should be handled by several functions
|
||||
// iq_get, iq_set, iq_result, iq_error
|
||||
t = node["@type"];
|
||||
@ -790,8 +790,8 @@ jabberMsg(XMLNode node, mixed origin, mixed *su, array(mixed) tu) {
|
||||
break;
|
||||
}
|
||||
case "http://jabber.org/protocol/disco#info":
|
||||
if (firstchild["@node"])
|
||||
vars["_target_fragment"] = firstchild["@node"];
|
||||
if (iqchild["@node"])
|
||||
vars["_target_fragment"] = iqchild["@node"];
|
||||
if (tu[UUser])
|
||||
o = FIND_OBJECT(tu[UUser]);
|
||||
else
|
||||
@ -807,8 +807,8 @@ jabberMsg(XMLNode node, mixed origin, mixed *su, array(mixed) tu) {
|
||||
}
|
||||
break;
|
||||
case "http://jabber.org/protocol/disco#items":
|
||||
if (firstchild["@node"])
|
||||
vars["_target_fragment"] = firstchild["@node"];
|
||||
if (iqchild["@node"])
|
||||
vars["_target_fragment"] = iqchild["@node"];
|
||||
if (tu[UUser])
|
||||
o = FIND_OBJECT(tu[UUser]);
|
||||
else
|
||||
|
@ -558,7 +558,7 @@ iq(XMLNode node) {
|
||||
string target;
|
||||
string friend;
|
||||
XMLNode helper;
|
||||
XMLNode firstchild;
|
||||
XMLNode iqchild;
|
||||
string t;
|
||||
string packet;
|
||||
string template;
|
||||
@ -570,8 +570,8 @@ iq(XMLNode node) {
|
||||
isplacemsg = stringp(target) && strlen(target) && ISPLACEMSG(target);
|
||||
|
||||
P0(("+++ %O IQ node %O\n", ME, node))
|
||||
firstchild = getfirstchild(node);
|
||||
unless(firstchild) switch(node["@type"]) {
|
||||
iqchild = getiqchild(node);
|
||||
unless(iqchild) switch(node["@type"]) {
|
||||
case "get":
|
||||
case "set":
|
||||
case "result":
|
||||
@ -581,9 +581,9 @@ iq(XMLNode node) {
|
||||
P1(("%O got invalid iq %O\n", ME, node))
|
||||
return;
|
||||
}
|
||||
helper = firstchild;
|
||||
helper = iqchild;
|
||||
|
||||
switch(firstchild["@xmlns"]) {
|
||||
switch(iqchild["@xmlns"]) {
|
||||
case "jabber:iq:version":
|
||||
switch(node["@type"]) {
|
||||
case "get":
|
||||
@ -978,16 +978,16 @@ iq(XMLNode node) {
|
||||
packet += "</blocklist></iq>";
|
||||
break;
|
||||
case "set":
|
||||
if (firstchild["/item"] && !nodelistp(firstchild["/item"]))
|
||||
firstchild["/item"] = ({ firstchild["/item"] });
|
||||
unless(firstchild["/item"]) { /* clear the blocklist */
|
||||
if (iqchild["/item"] && !nodelistp(iqchild["/item"]))
|
||||
iqchild["/item"] = ({ iqchild["/item"] });
|
||||
unless(iqchild["/item"]) { /* clear the blocklist */
|
||||
foreach(mixed p, mixed val : ppl) {
|
||||
if (val[PPL_DISPLAY] == PPL_DISPLAY_NONE)
|
||||
sPerson(p, PPL_DISPLAY, PPL_DISPLAY_DEFAULT);
|
||||
}
|
||||
} else {
|
||||
int block = firstchild[Tag] == "block";
|
||||
foreach (helper : firstchild["/item"]) {
|
||||
int block = iqchild[Tag] == "block";
|
||||
foreach (helper : iqchild["/item"]) {
|
||||
/* add/remove each item to/from the blocklist */
|
||||
if (block) {
|
||||
/* TODO:
|
||||
|
Loading…
Reference in New Issue
Block a user