# HG changeset patch # User masca@cpw.pidgin.im # Date 1270056756 0 # Node ID b5793b41770560da0b5fb90d272fa59154d63c8b # Parent 7913a4bf580c4323e0bd06697abc935dda7df8d3 Remove deprecated (since MSNP13) commands and relevant files. diff -r 7913a4bf580c -r b5793b417705 libpurple/protocols/msn/Makefile.am --- a/libpurple/protocols/msn/Makefile.am Tue Mar 30 00:10:03 2010 +0000 +++ b/libpurple/protocols/msn/Makefile.am Wed Mar 31 17:32:36 2010 +0000 @@ -52,8 +52,6 @@ state.h \ switchboard.c \ switchboard.h \ - sync.c \ - sync.h \ table.c \ table.h \ transaction.c \ diff -r 7913a4bf580c -r b5793b417705 libpurple/protocols/msn/msn.c --- a/libpurple/protocols/msn/msn.c Tue Mar 30 00:10:03 2010 +0000 +++ b/libpurple/protocols/msn/msn.c Wed Mar 31 17:32:36 2010 +0000 @@ -43,7 +43,6 @@ #include "msg.h" #include "switchboard.h" #include "notification.h" -#include "sync.h" #include "slplink.h" #if PHOTO_SUPPORT @@ -2712,7 +2711,6 @@ { msn_notification_init(); msn_switchboard_init(); - msn_sync_init(); return TRUE; } @@ -2721,7 +2719,6 @@ { msn_notification_end(); msn_switchboard_end(); - msn_sync_end(); return TRUE; } diff -r 7913a4bf580c -r b5793b417705 libpurple/protocols/msn/notification.c --- a/libpurple/protocols/msn/notification.c Tue Mar 30 00:10:03 2010 +0000 +++ b/libpurple/protocols/msn/notification.c Wed Mar 31 17:32:36 2010 +0000 @@ -31,7 +31,6 @@ #include "page.h" #include "userlist.h" -#include "sync.h" #include "slplink.h" static MsnTable *cbs_table; diff -r 7913a4bf580c -r b5793b417705 libpurple/protocols/msn/session.c --- a/libpurple/protocols/msn/session.c Tue Mar 30 00:10:03 2010 +0000 +++ b/libpurple/protocols/msn/session.c Wed Mar 31 17:32:36 2010 +0000 @@ -74,9 +74,6 @@ while (session->switches != NULL) msn_switchboard_destroy(session->switches->data); - if (session->sync != NULL) - msn_sync_destroy(session->sync); - if (session->oim != NULL) msn_oim_destroy(session->oim); diff -r 7913a4bf580c -r b5793b417705 libpurple/protocols/msn/session.h --- a/libpurple/protocols/msn/session.h Tue Mar 30 00:10:03 2010 +0000 +++ b/libpurple/protocols/msn/session.h Wed Mar 31 17:32:36 2010 +0000 @@ -67,7 +67,6 @@ #include "slpcall.h" #include "sslconn.h" #include "switchboard.h" -#include "sync.h" #include "user.h" #include "userlist.h" @@ -89,7 +88,6 @@ MsnNotification *notification; MsnNexus *nexus; MsnOim *oim; - MsnSync *sync; MsnUserList *userlist; char *abch_cachekey; diff -r 7913a4bf580c -r b5793b417705 libpurple/protocols/msn/sync.c --- a/libpurple/protocols/msn/sync.c Tue Mar 30 00:10:03 2010 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,253 +0,0 @@ -/** - * @file sync.c MSN list synchronization functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "sync.h" -#include "state.h" - -static MsnTable *cbs_table; - -static void -blp_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - PurpleConnection *gc = cmdproc->session->account->gc; - const char *list_name; - - list_name = cmd->params[0]; - - if (!g_ascii_strcasecmp(list_name, "AL")) - { - /* - * If the current setting is AL, messages from users who - * are not in BL will be delivered. - * - * In other words, deny some. - */ - gc->account->perm_deny = PURPLE_PRIVACY_DENY_USERS; - } - else - { - /* If the current setting is BL, only messages from people - * who are in the AL will be delivered. - * - * In other words, permit some. - */ - gc->account->perm_deny = PURPLE_PRIVACY_ALLOW_USERS; - } -} - -static void -prp_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSession *session = cmdproc->session; - const char *type, *value; - - type = cmd->params[0]; - value = cmd->params[1]; - - if (cmd->param_count == 2) - { - if (!strcmp(type, "PHH")) - msn_user_set_home_phone(session->user, purple_url_decode(value)); - else if (!strcmp(type, "PHW")) - msn_user_set_work_phone(session->user, purple_url_decode(value)); - else if (!strcmp(type, "PHM")) - msn_user_set_mobile_phone(session->user, purple_url_decode(value)); - } - else - { - if (!strcmp(type, "PHH")) - msn_user_set_home_phone(session->user, NULL); - else if (!strcmp(type, "PHW")) - msn_user_set_work_phone(session->user, NULL); - else if (!strcmp(type, "PHM")) - msn_user_set_mobile_phone(session->user, NULL); - } -} - -static void -lsg_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSession *session = cmdproc->session; - const char *name; - const char *group_id; - - group_id = cmd->params[0]; - name = purple_url_decode(cmd->params[1]); - - msn_group_new(session->userlist, group_id, name); - - /* HACK */ - if (group_id == 0) - { - /* Group of ungroupped buddies */ - if (session->sync->total_users == 0) - { - cmdproc->cbs_table = session->sync->old_cbs_table; - - msn_session_finish_login(session); - - msn_sync_destroy(session->sync); - session->sync = NULL; - } - return; - } - - if ((purple_find_group(name)) == NULL) - { - PurpleGroup *g = purple_group_new(name); - purple_blist_add_group(g, NULL); - } -} - -static void -lst_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSession *session = cmdproc->session; - char *passport = NULL; - const char *friend = NULL; - int list_op; - MsnUser *user; - - passport = cmd->params[0]; - friend = purple_url_decode(cmd->params[1]); - list_op = atoi(cmd->params[2]); - - user = msn_user_new(session->userlist, passport, friend); - - msn_userlist_add_user(session->userlist, user); - - session->sync->last_user = user; - - /* TODO: This can be improved */ - - if (list_op & MSN_LIST_FL_OP) - { - char **c; - char **tokens; - const char *group_nums; - GSList *group_ids; - - group_nums = cmd->params[3]; - - group_ids = NULL; - - tokens = g_strsplit(group_nums, ",", -1); - - for (c = tokens; *c != NULL; c++) - { - group_ids = g_slist_append(group_ids, *c); - } - - - msn_got_lst_user(session, user, list_op, group_ids); - - g_strfreev(tokens); - g_slist_free(group_ids); - } - else - { - msn_got_lst_user(session, user, list_op, NULL); - } - - session->sync->num_users++; - - if (session->sync->num_users == session->sync->total_users) - { - cmdproc->cbs_table = session->sync->old_cbs_table; - - msn_session_finish_login(session); - - msn_sync_destroy(session->sync); - session->sync = NULL; - } -} - -static void -bpr_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSync *sync = cmdproc->session->sync; - const char *type, *value; - MsnUser *user; - - user = sync->last_user; - - g_return_if_fail(user != NULL); - - type = cmd->params[0]; - value = cmd->params[1]; - - if (value) - { - if (!strcmp(type, "MOB")) - { - if (!strcmp(value, "Y")) - user->mobile = TRUE; - } - else if (!strcmp(type, "PHH")) - msn_user_set_home_phone(user, purple_url_decode(value)); - else if (!strcmp(type, "PHW")) - msn_user_set_work_phone(user, purple_url_decode(value)); - else if (!strcmp(type, "PHM")) - msn_user_set_mobile_phone(user, purple_url_decode(value)); - } -} - -void -msn_sync_init(void) -{ - cbs_table = msn_table_new(); - - /* Syncing */ - msn_table_add_cmd(cbs_table, NULL, "GTC", NULL); - msn_table_add_cmd(cbs_table, NULL, "BLP", blp_cmd); - msn_table_add_cmd(cbs_table, NULL, "PRP", prp_cmd); - msn_table_add_cmd(cbs_table, NULL, "LSG", lsg_cmd); - msn_table_add_cmd(cbs_table, NULL, "LST", lst_cmd); - msn_table_add_cmd(cbs_table, NULL, "BPR", bpr_cmd); -} - -void -msn_sync_end(void) -{ - msn_table_destroy(cbs_table); -} - -MsnSync * -msn_sync_new(MsnSession *session) -{ - MsnSync *sync; - - sync = g_new0(MsnSync, 1); - - sync->session = session; - sync->cbs_table = cbs_table; - - return sync; -} - -void -msn_sync_destroy(MsnSync *sync) -{ - g_free(sync); -} diff -r 7913a4bf580c -r b5793b417705 libpurple/protocols/msn/sync.h --- a/libpurple/protocols/msn/sync.h Tue Mar 30 00:10:03 2010 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ -/** - * @file sync.h MSN list synchronization functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef MSN_SYNC_H -#define MSN_SYNC_H - -typedef struct _MsnSync MsnSync; - -#include "session.h" -#include "table.h" -#include "user.h" - -struct _MsnSync -{ - MsnSession *session; - MsnTable *cbs_table; - - /* - * TODO: What is the intended purpose of old_cbs_table? Nothing - * sets it and it is only read in two places. - */ - MsnTable *old_cbs_table; - - int num_users; - int total_users; - int num_groups; - int total_groups; - MsnUser *last_user; -}; - -void msn_sync_init(void); -void msn_sync_end(void); - -MsnSync *msn_sync_new(MsnSession *session); -void msn_sync_destroy(MsnSync *sync); - -#endif /* MSN_SYNC_H */