comparison src/protocols/msn/oim.c @ 19801:90f89601d6d3

[gaim-migrate @ 16758] change to support Showing Yahoo Message committed by MaYuan<mayuan2006@gmail.com> committer: Ethan Blanton <elb@pidgin.im>
author Ma Yuan <mayuan2006@gmail.com>
date Mon, 14 Aug 2006 16:07:20 +0000
parents c2f3cd6626e1
children 22eeb4882d77
comparison
equal deleted inserted replaced
19800:da3f8f7ec3ce 19801:90f89601d6d3
200 200
201 soapconn->read_cb = msn_oim_get_read_cb; 201 soapconn->read_cb = msn_oim_get_read_cb;
202 msn_soap_read_cb(data,source,cond); 202 msn_soap_read_cb(data,source,cond);
203 } 203 }
204 204
205 /*get the conversation*/
206 static GaimConversation *
207 msn_oim_get_conv(MsnOim *oim,const char *passport)
208 {
209 GaimAccount *account;
210 GaimConversation * conv;
211
212 g_return_val_if_fail(oim != NULL, NULL);
213 account = oim->session->account;
214
215 conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM,
216 passport, account);
217 if(conv == NULL){
218 conv = gaim_conversation_new(GAIM_CONV_TYPE_IM, account, passport);
219 }
220 return conv;
221 }
222
223 /*put the OIM Message to User Conversation*/
224 void
225 msn_oim_report_user(MsnOim *oim,const char *passport,char *msg)
226 {
227 GaimConversation * conv;
228
229 if ((conv = msn_oim_get_conv(oim,passport)) != NULL){
230 gaim_conversation_write(conv, NULL, msg, GAIM_MESSAGE_SYSTEM, time(NULL));
231 }
232 }
233
234 /*parse the oim XML data*/ 205 /*parse the oim XML data*/
235 void 206 void
236 msn_parse_oim_msg(MsnOim *oim,const char *xmlmsg) 207 msn_parse_oim_msg(MsnOim *oim,const char *xmlmsg)
237 { 208 {
238 xmlnode *mdNode,*mNode,*INode,*nNode,*ENode,*rtNode; 209 xmlnode *mdNode,*mNode,*INode,*nNode,*ENode,*rtNode;
248 rtNode = xmlnode_get_child(mNode,"RT"); 219 rtNode = xmlnode_get_child(mNode,"RT");
249 rTime = xmlnode_get_data(rtNode); 220 rTime = xmlnode_get_data(rtNode);
250 nNode = xmlnode_get_child(mNode,"N"); 221 nNode = xmlnode_get_child(mNode,"N");
251 nickname = xmlnode_get_data(nNode); 222 nickname = xmlnode_get_data(nNode);
252 gaim_debug_info("MaYuan","E:{%s},I:{%s},rTime:{%s}\n",passport,msgid,rTime); 223 gaim_debug_info("MaYuan","E:{%s},I:{%s},rTime:{%s}\n",passport,msgid,rTime);
253 // msn_oim_report_user(oim,passport,"hello"); 224 // msn_session_report_user(oim->session,passport,"hello");
254 oim->oim_list = g_list_append(oim->oim_list,msgid); 225 oim->oim_list = g_list_append(oim->oim_list,msgid);
255 } 226 }
256 if(msn_soap_connected(oim->retrieveconn) == -1){ 227 if(msn_soap_connected(oim->retrieveconn) == -1){
257 gaim_debug_info("MaYuan","retreive OIM server not connected! We need to connect it first\n"); 228 gaim_debug_info("MaYuan","retreive OIM server not connected! We need to connect it first\n");
258 msn_oim_connect(oim); 229 msn_oim_connect(oim);