[ekg2-commit] ekg2: jabber_handlers.c (HEAD) [peres]

CVS commit cvs w toxygen.net
Sob, 8 Wrz 2007, 19:27:17 CEST


Module name:	ekg2
Changes by:	peres	2007-09-08 19:27:14

Modified files:
	jabber_handlers.c

Log message:
1) don't use description reported by server on status error
   (i.e. don't replace error description with our own one),
2) treat status error like nonavail.

Index: jabber_handlers.c
===================================================================
RCS file: /home/cvs/ekg2/plugins/jabber/jabber_handlers.c,v
diff -d -u -r1.127 -r1.128
--- jabber_handlers.c	7 Sep 2007 20:35:03 -0000	1.127
+++ jabber_handlers.c	8 Sep 2007 17:27:13 -0000	1.128
@@ -2831,6 +2831,7 @@
 			xfree(etext);
 
 			status = EKG_STATUS_ERROR;
+			na = 1;
 
 			if (istlen) { /* we need to get&fix the UID - userlist entry is sent with @tlen.pl, but error with user-given host */
 				char *tmp	= tlenjabber_unescape(jabber_attr(n->atts, "to"));
@@ -2841,18 +2842,15 @@
 				uid = saprintf("tlen:%s w tlen.pl", tmp);
 				xfree(tmp);
 			}
-		} 
-		if ((nstatus = xmlnode_find_child(n, "status"))) { /* opisowy */
+		} else if ((nstatus = xmlnode_find_child(n, "status"))) { /* opisowy */
 			xfree(descr);
 			descr = tlenjabber_unescape(nstatus->data);
 		}
 
-		if (!jstatus)
-			jstatus = xstrdup("unknown");
-
-		if (!status && ((status = ekg_status_int(jstatus)) == EKG_STATUS_UNKNOWN))
+		if (!status && (jstatus || (jstatus = xstrdup("unknown"))) && ((status = ekg_status_int(jstatus)) == EKG_STATUS_UNKNOWN))
 			debug_error("[jabber] Unknown presence: %s from %s. Please report!\n", jstatus, uid);
 		xfree(jstatus);
+
 		{
 			userlist_t *u = userlist_find(s, uid);
 			jabber_userlist_private_t *up = jabber_userlist_priv_get(u);
@@ -2880,6 +2878,7 @@
 				}
 			}
 		}
+
 		{
 			char *session 	= xstrdup(session_uid_get(s));
 


Więcej informacji o liście dyskusyjnej ekg2-commit