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

CVS commit cvs w toxygen.net
Czw, 3 Maj 2007, 02:07:18 CEST


Module name:	ekg2
Changes by:	darkjames	2007-05-03 02:07:15

Modified files:
	commands.c jabber_handlers.c

Log message:
- simplify /jid, tlen: modify
- fix bug with no displaying status when only tlen session in use.

Index: commands.c
===================================================================
RCS file: /home/cvs/ekg2/plugins/jabber/commands.c,v
diff -d -u -r1.160 -r1.161
--- commands.c	2 May 2007 23:43:02 -0000	1.160
+++ commands.c	3 May 2007 00:07:15 -0000	1.161
@@ -816,8 +816,7 @@
 	int payload = 4 + j->istlen;
 
 	const char *uid = NULL;
-	char *nick = NULL;
-	char *nickname;
+	char *nickname = NULL;
 	list_t m;
 	
 	userlist_t *u = userlist_find(session, target);
@@ -891,37 +890,25 @@
 				command_exec_format(target, session, 0, ("/jid:privacy --set %s -pin"), uid);
 				continue;
 			}
+						/*    if this is -n smth */
+						/* OR if param doesn't looks like command treat as a nickname */
+			if ((match_arg(argv[i], 'n', ("nickname"), 2) && argv[i + 1] && i++) || argv[i][0] != '-') {
+				if (userlist_find(session, argv[i])) {
+					printq("user_exists", argv[i], session_name(session));
+					continue;
+				}
 
-			if (match_arg(argv[i], 'n', ("nickname"), 2) && argv[i + 1]) {
-				xfree(nick);
-				nick = xstrdup(argv[++i]);
-				continue;
-			}
-	
-			if (argv[i][0] != '-') {	/* if param doesn't looks like command treat as a nickname */
-				xfree(nick);
-				nick = xstrdup(argv[i]);
+				xfree(nickname);
+				nickname = tlenjabber_escape(argv[i]);
 				continue;
 			}
 		}
 		array_free(argv);
-	} 
-
-	if (!nick && !addcom)
-		nick = xstrdup(u->nickname);		/* get current nickname */
-
-	if (nick && xstrcmp(nick, u->nickname)) {
-		if (userlist_find(session, nick)) {
-			printq("user_exists", nick, session_name(session));
-
-			if (addcom)
-				xfree(u);
-			return -1;
-		}
 	}
 
-	nickname = tlenjabber_escape(nick);	xfree(nick);
-
+	if (!nickname && !addcom)
+		nickname = tlenjabber_escape(u->nickname);		/* use current nickname */
+	
 	if (j->send_watch) j->send_watch->transfer_limit = -1;	/* let's send this in one/two packets not in 7 or more. */
 
 	watch_write(j->send_watch, "<iq type=\"set\"><query xmlns=\"jabber:iq:roster\">");

Index: jabber_handlers.c
===================================================================
RCS file: /home/cvs/ekg2/plugins/jabber/jabber_handlers.c,v
diff -d -u -r1.102 -r1.103
--- jabber_handlers.c	2 May 2007 23:43:02 -0000	1.102
+++ jabber_handlers.c	3 May 2007 00:07:15 -0000	1.103
@@ -2672,7 +2672,7 @@
 		int prio = (temp = xmlnode_find_child(n, "priority")) ? atoi(temp->data) : 10;
 
 		if ((nshow = xmlnode_find_child(n, "show"))) {	/* typ */
-			jstatus = jabber_unescape(nshow->data);
+			jstatus = tlenjabber_unescape(nshow->data);
 			if (!xstrcmp(jstatus, "na") || na) {
 				status = EKG_STATUS_NA;
 				na = 1;


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