# HG changeset patch # User Ma Yuan # Date 1155224635 0 # Node ID 38e4a4b404e5c4da9c87e4c727d9bf22a96cee95 # Parent b22d13f552325429c939916e079b695a05bc39d7 [gaim-migrate @ 16685] add delte group SOAP operation code ok committed by MaYuan committer: Ethan Blanton diff -r b22d13f55232 -r 38e4a4b404e5 src/protocols/msn/contact.c --- a/src/protocols/msn/contact.c Thu Aug 10 04:38:13 2006 +0000 +++ b/src/protocols/msn/contact.c Thu Aug 10 15:43:55 2006 +0000 @@ -495,27 +495,59 @@ msn_soap_post(contact->soapconn,MSN_GLEAMS_TEMPLATE,msn_address_written_cb); } +/*************************************************************** + * Group Operation + ***************************************************************/ +static void +msn_group_read_cb(gpointer data, gint source, GaimInputCondition cond) +{ + gaim_debug_info("MaYuan","Group read \n"); +} + +static void +msn_group_written_cb(gpointer data, gint source, GaimInputCondition cond) +{ + MsnSoapConn * soapconn = data; + + gaim_debug_info("MaYuan","finish Group written\n"); + soapconn->read_cb = msn_group_read_cb; + msn_soap_read_cb(data,source,cond); +} + /*add group*/ -void msn_add_group(MsnContact *contact,const char* group_name) +void msn_add_group(MsnSession *session,const char* group_name) { + char *body = NULL; + MsnContact *contact ; + + g_return_if_fail(session != NULL); + contact = session->contact; gaim_debug_info("MaYuan","msn add group...\n"); + body = g_strdup_printf(MSN_GROUP_ADD_TEMPLATE,group_name); /*build SOAP and POST it*/ contact->soapconn->login_path = g_strdup(MSN_ADDRESS_BOOK_POST_URL); contact->soapconn->soap_action = g_strdup(MSN_GROUP_ADD_SOAP_ACTION); - msn_soap_post(contact->soapconn,MSN_GROUP_ADD_TEMPLATE,msn_address_written_cb); + msn_soap_post(contact->soapconn,body,msn_group_written_cb); + g_free(body); } /*delete a group*/ -void msn_del_group(MsnContact *contact,const char *guid) +void msn_del_group(MsnSession *session,const char *guid) { + MsnContact *contact; + char *body = NULL; + + g_return_if_fail(session != NULL); + contact = session->contact; gaim_debug_info("MaYuan","msn del group...\n"); + body = g_strdup_printf(MSN_GROUP_DEL_TEMPLATE,guid); /*build SOAP and POST it*/ contact->soapconn->login_path = g_strdup(MSN_ADDRESS_BOOK_POST_URL); contact->soapconn->soap_action = g_strdup(MSN_GROUP_DEL_SOAP_ACTION); - msn_soap_post(contact->soapconn,MSN_GROUP_DEL_TEMPLATE,msn_address_written_cb); - + msn_soap_post(contact->soapconn,body,msn_group_written_cb); + g_free(body); } void diff -r b22d13f55232 -r 38e4a4b404e5 src/protocols/msn/contact.h --- a/src/protocols/msn/contact.h Thu Aug 10 04:38:13 2006 +0000 +++ b/src/protocols/msn/contact.h Thu Aug 10 15:43:55 2006 +0000 @@ -158,7 +158,9 @@ MsnSoapConn *soapconn; }; -/*function prototype*/ +/************************************************ + * function prototype + ************************************************/ MsnContact * msn_contact_new(MsnSession *session); void msn_contact_destroy(MsnContact *contact); @@ -166,5 +168,8 @@ void msn_get_contact_list(MsnContact * contact); void msn_get_address_book(MsnContact *contact); +/*group operation*/ +void msn_add_group(MsnSession *session,const char* group_name); +void msn_del_group(MsnSession *session,const char *guid); #endif/* _MSN_CMDPROC_H_*/ diff -r b22d13f55232 -r 38e4a4b404e5 src/protocols/msn/msn.c --- a/src/protocols/msn/msn.c Thu Aug 10 04:38:13 2006 +0000 +++ b/src/protocols/msn/msn.c Thu Aug 10 15:43:55 2006 +0000 @@ -1268,6 +1268,7 @@ cmdproc = session->notification->cmdproc; enc_new_group_name = gaim_url_encode(group->name); + gaim_debug_info("MaYuan","rename group:old{%s},new{%s}",old_name,enc_new_group_name); old_gid = msn_userlist_find_group_id(session->userlist, old_name); if (old_gid != NULL){ diff -r b22d13f55232 -r 38e4a4b404e5 src/protocols/msn/notification.c --- a/src/protocols/msn/notification.c Thu Aug 10 04:38:13 2006 +0000 +++ b/src/protocols/msn/notification.c Thu Aug 10 15:43:55 2006 +0000 @@ -301,7 +301,7 @@ g_snprintf(proto_str, sizeof(proto_str), "MSNP%d", session->protocol_ver); for (i = 1; i < cmd->param_count -1; i++){ - gaim_debug_info("MaYuan","%s\,proto_str:%s\n",cmd->params[i],proto_str); + gaim_debug_info("MaYuan","%s,proto_str:%s\n",cmd->params[i],proto_str); if (strcmp(cmd->params[i], proto_str) >= 0) { protocol_supported = TRUE; break; @@ -531,11 +531,14 @@ MsnTransaction *trans; char * payload; + gaim_debug_info("MaYuan","Process ADL\n"); +#if 0 trans = msn_transaction_new(cmdproc, "RML",""); msn_transaction_set_payload(trans, payload, strlen(payload)); msn_cmdproc_send_trans(cmdproc, trans); +#endif } static void @@ -1414,6 +1417,8 @@ } g_strfreev(elems); +/* test code for add group*/ +// msn_add_group(session,"hello"); } static void @@ -1591,7 +1596,7 @@ msn_table_add_cmd(cbs_table, NULL, "NOT", not_cmd); msn_table_add_cmd(cbs_table, NULL, "CHL", chl_cmd); - msn_table_add_cmd(cbs_table, NULL, "REM", rem_cmd); + msn_table_add_cmd(cbs_table, NULL, "RML", rml_cmd); msn_table_add_cmd(cbs_table, NULL, "ADL", adl_cmd); msn_table_add_cmd(cbs_table, NULL, "QRY", NULL); diff -r b22d13f55232 -r 38e4a4b404e5 src/protocols/msn/userlist.c --- a/src/protocols/msn/userlist.c Thu Aug 10 04:38:13 2006 +0000 +++ b/src/protocols/msn/userlist.c Thu Aug 10 15:43:55 2006 +0000 @@ -187,7 +187,6 @@ const char *old_group_name, const char *new_group_name) { MsnCmdProc *cmdproc; -// MsnTransaction *trans; MsnMoveBuddy *data; cmdproc = userlist->session->notification->cmdproc; @@ -199,6 +198,7 @@ data->old_group_name = g_strdup(old_group_name); /*TODO:add new group via SOAP action*/ + } /**************************************************************************