pidgin: 03e380d3: On MSN, increase the history size for th...

qulogic at pidgin.im qulogic at pidgin.im
Thu Jun 25 21:30:37 EDT 2009


-----------------------------------------------------------------
Revision: 03e380d307e9063ff3938a7ccab18085899c6140
Ancestor: 76988cf6318d0d7d35ee9b5effdf8d15e0b1a4de
Author: qulogic at pidgin.im
Date: 2009-06-26T01:28:09
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/03e380d307e9063ff3938a7ccab18085899c6140

Modified files:
        libpurple/protocols/msn/cmdproc.c
        libpurple/protocols/msn/history.c
        libpurple/protocols/msn/history.h

ChangeLog: 

On MSN, increase the history size for the NS so that people with lots of
buddies on an unknown network (thus requiring many FQY/ADL requests) will
not lose the original request (causing a crash).

Fixes #8579.

-------------- next part --------------
============================================================
--- libpurple/protocols/msn/cmdproc.c	b158005f2b57746c6144bf53849d6558a67bdc66
+++ libpurple/protocols/msn/cmdproc.c	013d8d58320a1b33c9f75028d6381e49bb80a6df
@@ -210,6 +210,7 @@ msn_cmdproc_send(MsnCmdProc *cmdproc, co
 
 	trans = g_new0(MsnTransaction, 1);
 
+	trans->cmdproc = cmdproc;
 	trans->command = g_strdup(command);
 
 	if (format != NULL)
============================================================
--- libpurple/protocols/msn/history.c	27c19ac633ef82ab362d11e895dbb6f6cd6d71f5
+++ libpurple/protocols/msn/history.c	fd036e6319806dce7de6054eac6928050ced2a81
@@ -68,6 +68,7 @@ msn_history_add(MsnHistory *history, Msn
 msn_history_add(MsnHistory *history, MsnTransaction *trans)
 {
 	GQueue *queue;
+	int max_elems;
 
 	g_return_if_fail(history != NULL);
 	g_return_if_fail(trans   != NULL);
@@ -78,7 +79,12 @@ msn_history_add(MsnHistory *history, Msn
 
 	g_queue_push_tail(queue, trans);
 
-	if (queue->length > MSN_HIST_ELEMS)
+	if (trans->cmdproc->servconn->type == MSN_SERVCONN_NS)
+		max_elems = MSN_NS_HIST_ELEMS;
+	else
+		max_elems = MSN_SB_HIST_ELEMS;
+
+	if (queue->length > max_elems)
 	{
 		trans = g_queue_pop_head(queue);
 		msn_transaction_destroy(trans);
============================================================
--- libpurple/protocols/msn/history.h	956cf58d7d7821e9e8cdf3d319e81205c351b994
+++ libpurple/protocols/msn/history.h	c68127fdb7b65bc8a43265e1843e9fc4814d07ae
@@ -24,7 +24,8 @@
 #ifndef _MSN_HISTORY_H
 #define _MSN_HISTORY_H
 
-#define MSN_HIST_ELEMS 0x30
+#define MSN_NS_HIST_ELEMS 0x300
+#define MSN_SB_HIST_ELEMS 0x30
 
 typedef struct _MsnHistory MsnHistory;
 


More information about the Commits mailing list