Update of /cvsroot/gaim/gaim/src/protocols/msn
In directory usw-pr-cvs1:/tmp/cvs-serv32168/src/protocols/msn
Modified Files:
msn.c
Log Message:
spam! glorious spam.
Index: msn.c
===================================================================
RCS file: /cvsroot/gaim/gaim/src/protocols/msn/msn.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- msn.c 2001/10/23 10:40:42 1.26
+++ msn.c 2001/10/23 21:39:44 1.27
@@ -53,7 +53,7 @@
int trId;
int total;
char *user;
- char *txqueue;
+ GSList *txqueue;
};
struct msn_buddy {
@@ -296,7 +296,7 @@
while (m) {
struct msn_switchboard *ms = m->data;
m = m->next;
- if ((ms->total == 1) && !g_strcasecmp(ms->user, id))
+ if ((ms->total <= 1) && !g_strcasecmp(ms->user, id))
return ms;
}
@@ -346,8 +346,10 @@
g_free(ms->auth);
if (ms->user)
g_free(ms->user);
- if (ms->txqueue)
- g_free(ms->txqueue);
+ while (ms->txqueue) {
+ g_free(ms->txqueue->data);
+ ms->txqueue = g_slist_remove(ms->txqueue, ms->txqueue->data);
+ }
if (ms->chat)
serv_got_chat_left(gc, ms->chat->id);
@@ -422,16 +424,18 @@
if (ms->chat)
add_chat_buddy(ms->chat, user);
ms->total++;
- if (ms->txqueue) {
- char *utf8 = str_to_utf8(ms->txqueue);
+ while (ms->txqueue) {
+ char *utf8 = str_to_utf8(ms->txqueue->data);
g_snprintf(buf, sizeof(buf), "MSG %d N %d\r\n%s%s", ++ms->trId,
strlen(MIME_HEADER) + strlen(utf8),
MIME_HEADER, utf8);
g_free(utf8);
- g_free(ms->txqueue);
- ms->txqueue = NULL;
- if (msn_write(ms->fd, buf, strlen(buf)) < 0)
+ g_free(ms->txqueue->data);
+ ms->txqueue = g_slist_remove(ms->txqueue, ms->txqueue->data);
+ if (msn_write(ms->fd, buf, strlen(buf)) < 0) {
msn_kill_switch(ms);
+ return;
+ }
debug_printf("\n");
}
} else if (!g_strncasecmp(buf, "MSG", 3)) {
@@ -1194,7 +1198,15 @@
char buf[MSN_BUF_LEN];
if (ms) {
- char *utf8 = str_to_utf8(message);
+ char *utf8;
+
+ if (ms->txqueue) {
+ debug_printf("appending to queue\n");
+ ms->txqueue = g_slist_append(ms->txqueue, g_strdup(message));
+ return 1;
+ }
+
+ utf8 = str_to_utf8(message);
g_snprintf(buf, sizeof(buf), "MSG %d N %d\r\n%s%s", ++ms->trId,
strlen(MIME_HEADER) + strlen(utf8),
MIME_HEADER, utf8);
@@ -1213,7 +1225,7 @@
ms = g_new0(struct msn_switchboard, 1);
md->switches = g_slist_append(md->switches, ms);
ms->user = g_strdup(who);
- ms->txqueue = g_strdup(message);
+ ms->txqueue = g_slist_append(ms->txqueue, g_strdup(message));
ms->gc = gc;
ms->fd = -1;
} else
@@ -1233,8 +1245,10 @@
g_snprintf(buf, sizeof(buf), "MSG %d N %d\r\n%s%s", ++ms->trId,
strlen(MIME_HEADER) + strlen(message),
MIME_HEADER, message);
- if (msn_write(ms->fd, buf, strlen(buf)) < 0)
+ if (msn_write(ms->fd, buf, strlen(buf)) < 0) {
msn_kill_switch(ms);
+ return 0;
+ }
debug_printf("\n");
serv_got_chat_in(gc, id, gc->username, 0, message, time(NULL));
return 0;
@@ -1457,6 +1471,14 @@
return m;
}
+static void msn_convo_closed(struct gaim_connection *gc, char *who)
+{
+ struct msn_switchboard *ms = msn_find_switch(gc, who);
+
+ if (ms)
+ msn_kill_switch(ms);
+}
+
static struct prpl *my_protocol = NULL;
void msn_init(struct prpl *ret)
@@ -1480,6 +1502,7 @@
ret->normalize = msn_normalize;
ret->do_action = msn_do_action;
ret->actions = msn_actions;
+ ret->convo_closed = msn_convo_closed;
my_protocol = ret;
}
|