[Pkg-privacy-commits] [irssi-plugin-otr] 25/267: fixed multiple server and fragmentation problem.

Ximin Luo infinity0 at moszumanska.debian.org
Sat Aug 22 12:26:13 UTC 2015


This is an automated email from the git hooks/post-receive script.

infinity0 pushed a commit to branch debian
in repository irssi-plugin-otr.

commit 06c5408a14f6522deddf8a45d58364a36f4249cb
Author: Uli Meis <a.sporto+bee at gmail.com>
Date:   Fri Jul 11 13:46:48 2008 +0200

    fixed multiple server and fragmentation problem.
---
 formats.txt |  3 ++-
 otr_ops.c   | 14 +++++++++-----
 otrutil.c   | 23 +++++++++++++----------
 3 files changed, 24 insertions(+), 16 deletions(-)

diff --git a/formats.txt b/formats.txt
index 8b6af03..d7b03e4 100644
--- a/formats.txt
+++ b/formats.txt
@@ -34,6 +34,7 @@ ops_insec	gone %9insecure%9
 ops_still_reply	still %%9secure%9 (is reply)
 ops_still_no_reply	still %%9secure%9 (is not reply)
 ops_log	log msg: %s
+ops_inject	Couldn't inject message from %s for %s: %s
 SendingReceiving
 send_failed	send failed: msg=%s
 send_change	couldn't find context also OTR changed the outgoing message(BUG?)
@@ -42,7 +43,7 @@ send_converted	OTR converted sent message to %s
 receive_ignore_query	ignoring rest of OTR default query msg
 receive_dequeued	dequeued msg of length %d
 receive_queued	queued msg of length %d
-receive_ignore	ignoring protocol message of length %d, acc=%s, from=%s
+receive_ignore	ignoring protocol message of length %d, acc=%s, from=%s: %s
 receive_converted	OTR converted received message
 otr_better_two	<b>%s</b> has requested an <a href=\"http://otr.cypherpunks.ca/\">Off-the-Record private conversation</a>.  However, you do not have a plugin to support that.
 otr_better_three	See <a href=\"http://otr.cypherpunks.ca/\">http://otr.cypherpunks.ca/</a> for more information.
diff --git a/otr_ops.c b/otr_ops.c
index 290edb8..7943941 100644
--- a/otr_ops.c
+++ b/otr_ops.c
@@ -60,9 +60,13 @@ void ops_inject_msg(void *opdata, const char *accountname,
 	/* OTR sometimes gives us multiple lines 
 	 * (e.g. the default query (a.k.a. "better") message) */
 	g_strdelimit (msgcopy,"\n",' ');
-	a_serv = active_win->active_server; 
-	a_serv->send_message(a_serv, recipient, msgcopy,
-			     GPOINTER_TO_INT(SEND_TARGET_NICK));
+	a_serv = opdata;
+	if (!a_serv)
+		otr_notice(a_serv,recipient,TXT_OPS_INJECT,
+			   accountname,recipient,message);
+	else
+		a_serv->send_message(a_serv, recipient, msgcopy,
+				     GPOINTER_TO_INT(SEND_TARGET_NICK));
 	g_free(msgcopy);
 }
 
@@ -75,7 +79,7 @@ void ops_notify(void *opdata, OtrlNotifyLevel level, const char *accountname,
 		const char *secondary)
 {
 	ConnContext *co = otr_getcontext(accountname,username,FALSE,NULL);
-	SERVER_REC *server = active_win->active_server;
+	SERVER_REC *server = opdata;
 	struct co_info *coi;
 	if (co) {
 		coi = co->app_data;
@@ -117,7 +121,7 @@ int ops_display_msg(void *opdata, const char *accountname,
 		    const char *msg)
 {
 	ConnContext *co = otr_getcontext(accountname,username,FALSE,NULL);
-	SERVER_REC *server = active_win->active_server;
+	SERVER_REC *server = opdata;
 	struct co_info *coi;
 
 	if (co) {
diff --git a/otrutil.c b/otrutil.c
index df8403b..104870e 100644
--- a/otrutil.c
+++ b/otrutil.c
@@ -133,7 +133,7 @@ char *otr_send(SERVER_REC *server, const char *msg,const char *to)
 	err = otrl_message_sending(
 		otr_state, 
 		&otr_ops, 
-		NULL, 
+		server, 
 		accname,
 		PROTOCOLID, 
 		to, 
@@ -160,7 +160,7 @@ char *otr_send(SERVER_REC *server, const char *msg,const char *to)
 
 	err = otrl_message_fragment_and_send(
 		&otr_ops, 
-		NULL, 
+		server, 
 		co,
 		newmessage, 
 		OTRL_FRAGMENT_SEND_ALL, 
@@ -290,7 +290,7 @@ void otr_finish(SERVER_REC *server, char *nick, int inquery)
 		return;
 	}
 
-	otrl_message_disconnect(otr_state,&otr_ops,NULL,accname,
+	otrl_message_disconnect(otr_state,&otr_ops,server,accname,
 				PROTOCOLID,nick);
 
 	otr_notice(inquery ? server : NULL,
@@ -345,7 +345,7 @@ void otr_abort_auth(ConnContext *co, SERVER_REC *server, const char *nick)
 		   TXT_AUTH_ABORTED_ONGOING :
 		   TXT_AUTH_ABORTED);
 
-	otrl_message_abort_smp(otr_state,&otr_ops,NULL,co);
+	otrl_message_abort_smp(otr_state,&otr_ops,server,co);
 }
 
 /*
@@ -405,7 +405,7 @@ void otr_auth(SERVER_REC *server, char *nick, const char *secret)
 		otrl_message_initiate_smp(
 			otr_state, 
 			&otr_ops,
-			NULL,
+			server,
 			co,
 			(unsigned char*)secret,
 			strlen(secret));
@@ -413,7 +413,7 @@ void otr_auth(SERVER_REC *server, char *nick, const char *secret)
 		otrl_message_respond_smp(
 			otr_state,
 			&otr_ops,
-			NULL,
+			server,
 			co,
 			(unsigned char*)secret,
 			strlen(secret));
@@ -564,7 +564,9 @@ char *otr_receive(SERVER_REC *server, const char *msg,const char *from)
 		strcpy(coi->msgqueue+strlen(coi->msgqueue),msg);
 
 		/* wait for more? */
-		if ((strlen(msg)>OTR_MAX_MSG_SIZE)&&msg[strlen(msg)-1]!='.')
+		if ((strlen(msg)>OTR_MAX_MSG_SIZE)&&
+		    (msg[strlen(msg)-1]!='.')&&
+		    (msg[strlen(msg)-1]!=','))
 			return NULL;
 
 		otr_debug(server,from,TXT_RECEIVE_DEQUEUED,
@@ -579,7 +581,8 @@ char *otr_receive(SERVER_REC *server, const char *msg,const char *from)
 
 	} else if (strstr(msg,"?OTR:")&&
 		   (strlen(msg)>OTR_MAX_MSG_SIZE)&&
-		   msg[strlen(msg)-1]!='.') {
+		   (msg[strlen(msg)-1]!='.')&&
+		   (msg[strlen(msg)-1]!=',')) {
 		coi->msgqueue = malloc(4096*sizeof(char));
 		strcpy(coi->msgqueue,msg);
 		otr_debug(server,from,TXT_RECEIVE_QUEUED,strlen(msg));
@@ -589,7 +592,7 @@ char *otr_receive(SERVER_REC *server, const char *msg,const char *from)
 	ignore_message = otrl_message_receiving(
 		otr_state,
 		&otr_ops,
-		NULL,
+		server,
 		accname, 
 		PROTOCOLID, 
 		from, 
@@ -604,7 +607,7 @@ char *otr_receive(SERVER_REC *server, const char *msg,const char *from)
 	
 	if (ignore_message) {
 		otr_debug(server,from,
-			  TXT_RECEIVE_IGNORE, strlen(msg),accname,from);
+			  TXT_RECEIVE_IGNORE, strlen(msg),accname,from,msg);
 		return NULL;
 	}
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/irssi-plugin-otr.git



More information about the Pkg-privacy-commits mailing list