comparison src/protocols/msn/slpmsg.c @ 10345:2e01c503aa4f

[gaim-migrate @ 11556] Patch 1078151 from Felipe Contreras to fix some more MSN bugs: "User Dislpay messages, and other less used, did not set an slpcall, so the callback that should not be called, was called (in some very special cases)." ... "Here it goes the real real one, as far as I can tell. Cleaning + organizing + documentation + hard bug fix = big patch." -- Felipe Contreras I also fixed drag-and-drop to conversation window file transfers (which I had broken when I fixed some other dnd thing), made the debug output of the autoreconnect plugin more useful, and stopped the message notification plugin notifying you for messages sent by ignored users. committer: Tailor Script <tailor@pidgin.im>
author Stu Tomlinson <stu@nosnilmot.com>
date Sat, 11 Dec 2004 20:01:58 +0000
parents 56cc5d49472b
children 0f7452b1f777
comparison
equal deleted inserted replaced
10344:5976491e07a7 10345:2e01c503aa4f
31 31
32 MsnSlpMessage * 32 MsnSlpMessage *
33 msn_slpmsg_new(MsnSlpLink *slplink) 33 msn_slpmsg_new(MsnSlpLink *slplink)
34 { 34 {
35 MsnSlpMessage *slpmsg; 35 MsnSlpMessage *slpmsg;
36
36 slpmsg = g_new0(MsnSlpMessage, 1); 37 slpmsg = g_new0(MsnSlpMessage, 1);
38
39 #ifdef MSN_DEBUG_SLPMSG
40 gaim_debug_info("msn", "slpmsg new (%p)\n", slpmsg);
41 #endif
37 42
38 slpmsg->slplink = slplink; 43 slpmsg->slplink = slplink;
39 44
40 slplink->slp_msgs = 45 slplink->slp_msgs =
41 g_list_append(slplink->slp_msgs, slpmsg); 46 g_list_append(slplink->slp_msgs, slpmsg);
45 50
46 void 51 void
47 msn_slpmsg_destroy(MsnSlpMessage *slpmsg) 52 msn_slpmsg_destroy(MsnSlpMessage *slpmsg)
48 { 53 {
49 MsnSlpLink *slplink; 54 MsnSlpLink *slplink;
55 GList *cur;
56
57 g_return_if_fail(slpmsg != NULL);
58
59 #ifdef MSN_DEBUG_SLPMSG
60 gaim_debug_info("msn", "slpmsg destroy (%p)\n", slpmsg);
61 #endif
50 62
51 slplink = slpmsg->slplink; 63 slplink = slpmsg->slplink;
52 64
53 if (slpmsg->fp != NULL) 65 if (slpmsg->fp != NULL)
54 fclose(slpmsg->fp); 66 fclose(slpmsg->fp);
55 67
56 if (slpmsg->buffer != NULL) 68 if (slpmsg->buffer != NULL)
57 g_free(slpmsg->buffer); 69 g_free(slpmsg->buffer);
58 70
59 #ifdef DEBUG_SLP 71 #ifdef MSN_DEBUG_SLP
60 /* 72 /*
61 if (slpmsg->info != NULL) 73 if (slpmsg->info != NULL)
62 g_free(slpmsg->info); 74 g_free(slpmsg->info);
63 */ 75 */
64 #endif 76 #endif
65 77
66 if (slpmsg->msg != NULL) 78 for (cur = slpmsg->msgs; cur != NULL; cur = cur->next)
67 { 79 {
68 /* Something is pointing to this slpmsg, so we should remove that 80 /* Something is pointing to this slpmsg, so we should remove that
69 * pointer to prevent a crash. */ 81 * pointer to prevent a crash. */
70 /* Ex: a user goes offline and after that we receive an ACK */ 82 /* Ex: a user goes offline and after that we receive an ACK */
71 83
84 MsnMessage *msg = cur->data;
85
86 #ifdef MSN_DEBUG_SLPMSG
72 gaim_debug_info("msn", "Unlink slpmsg callbacks.\n"); 87 gaim_debug_info("msn", "Unlink slpmsg callbacks.\n");
73 88 #endif
74 slpmsg->msg->ack_cb = NULL; 89
75 slpmsg->msg->ack_data = NULL; 90 msg->ack_cb = NULL;
76 91 msg->nak_cb = NULL;
77 #if 0 92 msg->ack_data = NULL;
78 MsnTransaction *trans;
79
80 trans = slpmsg->msg->trans;
81
82 if (trans != NULL)
83 {
84 if (trans->callbacks != NULL && trans->has_custom_callbacks)
85 g_hash_table_destroy(trans->callbacks);
86
87 trans->callbacks = NULL;
88 trans->data = NULL;
89 }
90 #endif
91 } 93 }
92 94
93 slplink->slp_msgs = 95 slplink->slp_msgs = g_list_remove(slplink->slp_msgs, slpmsg);
94 g_list_remove(slplink->slp_msgs, slpmsg);
95 96
96 g_free(slpmsg); 97 g_free(slpmsg);
97 } 98 }
98 99
99 void 100 void
117 118
118 if (stat(file_name, &st) == 0) 119 if (stat(file_name, &st) == 0)
119 slpmsg->size = st.st_size; 120 slpmsg->size = st.st_size;
120 } 121 }
121 122
122 #ifdef DEBUG_SLP 123 #ifdef MSN_DEBUG_SLP
123 const void 124 const void
124 msn_slpmsg_show(MsnMessage *msg) 125 msn_slpmsg_show(MsnMessage *msg)
125 { 126 {
126 const char *info; 127 const char *info;
127 gboolean text; 128 gboolean text;
201 202
202 slpmsg = msn_slpmsg_new(slplink); 203 slpmsg = msn_slpmsg_new(slplink);
203 msn_slpmsg_set_body(slpmsg, body, body_len); 204 msn_slpmsg_set_body(slpmsg, body, body_len);
204 205
205 slpmsg->sip = TRUE; 206 slpmsg->sip = TRUE;
207 slpmsg->slpcall = slpcall;
206 208
207 g_free(body); 209 g_free(body);
208 210
209 return slpmsg; 211 return slpmsg;
210 } 212 }