From 504050b04172c1575f1d6442961f69827b3535a9 Mon Sep 17 00:00:00 2001
From: "psyc://psyced.org/~lynX" <@>
Date: Tue, 28 Apr 2009 08:03:53 +0200
Subject: [PATCH] firstchild becomes iqchild
---
world/net/jabber/common.c | 7 ++++---
world/net/jabber/mixin_parse.c | 12 ++++++------
world/net/jabber/user.c | 20 ++++++++++----------
3 files changed, 20 insertions(+), 19 deletions(-)
diff --git a/world/net/jabber/common.c b/world/net/jabber/common.c
index 4b558c9..85319fa 100644
--- a/world/net/jabber/common.c
+++ b/world/net/jabber/common.c
@@ -448,10 +448,11 @@ certificate_check_jabbername(name, cert) {
}
#endif
-/* get first child of a node
- * used for
+/* get first child of a node used for
+ * "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;
diff --git a/world/net/jabber/mixin_parse.c b/world/net/jabber/mixin_parse.c
index f868613..8ff4984 100644
--- a/world/net/jabber/mixin_parse.c
+++ b/world/net/jabber/mixin_parse.c
@@ -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
diff --git a/world/net/jabber/user.c b/world/net/jabber/user.c
index 055d51d..c482bed 100644
--- a/world/net/jabber/user.c
+++ b/world/net/jabber/user.c
@@ -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 += "";
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: