# HG changeset patch # User Ma Yuan # Date 1155378630 0 # Node ID 3a15b4e5c33684864f5ccb827fd6f10025eee7ab # Parent 38e4a4b404e5c4da9c87e4c727d9bf22a96cee95 [gaim-migrate @ 16716] add/delete contact function OK committed by MaYuan committer: Ethan Blanton diff -r 38e4a4b404e5 -r 3a15b4e5c336 src/protocols/msn/contact.c --- a/src/protocols/msn/contact.c Thu Aug 10 15:43:55 2006 +0000 +++ b/src/protocols/msn/contact.c Sat Aug 12 10:30:30 2006 +0000 @@ -195,7 +195,7 @@ } static void -msn_contact_written_cb(gpointer data, gint source, GaimInputCondition cond) +msn_get_contact_written_cb(gpointer data, gint source, GaimInputCondition cond) { MsnSoapConn * soapconn = data; @@ -210,7 +210,7 @@ gaim_debug_info("MaYuan","msn_get_contact_list()...\n"); contact->soapconn->login_path = g_strdup(MSN_GET_CONTACT_POST_URL); contact->soapconn->soap_action = g_strdup(MSN_GET_CONTACT_SOAP_ACTION); - msn_soap_post(contact->soapconn,MSN_GET_CONTACT_TEMPLATE,msn_contact_written_cb); + msn_soap_post(contact->soapconn,MSN_GET_CONTACT_TEMPLATE,msn_get_contact_written_cb); } static void @@ -372,7 +372,7 @@ xmlnode_free(node); msn_soap_free_read_buf(contact->soapconn); - dump_adl_cmd(session); + msn_notification_dump_contact(session); msn_set_psm(session); msn_session_finish_login(session); } @@ -415,44 +415,99 @@ msn_soap_post(contact->soapconn,MSN_GET_ADDRESS_TEMPLATE,msn_address_written_cb); } +static void +msn_add_contact_read_cb(gpointer data, gint source, GaimInputCondition cond) +{ + gaim_debug_info("MaYuan","block read done\n"); +} + +static void +msn_add_contact_written_cb(gpointer data, gint source, GaimInputCondition cond) +{ + MsnSoapConn * soapconn = data; + + gaim_debug_info("MaYuan","finish unblock written\n"); + soapconn->read_cb = msn_add_contact_read_cb; + msn_soap_read_cb(data,source,cond); +} + /*add a Contact */ void -msn_add_contact(MsnContact *contact,const char *passport) +msn_add_contact(MsnContact *contact,const char *passport,char *groupId) { char *body = NULL; char *contact_xml = NULL; gaim_debug_info("MaYuan","msn add a contact...\n"); contact_xml = g_strdup_printf(MSN_CONTACT_XML,passport); - body = g_strdup_printf(MSN_ADD_CONTACT_TEMPLATE,contact_xml); - g_free(contact_xml); - - /*build SOAP and POST it*/ - contact->soapconn->login_path = g_strdup(MSN_ADDRESS_BOOK_POST_URL); - contact->soapconn->soap_action = g_strdup(MSN_CONTACT_ADD_SOAP_ACTION); - msn_soap_post(contact->soapconn,body,msn_address_written_cb); + if(groupId == NULL){ + body = g_strdup_printf(MSN_ADD_CONTACT_TEMPLATE,contact_xml); + g_free(contact_xml); + /*build SOAP and POST it*/ + contact->soapconn->login_path = g_strdup(MSN_ADDRESS_BOOK_POST_URL); + contact->soapconn->soap_action = g_strdup(MSN_CONTACT_ADD_SOAP_ACTION); + }else{ + body = g_strdup_printf(MSN_ADD_CONTACT_GROUP_TEMPLATE,groupId,contact_xml); + g_free(contact_xml); + /*build SOAP and POST it*/ + contact->soapconn->login_path = g_strdup(MSN_ADDRESS_BOOK_POST_URL); + contact->soapconn->soap_action = g_strdup(MSN_ADD_CONTACT_GROUP_SOAP_ACTION); + } + msn_soap_post(contact->soapconn,body,msn_add_contact_written_cb); g_free(body); } +static void +msn_delete_contact_read_cb(gpointer data, gint source, GaimInputCondition cond) +{ + gaim_debug_info("MaYuan","delete contact read done\n"); +} + +static void +msn_delete_contact_written_cb(gpointer data, gint source, GaimInputCondition cond) +{ + MsnSoapConn * soapconn = data; + + gaim_debug_info("MaYuan","delete contact written\n"); + soapconn->read_cb = msn_delete_contact_read_cb; + msn_soap_read_cb(data,source,cond); +} + /*delete a Contact*/ void -msn_delete_contact(MsnContact *contact,const char *passport_id) +msn_delete_contact(MsnContact *contact,const char *contactId) { char *body = NULL; char *contact_xml = NULL ; - gaim_debug_info("MaYuan","msn delete a contact...\n"); - contact_xml = g_strdup_printf(MSN_CONTACTS_DEL_XML,passport_id); + gaim_debug_info("MaYuan","msn delete a contact,contactId:{%s}...\n",contactId); + contact_xml = g_strdup_printf(MSN_CONTACTS_DEL_XML,contactId); body = g_strdup_printf(MSN_DEL_CONTACT_TEMPLATE,contact_xml); g_free(contact_xml); /*build SOAP and POST it*/ contact->soapconn->login_path = g_strdup(MSN_ADDRESS_BOOK_POST_URL); contact->soapconn->soap_action = g_strdup(MSN_CONTACT_DEL_SOAP_ACTION); - msn_soap_post(contact->soapconn,body,msn_address_written_cb); + msn_soap_post(contact->soapconn,body,msn_delete_contact_written_cb); g_free(body); } +static void +msn_block_read_cb(gpointer data, gint source, GaimInputCondition cond) +{ + gaim_debug_info("MaYuan","block read done\n"); +} + +static void +msn_block_written_cb(gpointer data, gint source, GaimInputCondition cond) +{ + MsnSoapConn * soapconn = data; + + gaim_debug_info("MaYuan","finish unblock written\n"); + soapconn->read_cb = msn_block_read_cb; + msn_soap_read_cb(data,source,cond); +} + /*block a Contact*/ void msn_block_contact(MsnContact *contact,const char* membership_id) @@ -464,10 +519,26 @@ /*build SOAP and POST it*/ contact->soapconn->login_path = g_strdup(MSN_SHARE_POST_URL); contact->soapconn->soap_action = g_strdup(MSN_CONTACT_BLOCK_SOAP_ACTION); - msn_soap_post(contact->soapconn,body,msn_address_written_cb); + msn_soap_post(contact->soapconn,body,msn_block_written_cb); g_free(body); } +static void +msn_unblock_read_cb(gpointer data, gint source, GaimInputCondition cond) +{ + gaim_debug_info("MaYuan","unblock read done\n"); +} + +static void +msn_unblock_written_cb(gpointer data, gint source, GaimInputCondition cond) +{ + MsnSoapConn * soapconn = data; + + gaim_debug_info("MaYuan","finish unblock written\n"); + soapconn->read_cb = msn_unblock_read_cb; + msn_soap_read_cb(data,source,cond); +} + /*unblock a contact*/ void msn_unblock_contact(MsnContact *contact,const char* passport) @@ -480,10 +551,26 @@ /*build SOAP and POST it*/ contact->soapconn->login_path = g_strdup(MSN_SHARE_POST_URL); contact->soapconn->soap_action = g_strdup(MSN_CONTACT_UNBLOCK_SOAP_ACTION); - msn_soap_post(contact->soapconn,body,msn_address_written_cb); + msn_soap_post(contact->soapconn,body,msn_unblock_written_cb); g_free(body); } +static void +msn_gleams_read_cb(gpointer data, gint source, GaimInputCondition cond) +{ + gaim_debug_info("MaYuan","Gleams read done\n"); +} + +static void +msn_gleams_written_cb(gpointer data, gint source, GaimInputCondition cond) +{ + MsnSoapConn * soapconn = data; + + gaim_debug_info("MaYuan","finish Group written\n"); + soapconn->read_cb = msn_gleams_read_cb; + msn_soap_read_cb(data,source,cond); +} + /*get the gleams info*/ void msn_get_gleams(MsnContact *contact) @@ -492,7 +579,7 @@ /*build SOAP and POST it*/ contact->soapconn->login_path = g_strdup(MSN_ADDRESS_BOOK_POST_URL); contact->soapconn->soap_action = g_strdup(MSN_GET_GLEAMS_SOAP_ACTION); - msn_soap_post(contact->soapconn,MSN_GLEAMS_TEMPLATE,msn_address_written_cb); + msn_soap_post(contact->soapconn,MSN_GLEAMS_TEMPLATE,msn_gleams_written_cb); } /*************************************************************** diff -r 38e4a4b404e5 -r 3a15b4e5c336 src/protocols/msn/contact.h --- a/src/protocols/msn/contact.h Thu Aug 10 15:43:55 2006 +0000 +++ b/src/protocols/msn/contact.h Sat Aug 12 10:30:30 2006 +0000 @@ -25,7 +25,7 @@ #ifndef _MSN_CONTACT_H_ #define _MSN_CONTACT_H_ -#define MSN_CONTACT_SERVER "contacts.msn.com" +#define MSN_CONTACT_SERVER "omega.contacts.msn.com" /*get contact list soap request template*/ #define MSN_GET_CONTACT_POST_URL "/abservice/SharingService.asmx" @@ -116,6 +116,10 @@ #define MSN_ADD_CONTACT_TEMPLATE "09607671-1C32-421F-A6A6-CBFAA51AB5F4falseContactSavefalse00000000-0000-0000-0000-000000000000%strue" +/*Contact Group Add*/ +#define MSN_ADD_CONTACT_GROUP_SOAP_ACTION "http://www.msn.com/webservices/AddressBook/ABGroupContactAdd" +#define MSN_ADD_CONTACT_GROUP_TEMPLATE "09607671-1C32-421F-A6A6-CBFAA51AB5F4falseContactSavefalse00000000-0000-0000-0000-000000000000%s%struetrue" + /*delete contact from contact list soap request template*/ #define MSN_CONTACT_DEL_SOAP_ACTION "http://www.msn.com/webservices/AddressBook/ABContactDelete" #define MSN_CONTACTS_DEL_XML "%s" @@ -168,6 +172,11 @@ void msn_get_contact_list(MsnContact * contact); void msn_get_address_book(MsnContact *contact); +/*contact SOAP Operation*/ +void msn_add_contact(MsnContact *contact,const char *passport,char *groupId); +void msn_delete_contact(MsnContact *contact,const char *contactId); + + /*group operation*/ void msn_add_group(MsnSession *session,const char* group_name); void msn_del_group(MsnSession *session,const char *guid); diff -r 38e4a4b404e5 -r 3a15b4e5c336 src/protocols/msn/msn.c --- a/src/protocols/msn/msn.c Thu Aug 10 15:43:55 2006 +0000 +++ b/src/protocols/msn/msn.c Sat Aug 12 10:30:30 2006 +0000 @@ -972,6 +972,7 @@ userlist = session->userlist; who = msn_normalize(gc->account, buddy->name); + gaim_debug_info("MaYuan","add user:{%s} to group:{%s}\n",who,group->name); if (!session->logged_in) { #if 0 diff -r 38e4a4b404e5 -r 3a15b4e5c336 src/protocols/msn/notification.c --- a/src/protocols/msn/notification.c Thu Aug 10 15:43:55 2006 +0000 +++ b/src/protocols/msn/notification.c Sat Aug 12 10:30:30 2006 +0000 @@ -34,6 +34,11 @@ static MsnTable *cbs_table; +/**************************************************************************** + * Local Function Prototype + ****************************************************************************/ +void msn_add_contact_xml(xmlnode *mlNode,char *passport,int list_op,int type); + /************************************************************************** * Main **************************************************************************/ @@ -434,19 +439,70 @@ /************************************************************************** * Buddy Lists **************************************************************************/ +/* add contact to xmlnode */ +void +msn_add_contact_xml(xmlnode *mlNode,char *passport,int list_op,int type) +{ + xmlnode *d_node,*c_node; + char **tokens; + char *email,*domain; + char *list_op_str,*type_str; + + gaim_debug_info("MaYuan","passport:%s\n",passport); + tokens = g_strsplit(passport, "@", 2); + email = tokens[0]; + domain = tokens[1]; + + /*find a domain Node*/ + for(d_node = xmlnode_get_child(mlNode,"d"); d_node; d_node = xmlnode_get_next_twin(d_node)){ + const char * attr = NULL; + gaim_debug_info("MaYuan","d_node:%s\n",d_node->name); + attr = xmlnode_get_attrib(d_node,"n"); + if(attr == NULL){ + continue; + } + if(!strcmp(attr,domain)){ + break; + } + } + if(d_node == NULL){ + /*domain not found, create a new domain Node*/ + gaim_debug_info("MaYuan","get No d_node\n"); + d_node = xmlnode_new("d"); + xmlnode_set_attrib(d_node,"n",domain); + xmlnode_insert_child(mlNode,d_node); + } + + /*create contact node*/ + c_node = xmlnode_new("c"); + xmlnode_set_attrib(c_node,"n",email); + + list_op_str = g_strdup_printf("%d",list_op); + gaim_debug_info("MaYuan","list_op:%d\n",list_op_str); + xmlnode_set_attrib(c_node,"l",list_op_str); + g_free(list_op_str); +#if 0 + type_str = g_strdup_printf("%d",type); + xmlnode_set_attrib(c_node,"t",type_str); +#else + type_str = g_strdup_printf("1"); + xmlnode_set_attrib(c_node,"t",type_str); + g_free(type_str); +#endif + xmlnode_insert_child(d_node, c_node); +} + +/*dump contact info to NS*/ void -dump_adl_cmd(MsnSession *session) +msn_notification_dump_contact(MsnSession *session) { MsnCmdProc *cmdproc; MsnTransaction *trans; MsnUserList *userlist; MsnUser *user; GList *l; - xmlnode *adl_node,*d_node,*c_node; - char **tokens; - char *email,*domain; + xmlnode *adl_node; char *payload; - char *list_op,*type; int payload_len; cmdproc = session->notification->cmdproc; @@ -458,58 +514,15 @@ /*get the userlist*/ for (l = userlist->users; l != NULL; l = l->next){ user = l->data; - - gaim_debug_info("MaYuan","passport:%s\n",user->passport); - tokens = g_strsplit(user->passport, "@", 2); - email = tokens[0]; - domain = tokens[1]; - - /*find a domain node*/ - for(d_node = xmlnode_get_child(adl_node,"d"); d_node; d_node = xmlnode_get_next_twin(d_node)){ - const char * attr = NULL; - gaim_debug_info("MaYuan","d_node:%s\n",d_node->name); - attr = xmlnode_get_attrib(d_node,"n"); - if(attr == NULL){ - continue; - } - if(!strcmp(attr,domain)){ - break; - } - } - if(d_node == NULL){ - gaim_debug_info("MaYuan","get No d_node\n"); - d_node = xmlnode_new("d"); - xmlnode_set_attrib(d_node,"n",domain); - xmlnode_insert_child(adl_node,d_node); - } - - /*create contact node*/ - c_node = xmlnode_new("c"); - xmlnode_set_attrib(c_node,"n",email); - - list_op = g_strdup_printf("%d",user->list_op); - gaim_debug_info("MaYuan","list_op:%d\n",user->list_op); - xmlnode_set_attrib(c_node,"l",list_op); -#if 0 - type = g_strdup_printf("%d",user->type); - xmlnode_set_attrib(c_node,"t",type); -#else - type = g_strdup_printf("1"); - xmlnode_set_attrib(c_node,"t",type); -#endif - xmlnode_insert_child(d_node, c_node); - - g_free(list_op); - g_free(type); + msn_add_contact_xml(adl_node,user->passport,user->list_op,user->type); } payload = xmlnode_to_str(adl_node,&payload_len); + xmlnode_free(adl_node); gaim_debug_info("MaYuan","ADL{%s}\n",payload); trans = msn_transaction_new(cmdproc, "ADL","%d",strlen(payload)); - msn_transaction_set_payload(trans, payload, strlen(payload)); - msn_cmdproc_send_trans(cmdproc, trans); } @@ -1530,16 +1543,29 @@ const char *group_id) { MsnCmdProc *cmdproc; + MsnTransaction *trans; + xmlnode *adl_node; + char *payload; + int payload_len; + cmdproc = notification->servconn->cmdproc; - if (group_id != NULL && !strcmp(list, "FL")) + if (strcmp(list, "FL") != 0){ + } + + adl_node = xmlnode_new("ml"); + adl_node->child = NULL; + xmlnode_set_attrib(adl_node, "l", "1"); - if (group_id >= 0){ - msn_cmdproc_send(cmdproc, "ADD", "%s %s %s %d", - list, who, store_name, group_id); - }else{ - msn_cmdproc_send(cmdproc, "ADD", "%s %s %s", list, who, store_name); - } + msn_add_contact_xml(adl_node,who,3,1); + + payload = xmlnode_to_str(adl_node,&payload_len); + xmlnode_free(adl_node); + + gaim_debug_info("MaYuan","ADL{%s}\n",payload); + trans = msn_transaction_new(cmdproc, "ADL","%d",strlen(payload)); + msn_transaction_set_payload(trans, payload, strlen(payload)); + msn_cmdproc_send_trans(cmdproc, trans); } void @@ -1547,19 +1573,31 @@ const char *who, const char *group_id) { MsnCmdProc *cmdproc; + MsnTransaction *trans; + xmlnode *rml_node; + char *payload; + int payload_len; + cmdproc = notification->servconn->cmdproc; - if (group_id != NULL){ - msn_cmdproc_send(cmdproc, "REM", "%s %s %d", list, who, group_id); - }else{ - msn_cmdproc_send(cmdproc, "REM", "%s %s", list, who); - } + rml_node = xmlnode_new("ml"); + rml_node->child = NULL; + xmlnode_set_attrib(rml_node, "l", "1"); + + msn_add_contact_xml(rml_node,who,3,1); + + payload = xmlnode_to_str(rml_node,&payload_len); + xmlnode_free(rml_node); + + gaim_debug_info("MaYuan","RML{%s}\n",payload); + trans = msn_transaction_new(cmdproc, "RML","%d",strlen(payload)); + msn_transaction_set_payload(trans, payload, strlen(payload)); + msn_cmdproc_send_trans(cmdproc, trans); } /************************************************************************** * Init **************************************************************************/ - void msn_notification_init(void) { diff -r 38e4a4b404e5 -r 3a15b4e5c336 src/protocols/msn/notification.h --- a/src/protocols/msn/notification.h Thu Aug 10 15:43:55 2006 +0000 +++ b/src/protocols/msn/notification.h Sat Aug 12 10:30:30 2006 +0000 @@ -63,7 +63,7 @@ gboolean msn_notification_connect(MsnNotification *notification, const char *host, int port); void msn_notification_disconnect(MsnNotification *notification); -void dump_adl_cmd(MsnSession *session); +void msn_notification_dump_contact(MsnSession *session); /** * Closes a notification. diff -r 38e4a4b404e5 -r 3a15b4e5c336 src/protocols/msn/oim.c --- a/src/protocols/msn/oim.c Thu Aug 10 15:43:55 2006 +0000 +++ b/src/protocols/msn/oim.c Sat Aug 12 10:30:30 2006 +0000 @@ -106,7 +106,8 @@ } /*pose single message to oim server*/ -void msn_oim_send_single_msg(MsnOim *oim,char * msg) +void +msn_oim_send_single_msg(MsnOim *oim,char * msg) { const char *oimsoapbody,*t,*p; @@ -139,6 +140,10 @@ } /**************************************** + * OIM delete SOAP request + * **************************************/ + +/**************************************** * OIM get SOAP request * **************************************/ /*oim SOAP server login error*/ @@ -179,9 +184,13 @@ GaimInputCondition cond) { MsnSoapConn * soapconn = data; - MsnOim * msnoim; + MsnOim * oim = soapconn->session->oim; gaim_debug_info("MaYuan","OIM get read buffer:{%s}\n",soapconn->body); + + /*get next single Offline Message*/ + oim->oim_list = g_list_remove(oim->oim_list, oim->oim_list->data); +// msn_oim_get_msg(oim); } static void @@ -220,7 +229,6 @@ if ((conv = msn_oim_get_conv(oim,passport)) != NULL){ gaim_conversation_write(conv, NULL, msg, GAIM_MESSAGE_SYSTEM, time(NULL)); } - } /*parse the oim XML data*/ @@ -269,19 +277,15 @@ msgid ); msn_soap_post(oim->retrieveconn, oimsoapbody, msn_oim_get_written_cb); - } /*MSN OIM get SOAP request*/ void msn_oim_get_msg(MsnOim *oim) { - GList *list; - gaim_debug_info("MaYuan","Get OIM with SOAP \n"); // gaim_debug_info("MaYuan","oim->oim_list:%p,data:%s \n",oim->oim_list,oim->oim_list->data); - for(list = oim->oim_list; list!= NULL;list = g_list_next(list)){ - msn_oim_post_single_get_msg(oim,list->data); - oim->oim_list = g_list_remove(oim->oim_list, list->data); + if(oim->oim_list !=NULL){ + msn_oim_post_single_get_msg(oim,oim->oim_list->data); } } diff -r 38e4a4b404e5 -r 3a15b4e5c336 src/protocols/msn/soap.c --- a/src/protocols/msn/soap.c Thu Aug 10 15:43:55 2006 +0000 +++ b/src/protocols/msn/soap.c Sat Aug 12 10:30:30 2006 +0000 @@ -146,12 +146,12 @@ { gssize len; gssize total_len = 0; - char temp_buf[10240]; + char temp_buf[MSN_SOAP_READ_BUFF_SIZE]; if(soapconn->ssl_conn){ - len = gaim_ssl_read(soapconn->gsc, temp_buf,sizeof(temp_buf)); + len = gaim_ssl_read(soapconn->gsc, temp_buf,MSN_SOAP_READ_BUFF_SIZE); }else{ - len = read(soapconn->fd, temp_buf,sizeof(temp_buf)); + len = read(soapconn->fd, temp_buf,MSN_SOAP_READ_BUFF_SIZE); } if(len >0){ total_len += len; @@ -162,6 +162,7 @@ soapconn->read_len += len; soapconn->read_buf[soapconn->read_len] = '\0'; } + gaim_debug_info("MaYuan","++soap ssl read:{%d}\n",total_len); // gaim_debug_info("MaYuan","nexus ssl read:{%s}\n",soapconn->read_buf); return total_len; } @@ -209,6 +210,7 @@ /* Redirect. */ char *location, *c; + gaim_debug_error("MaYuan", "soap redirect\n"); location = strstr(soapconn->read_buf, "Location: "); if (location == NULL) { @@ -244,6 +246,7 @@ { const char *error; + gaim_debug_error("MaYuan", "soap 401\n"); if ((error = strstr(soapconn->read_buf, "WWW-Authenticate")) != NULL) { if ((error = strstr(error, "cbtxt=")) != NULL) @@ -284,12 +287,11 @@ /*setup the conn body */ soapconn->body = body_start; soapconn->body_len = atoi(body_len); - // gaim_debug_misc("MaYuan","content length :%d",soapconn->body_len); + gaim_debug_misc("MaYuan","SOAP Read length :%d,body len:%d\n",soapconn->read_len,soapconn->body_len); - if(soapconn->read_len < body_start - soapconn->read_buf + atoi(body_len)){ + if(soapconn->read_len < body_start - soapconn->read_buf + soapconn->body_len){ return; } - g_free(body_len); #if 1 @@ -313,6 +315,7 @@ // soapconn->gsc = NULL; #endif } + return; } void @@ -342,6 +345,13 @@ MsnSoapConn *soapconn = data; int len, total_len; + g_return_if_fail(soapconn != NULL); + if(soapconn->write_buf == NULL){ + gaim_debug_error("MaYuan","soap buffer is NULL\n"); + gaim_input_remove(soapconn->output_handler); + soapconn->output_handler = -1; + return; + } total_len = strlen(soapconn->write_buf); /* diff -r 38e4a4b404e5 -r 3a15b4e5c336 src/protocols/msn/soap.h --- a/src/protocols/msn/soap.h Thu Aug 10 15:43:55 2006 +0000 +++ b/src/protocols/msn/soap.h Sat Aug 12 10:30:30 2006 +0000 @@ -26,6 +26,8 @@ #ifndef _MSN_SOAP_H_ #define _MSN_SOAP_H_ +#define MSN_SOAP_READ_BUFF_SIZE 8192 + /*MSN Https connection structure*/ typedef struct _MsnSoapConn MsnSoapConn; diff -r 38e4a4b404e5 -r 3a15b4e5c336 src/protocols/msn/state.c --- a/src/protocols/msn/state.c Thu Aug 10 15:43:55 2006 +0000 +++ b/src/protocols/msn/state.c Sat Aug 12 10:30:30 2006 +0000 @@ -38,6 +38,17 @@ N_("Available") }; +/* Local Function Prototype*/ +char * msn_build_psm(char * psmstr,char *mediastr,char * guidstr); + +/* + * WLM media PSM info build prcedure + * + * Result can like: + * \0Music\01\0{0} - {1}\0 Song Title\0Song Artist\0Song Album\0\0\ + * \0Games\01\0Playing {0}\0Game Name\0\ + * \0Office\01\0Office Message\0Office App Name\0" + */ char * msn_build_psm(char * psmstr,char *mediastr,char * guidstr) { @@ -53,10 +64,6 @@ } xmlnode_insert_child(dataNode,psmNode); -//"\0Music\01\0{0} - {1}\0 Song Title\0Song Artist\0Song Album\0\0\ -\0Games\01\0Playing {0}\0Game Name\0\ -\0Office\01\0Office Message\0Office App Name\0" - mediaNode = xmlnode_new("CurrentMedia"); if(mediastr != NULL){ xmlnode_insert_data(psmNode,mediastr,strlen(mediastr)); diff -r 38e4a4b404e5 -r 3a15b4e5c336 src/protocols/msn/userlist.c --- a/src/protocols/msn/userlist.c Thu Aug 10 15:43:55 2006 +0000 +++ b/src/protocols/msn/userlist.c Sat Aug 12 10:30:30 2006 +0000 @@ -591,6 +591,10 @@ const char *list; user = msn_userlist_find_user(userlist, who); + + /*delete the contact from address book via soap action*/ + msn_delete_contact(userlist->session->contact,user->uid); + group_id = NULL; if (group_name != NULL){ @@ -614,7 +618,7 @@ /* Then request the rem to the server. */ list = lists[list_id]; - msn_notification_rem_buddy(userlist->session->notification, list, who, group_id); +// msn_notification_rem_buddy(userlist->session->notification, list, who, group_id); } /*add buddy*/ @@ -628,6 +632,7 @@ const char *list; const char *store_name; + gaim_debug_info("MaYuan", "userlist add buddy,name:{%s},group:{%s}\n",who ,group_name); group_id = NULL; if (!gaim_email_is_valid(who)){ @@ -668,8 +673,11 @@ /* Then request the add to the server. */ list = lists[list_id]; - msn_notification_add_buddy(userlist->session->notification, list, who, + gaim_debug_info("MaYuan", "add user:{%s} to group id {%s}\n",store_name ,group_id); + msn_add_contact(userlist->session->contact,who,group_id); +/* msn_notification_add_buddy(userlist->session->notification, list, who, store_name, group_id); + */ } void