comparison libpurple/protocols/msn/oim.c @ 23506:d756a0477c06

propagate from branch 'im.pidgin.pidgin' (head e1c49c9ec5c6869ed9813feccd8ee41d2ca40f35) to branch 'im.pidgin.pidgin.khc.msnp15' (head cee4156a103d7f7b90a8d4e3a3ebf10950baf0aa)
author Ka-Hing Cheung <khc@hxbc.us>
date Wed, 14 May 2008 04:38:26 +0000
parents 7b03d95902d4 9b7af052fd6a
children 1ac5faa72c8d
comparison
equal deleted inserted replaced
23505:a1652ea8f252 23506:d756a0477c06
57 { 57 {
58 MsnOim *oim; 58 MsnOim *oim;
59 59
60 oim = g_new0(MsnOim, 1); 60 oim = g_new0(MsnOim, 1);
61 oim->session = session; 61 oim->session = session;
62 oim->oim_list = NULL; 62 oim->oim_list = NULL;
63 oim->run_id = rand_guid(); 63 oim->run_id = rand_guid();
64 oim->challenge = NULL; 64 oim->challenge = NULL;
65 oim->send_queue = g_queue_new(); 65 oim->send_queue = g_queue_new();
66 oim->send_seq = 1; 66 oim->send_seq = 1;
67 return oim; 67 return oim;
70 /*destroy the oim object*/ 70 /*destroy the oim object*/
71 void 71 void
72 msn_oim_destroy(MsnOim *oim) 72 msn_oim_destroy(MsnOim *oim)
73 { 73 {
74 MsnOimSendReq *request; 74 MsnOimSendReq *request;
75 75
76 purple_debug_info("OIM","destroy the OIM \n"); 76 purple_debug_info("OIM", "destroy the OIM %p\n", oim);
77 g_free(oim->run_id); 77 g_free(oim->run_id);
78 g_free(oim->challenge); 78 g_free(oim->challenge);
79 79
80 while((request = g_queue_pop_head(oim->send_queue)) != NULL){ 80 while((request = g_queue_pop_head(oim->send_queue)) != NULL){
81 msn_oim_free_send_req(request); 81 msn_oim_free_send_req(request);
82 } 82 }
83
83 g_queue_free(oim->send_queue); 84 g_queue_free(oim->send_queue);
84 85 g_list_free(oim->oim_list);
86
85 g_free(oim); 87 g_free(oim);
86 } 88 }
87 89
88 static MsnOimSendReq * 90 static MsnOimSendReq *
89 msn_oim_new_send_req(const char *from_member, const char*friendname, 91 msn_oim_new_send_req(const char *from_member, const char*friendname,
90 const char* to_member, const char *msg) 92 const char* to_member, const char *msg)
91 { 93 {
92 MsnOimSendReq *request; 94 MsnOimSendReq *request;
93 95
94 request = g_new0(MsnOimSendReq, 1); 96 request = g_new0(MsnOimSendReq, 1);
95 request->from_member =g_strdup(from_member); 97 request->from_member = g_strdup(from_member);
96 request->friendname = g_strdup(friendname); 98 request->friendname = g_strdup(friendname);
97 request->to_member = g_strdup(to_member); 99 request->to_member = g_strdup(to_member);
98 request->oim_msg = g_strdup(msg); 100 request->oim_msg = g_strdup(msg);
99 return request; 101 return request;
100 } 102 }
215 217
216 purple_debug_info("msnoim","resending OIM: %s\n", 218 purple_debug_info("msnoim","resending OIM: %s\n",
217 msg->oim_msg); 219 msg->oim_msg);
218 g_queue_push_head(oim->send_queue, msg); 220 g_queue_push_head(oim->send_queue, msg);
219 msn_oim_send_msg(oim); 221 msn_oim_send_msg(oim);
220 return;
221 } else { 222 } else {
222 purple_debug_info("msnoim", 223 purple_debug_info("msnoim",
223 "can't find lock key for OIM: %s\n", 224 "can't find lock key for OIM: %s\n",
224 msg->oim_msg); 225 msg->oim_msg);
225 } 226 }
236 237
237 /*repost the send*/ 238 /*repost the send*/
238 purple_debug_info("MSNP14","resending OIM: %s\n", msg->oim_msg); 239 purple_debug_info("MSNP14","resending OIM: %s\n", msg->oim_msg);
239 g_queue_push_head(oim->send_queue, msg); 240 g_queue_push_head(oim->send_queue, msg);
240 msn_oim_send_msg(oim); 241 msn_oim_send_msg(oim);
241 return;
242 } 242 }
243 } 243 }
244
245 g_free(faultcode_str);
244 } 246 }
245 } 247 }
246 } 248 }
247
248 msn_oim_free_send_req(msg);
249 } 249 }
250 250
251 void 251 void
252 msn_oim_prep_send_msg_info(MsnOim *oim, const char *membername, 252 msn_oim_prep_send_msg_info(MsnOim *oim, const char *membername,
253 const char* friendname, const char *tomember, 253 const char* friendname, const char *tomember,