comparison src/protocols/msn/oim.c @ 19796:3a15b4e5c336

[gaim-migrate @ 16716] add/delete contact function OK committed by MaYuan<mayuan2006@gmail.com> committer: Ethan Blanton <elb@pidgin.im>
author Ma Yuan <mayuan2006@gmail.com>
date Sat, 12 Aug 2006 10:30:30 +0000
parents bddd32f36bde
children c2f3cd6626e1
comparison
equal deleted inserted replaced
19795:38e4a4b404e5 19796:3a15b4e5c336
104 soapconn->read_cb = msn_oim_send_read_cb; 104 soapconn->read_cb = msn_oim_send_read_cb;
105 msn_soap_read_cb(data,source,cond); 105 msn_soap_read_cb(data,source,cond);
106 } 106 }
107 107
108 /*pose single message to oim server*/ 108 /*pose single message to oim server*/
109 void msn_oim_send_single_msg(MsnOim *oim,char * msg) 109 void
110 msn_oim_send_single_msg(MsnOim *oim,char * msg)
110 { 111 {
111 const char *oimsoapbody,*t,*p; 112 const char *oimsoapbody,*t,*p;
112 113
113 gaim_debug_info("MaYuan","send single OIM Message\n"); 114 gaim_debug_info("MaYuan","send single OIM Message\n");
114 oim->sendconn->login_path = g_strdup(MSN_OIM_SEND_URL); 115 oim->sendconn->login_path = g_strdup(MSN_OIM_SEND_URL);
137 } 138 }
138 139
139 } 140 }
140 141
141 /**************************************** 142 /****************************************
143 * OIM delete SOAP request
144 * **************************************/
145
146 /****************************************
142 * OIM get SOAP request 147 * OIM get SOAP request
143 * **************************************/ 148 * **************************************/
144 /*oim SOAP server login error*/ 149 /*oim SOAP server login error*/
145 static void 150 static void
146 msn_oim_get_error_cb(GaimSslConnection *gsc, GaimSslErrorType error, void *data) 151 msn_oim_get_error_cb(GaimSslConnection *gsc, GaimSslErrorType error, void *data)
177 static void 182 static void
178 msn_oim_get_read_cb(gpointer data, GaimSslConnection *gsc, 183 msn_oim_get_read_cb(gpointer data, GaimSslConnection *gsc,
179 GaimInputCondition cond) 184 GaimInputCondition cond)
180 { 185 {
181 MsnSoapConn * soapconn = data; 186 MsnSoapConn * soapconn = data;
182 MsnOim * msnoim; 187 MsnOim * oim = soapconn->session->oim;
183 188
184 gaim_debug_info("MaYuan","OIM get read buffer:{%s}\n",soapconn->body); 189 gaim_debug_info("MaYuan","OIM get read buffer:{%s}\n",soapconn->body);
190
191 /*get next single Offline Message*/
192 oim->oim_list = g_list_remove(oim->oim_list, oim->oim_list->data);
193 // msn_oim_get_msg(oim);
185 } 194 }
186 195
187 static void 196 static void
188 msn_oim_get_written_cb(gpointer data, gint source, GaimInputCondition cond) 197 msn_oim_get_written_cb(gpointer data, gint source, GaimInputCondition cond)
189 { 198 {
218 GaimConversation * conv; 227 GaimConversation * conv;
219 228
220 if ((conv = msn_oim_get_conv(oim,passport)) != NULL){ 229 if ((conv = msn_oim_get_conv(oim,passport)) != NULL){
221 gaim_conversation_write(conv, NULL, msg, GAIM_MESSAGE_SYSTEM, time(NULL)); 230 gaim_conversation_write(conv, NULL, msg, GAIM_MESSAGE_SYSTEM, time(NULL));
222 } 231 }
223
224 } 232 }
225 233
226 /*parse the oim XML data*/ 234 /*parse the oim XML data*/
227 void 235 void
228 msn_parse_oim_msg(MsnOim *oim,char *xmlmsg) 236 msn_parse_oim_msg(MsnOim *oim,char *xmlmsg)
267 t, 275 t,
268 p, 276 p,
269 msgid 277 msgid
270 ); 278 );
271 msn_soap_post(oim->retrieveconn, oimsoapbody, msn_oim_get_written_cb); 279 msn_soap_post(oim->retrieveconn, oimsoapbody, msn_oim_get_written_cb);
272
273 } 280 }
274 281
275 /*MSN OIM get SOAP request*/ 282 /*MSN OIM get SOAP request*/
276 void msn_oim_get_msg(MsnOim *oim) 283 void msn_oim_get_msg(MsnOim *oim)
277 { 284 {
278 GList *list;
279
280 gaim_debug_info("MaYuan","Get OIM with SOAP \n"); 285 gaim_debug_info("MaYuan","Get OIM with SOAP \n");
281 // gaim_debug_info("MaYuan","oim->oim_list:%p,data:%s \n",oim->oim_list,oim->oim_list->data); 286 // gaim_debug_info("MaYuan","oim->oim_list:%p,data:%s \n",oim->oim_list,oim->oim_list->data);
282 for(list = oim->oim_list; list!= NULL;list = g_list_next(list)){ 287 if(oim->oim_list !=NULL){
283 msn_oim_post_single_get_msg(oim,list->data); 288 msn_oim_post_single_get_msg(oim,oim->oim_list->data);
284 oim->oim_list = g_list_remove(oim->oim_list, list->data);
285 } 289 }
286 } 290 }
287 291
288 /*msn oim server connect*/ 292 /*msn oim server connect*/
289 void 293 void