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

CVS commit cvs w toxygen.net
Nie, 9 Wrz 2007, 10:31:58 CEST


Module name:	ekg2
Changes by:	peres	2007-09-09 10:31:56

Modified files:
	commands.c

Log message:
GPG not-escaping fix.

Index: commands.c
===================================================================
RCS file: /home/cvs/ekg2/plugins/jabber/commands.c,v
diff -d -u -r1.199 -r1.200
--- commands.c	8 Sep 2007 20:49:17 -0000	1.199
+++ commands.c	9 Sep 2007 08:31:55 -0000	1.200
@@ -443,6 +443,8 @@
 
 	int secure		= 0;
 
+	char *s;		/* used for transcoding */
+
 	if (!xstrcmp(target, "*")) {
 		if (msg_all(session, name, params[1]) == -1)
 			printq("list_empty");
@@ -483,10 +485,7 @@
 	if ((c = newconference_find(session, target))) 
 		ismuc = 1;
 
-	if (!j->istlen) {
-		 /* Very, very simple XEP-0071 support + 'modified' jabber_encode() */
-		char *s;
-
+	if (!j->istlen) { /* Very, very simple XEP-0071 support + 'modified' jabber_encode() */
 		if (!config_use_unicode) {
 			s = ekg_convert_string_p(msg, jconv_out);
 			if (s)
@@ -526,16 +525,7 @@
 					return -1;
 			}
 		}
-
-		{
-			if (session_int_get(session, "__gpg_enabled") == 1)
-				msg = xstrdup(msg);
-			else
-				msg = xml_escape(msg);
-			if (!config_use_unicode)
-				xfree(s);
-		}
-	} else	msg = tlen_encode(msg);
+	}
 
 /* writing: */
 	if (j->send_watch) j->send_watch->transfer_limit = -1;
@@ -570,13 +560,17 @@
 			xfree(e_msg);
 		}
 	}
-	if (!secure) 
-		watch_write(j->send_watch, "<body>%s</body>", msg);
+	if (!secure /* || j->istlen */) {
+		char *tmp = (j->istlen ? tlen_encode(msg) : xml_escape(msg));
 
-	if (config_last & 4) 
-		last_add(1, uid, time(NULL), 0, msg);
-	xfree(msg);
+		watch_write(j->send_watch, "<body>%s</body>", tmp);
+		xfree(tmp);
+	}
+	if (!j->istlen && !config_use_unicode)
+		xfree(s);			/* recoded string */
 
+	if (config_last & 4) 
+		last_add(1, uid, time(NULL), 0, params[1]);
 nomsg:
 	if (htmlmsg) {
 		watch_write(j->send_watch, "%s", htmlmsg);


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