Mercurial > pidgin.yaz
comparison src/protocols/msn/msn.c @ 9285:7a8aa87164ae
[gaim-migrate @ 10088]
Ok I'm done. This started out as shx's patch to make add/remove
buddy/buddies take GaimBuddy and GaimGroup's in various places.
I think his diff was like 2000 lines and mine is like 5000. I
tried to clean up blist.c a bit and make it more uniform. There
are some more g_return_if_fail() checks. Removed some code that
was deprecated--it's probably been long enough. Removed some
#include <multi.h>'s. Make blist.xml saving happen on a timer,
like prefs.xml and accounts.xml.
Sorry if this doesn't merge cleanly with whatever you're doing.
People should really test this a lot.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Tue, 15 Jun 2004 02:37:27 +0000 |
parents | e20af87d8721 |
children | 2e5faf12a24c |
comparison
equal
deleted
inserted
replaced
9284:fe0291162312 | 9285:7a8aa87164ae |
---|---|
800 | 800 |
801 msn_change_status(session, (idle ? MSN_IDLE : MSN_ONLINE)); | 801 msn_change_status(session, (idle ? MSN_IDLE : MSN_ONLINE)); |
802 } | 802 } |
803 | 803 |
804 static void | 804 static void |
805 msn_add_buddy(GaimConnection *gc, const char *name, GaimGroup *group) | 805 msn_add_buddy(GaimConnection *gc, GaimBuddy *buddy, GaimGroup *group) |
806 { | 806 { |
807 MsnSession *session; | 807 MsnSession *session; |
808 MsnUserList *userlist; | 808 MsnUserList *userlist; |
809 const char *who; | 809 const char *who; |
810 | 810 |
811 session = gc->proto_data; | 811 session = gc->proto_data; |
812 userlist = session->userlist; | 812 userlist = session->userlist; |
813 who = msn_normalize(gc->account, name); | 813 who = msn_normalize(gc->account, buddy->name); |
814 | 814 |
815 if (group != NULL) | 815 if (group != NULL) |
816 gaim_debug_info("msn", "msn_add_buddy: %s, %s\n", who, group->name); | 816 gaim_debug_info("msn", "msn_add_buddy: %s, %s\n", who, group->name); |
817 else | 817 else |
818 gaim_debug_info("msn", "msn_add_buddy: %s\n", who); | 818 gaim_debug_info("msn", "msn_add_buddy: %s\n", who); |
821 /* Which is the max? */ | 821 /* Which is the max? */ |
822 if (session->fl_users_count >= 150) | 822 if (session->fl_users_count >= 150) |
823 { | 823 { |
824 gaim_debug_info("msn", "Too many buddies\n"); | 824 gaim_debug_info("msn", "Too many buddies\n"); |
825 /* Buddy list full */ | 825 /* Buddy list full */ |
826 /* TODO: gaim should be notifyied of this */ | 826 /* TODO: gaim should be notified of this */ |
827 return; | 827 return; |
828 } | 828 } |
829 #endif | 829 #endif |
830 | 830 |
831 /* XXX - Would group ever be NULL here? I don't think so... */ | |
831 msn_userlist_add_buddy(userlist, who, MSN_LIST_FL, | 832 msn_userlist_add_buddy(userlist, who, MSN_LIST_FL, |
832 group ? group->name : NULL); | 833 group ? group->name : NULL); |
833 } | 834 } |
834 | 835 |
835 static void | 836 static void |
836 msn_rem_buddy(GaimConnection *gc, const char *who, const char *group_name) | 837 msn_rem_buddy(GaimConnection *gc, GaimBuddy *buddy, GaimGroup *group) |
837 { | 838 { |
838 MsnSession *session; | 839 MsnSession *session; |
839 MsnUserList *userlist; | 840 MsnUserList *userlist; |
840 | 841 |
841 session = gc->proto_data; | 842 session = gc->proto_data; |
842 userlist = session->userlist; | 843 userlist = session->userlist; |
843 | 844 |
844 msn_userlist_rem_buddy(userlist, who, MSN_LIST_FL, group_name); | 845 /* XXX - Does buddy->name need to be msn_normalize'd here? --KingAnt */ |
846 msn_userlist_rem_buddy(userlist, buddy->name, MSN_LIST_FL, group->name); | |
845 } | 847 } |
846 | 848 |
847 static void | 849 static void |
848 msn_add_permit(GaimConnection *gc, const char *who) | 850 msn_add_permit(GaimConnection *gc, const char *who) |
849 { | 851 { |
1035 | 1037 |
1036 msn_userlist_move_buddy(userlist, who, old_group_name, new_group_name); | 1038 msn_userlist_move_buddy(userlist, who, old_group_name, new_group_name); |
1037 } | 1039 } |
1038 | 1040 |
1039 static void | 1041 static void |
1040 msn_rename_group(GaimConnection *gc, const char *old_group_name, | 1042 msn_rename_group(GaimConnection *gc, const char *old_name, |
1041 const char *new_group_name, GList *members) | 1043 GaimGroup *group, GList *moved_buddies) |
1042 { | 1044 { |
1043 MsnSession *session; | 1045 MsnSession *session; |
1044 MsnCmdProc *cmdproc; | 1046 MsnCmdProc *cmdproc; |
1045 int old_gid; | 1047 int old_gid; |
1046 const char *enc_new_group_name; | 1048 const char *enc_new_group_name; |
1047 | 1049 |
1048 session = gc->proto_data; | 1050 session = gc->proto_data; |
1049 cmdproc = session->notification->cmdproc; | 1051 cmdproc = session->notification->cmdproc; |
1050 enc_new_group_name = gaim_url_encode(new_group_name); | 1052 enc_new_group_name = gaim_url_encode(group->name); |
1051 | 1053 |
1052 old_gid = msn_userlist_find_group_id(session->userlist, old_group_name); | 1054 old_gid = msn_userlist_find_group_id(session->userlist, old_name); |
1053 | 1055 |
1054 if (old_gid >= 0) | 1056 if (old_gid >= 0) |
1055 { | 1057 { |
1056 msn_cmdproc_send(cmdproc, "REG", "%d %s 0", old_gid, | 1058 msn_cmdproc_send(cmdproc, "REG", "%d %s 0", old_gid, |
1057 enc_new_group_name); | 1059 enc_new_group_name); |
1110 | 1112 |
1111 msn_change_status(session, session->state); | 1113 msn_change_status(session, session->state); |
1112 } | 1114 } |
1113 | 1115 |
1114 static void | 1116 static void |
1115 msn_remove_group(GaimConnection *gc, const char *name) | 1117 msn_remove_group(GaimConnection *gc, GaimGroup *group) |
1116 { | 1118 { |
1117 MsnSession *session; | 1119 MsnSession *session; |
1118 MsnCmdProc *cmdproc; | 1120 MsnCmdProc *cmdproc; |
1119 int group_id; | 1121 int group_id; |
1120 | 1122 |
1121 session = gc->proto_data; | 1123 session = gc->proto_data; |
1122 cmdproc = session->notification->cmdproc; | 1124 cmdproc = session->notification->cmdproc; |
1123 | 1125 |
1124 if ((group_id = msn_userlist_find_group_id(session->userlist, name)) >= 0) | 1126 if ((group_id = msn_userlist_find_group_id(session->userlist, group->name)) >= 0) |
1125 { | 1127 { |
1126 msn_cmdproc_send(cmdproc, "RMG", "%d", group_id); | 1128 msn_cmdproc_send(cmdproc, "RMG", "%d", group_id); |
1127 } | 1129 } |
1128 } | 1130 } |
1129 | 1131 |