Mercurial > pidgin.yaz
comparison src/protocols/gg/gg.c @ 4349:0c68d402f59f
[gaim-migrate @ 4614]
XML Blist
Gaim stores all the buddy lists in one big happy file now. You can order
the buddies however you want, and they'll stay ordered that way.
We can also store some per-buddy information now, which will be cool.
committer: Tailor Script <tailor@pidgin.im>
author | Nathan Walp <nwalp@pidgin.im> |
---|---|
date | Sun, 19 Jan 2003 22:16:52 +0000 |
parents | cc2f780c0505 |
children | dcc6c130c6d9 |
comparison
equal
deleted
inserted
replaced
4348:922b66840a51 | 4349:0c68d402f59f |
---|---|
1 /* | 1 /* |
2 * gaim - Gadu-Gadu Protocol Plugin | 2 * gaim - Gadu-Gadu Protocol Plugin |
3 * $Id: gg.c 4597 2003-01-18 01:58:00Z thekingant $ | 3 * $Id: gg.c 4614 2003-01-19 22:16:52Z faceprint $ |
4 * | 4 * |
5 * Copyright (C) 2001 Arkadiusz Mi¶kiewicz <misiek@pld.ORG.PL> | 5 * Copyright (C) 2001 Arkadiusz Mi¶kiewicz <misiek@pld.ORG.PL> |
6 * | 6 * |
7 * This program is free software; you can redistribute it and/or modify | 7 * This program is free software; you can redistribute it and/or modify |
8 * it under the terms of the GNU General Public License as published by | 8 * it under the terms of the GNU General Public License as published by |
127 return g_strcasecmp(arg_a, arg_b); | 127 return g_strcasecmp(arg_a, arg_b); |
128 } | 128 } |
129 | 129 |
130 static gboolean allowed_uin(struct gaim_connection *gc, char *uin) | 130 static gboolean allowed_uin(struct gaim_connection *gc, char *uin) |
131 { | 131 { |
132 switch (gc->permdeny) { | 132 switch (gc->user->permdeny) { |
133 case 1: | 133 case 1: |
134 /* permit all, deny none */ | 134 /* permit all, deny none */ |
135 return TRUE; | 135 return TRUE; |
136 break; | 136 break; |
137 case 2: | 137 case 2: |
138 /* deny all, permit none. */ | 138 /* deny all, permit none. */ |
139 return FALSE; | 139 return FALSE; |
140 break; | 140 break; |
141 case 3: | 141 case 3: |
142 /* permit some. */ | 142 /* permit some. */ |
143 if (g_slist_find_custom(gc->permit, uin, args_compare)) | 143 if (g_slist_find_custom(gc->user->permit, uin, args_compare)) |
144 return TRUE; | 144 return TRUE; |
145 return FALSE; | 145 return FALSE; |
146 break; | 146 break; |
147 case 4: | 147 case 4: |
148 /* deny some. */ | 148 /* deny some. */ |
149 if (g_slist_find_custom(gc->deny, uin, args_compare)) | 149 if (g_slist_find_custom(gc->user->deny, uin, args_compare)) |
150 return FALSE; | 150 return FALSE; |
151 return TRUE; | 151 return TRUE; |
152 break; | 152 break; |
153 default: | 153 default: |
154 return TRUE; | 154 return TRUE; |
275 /* Enhance these functions, more options and such stuff */ | 275 /* Enhance these functions, more options and such stuff */ |
276 static GList *agg_buddy_menu(struct gaim_connection *gc, char *who) | 276 static GList *agg_buddy_menu(struct gaim_connection *gc, char *who) |
277 { | 277 { |
278 GList *m = NULL; | 278 GList *m = NULL; |
279 struct proto_buddy_menu *pbm; | 279 struct proto_buddy_menu *pbm; |
280 struct buddy *b = find_buddy(gc, who); | 280 struct buddy *b = find_buddy(gc->user, who); |
281 static char buf[AGG_BUF_LEN]; | 281 static char buf[AGG_BUF_LEN]; |
282 | 282 |
283 if (!b) { | 283 if (!b) { |
284 return m; | 284 return m; |
285 } | 285 } |
505 | 505 |
506 /* Our signon is complete */ | 506 /* Our signon is complete */ |
507 account_online(gc); | 507 account_online(gc); |
508 serv_finish_login(gc); | 508 serv_finish_login(gc); |
509 | 509 |
510 if (bud_list_cache_exists(gc)) | |
511 do_import(gc, NULL); | |
512 break; | 510 break; |
513 case GG_EVENT_CONN_FAILED: | 511 case GG_EVENT_CONN_FAILED: |
514 gaim_input_remove(gc->inpa); | 512 gaim_input_remove(gc->inpa); |
515 gc->inpa = 0; | 513 gc->inpa = 0; |
516 handle_errcode(gc, e->event.failure); | 514 handle_errcode(gc, e->event.failure); |
795 if (invalid_uin(name)) { | 793 if (invalid_uin(name)) { |
796 continue; | 794 continue; |
797 } | 795 } |
798 | 796 |
799 debug_printf("import_buddies_server_results: uin: %s\n", name); | 797 debug_printf("import_buddies_server_results: uin: %s\n", name); |
800 if (!find_buddy(gc, name)) { | 798 if (!find_buddy(gc->user, name)) { |
801 /* Default group if none specified on server */ | 799 /* Default group if none specified on server */ |
802 gchar *group = g_strdup("Gadu-Gadu"); | 800 gchar *group = g_strdup("Gadu-Gadu"); |
803 if (strlen(data_tbl[5])) { | 801 if (strlen(data_tbl[5])) { |
804 gchar **group_tbl = g_strsplit(data_tbl[5], ",", 2); | 802 gchar **group_tbl = g_strsplit(data_tbl[5], ",", 2); |
805 if (strlen(group_tbl[0])) { | 803 if (strlen(group_tbl[0])) { |
807 group = g_strdup(group_tbl[0]); | 805 group = g_strdup(group_tbl[0]); |
808 } | 806 } |
809 g_strfreev(group_tbl); | 807 g_strfreev(group_tbl); |
810 } | 808 } |
811 /* Add Buddy to our userlist */ | 809 /* Add Buddy to our userlist */ |
812 add_buddy(gc, group, name, strlen(show) ? show : name); | 810 add_buddy(gc->user, group, name, strlen(show) ? show : name); |
813 do_export(gc); | 811 gaim_blist_save(); |
814 g_free(group); | 812 g_free(group); |
815 } | 813 } |
816 g_strfreev(data_tbl); | 814 g_strfreev(data_tbl); |
817 } | 815 } |
818 g_strfreev(users_tbl); | 816 g_strfreev(users_tbl); |
1001 struct agg_http *he = g_new0(struct agg_http, 1); | 999 struct agg_http *he = g_new0(struct agg_http, 1); |
1002 gchar *ptr; | 1000 gchar *ptr; |
1003 gchar *u = gg_urlencode(gc->username); | 1001 gchar *u = gg_urlencode(gc->username); |
1004 gchar *p = gg_urlencode(gc->password); | 1002 gchar *p = gg_urlencode(gc->password); |
1005 | 1003 |
1006 GSList *gr = gc->groups; | 1004 GSList *gr = groups; |
1007 | 1005 |
1008 he->gc = gc; | 1006 he->gc = gc; |
1009 he->type = AGG_HTTP_USERLIST_EXPORT; | 1007 he->type = AGG_HTTP_USERLIST_EXPORT; |
1010 he->form = AGG_PUBDIR_USERLIST_EXPORT_FORM; | 1008 he->form = AGG_PUBDIR_USERLIST_EXPORT_FORM; |
1011 he->host = GG_PUBDIR_HOST; | 1009 he->host = GG_PUBDIR_HOST; |
1017 while (gr) { | 1015 while (gr) { |
1018 struct group *g = gr->data; | 1016 struct group *g = gr->data; |
1019 GSList *m = g->members; | 1017 GSList *m = g->members; |
1020 while (m) { | 1018 while (m) { |
1021 struct buddy *b = m->data; | 1019 struct buddy *b = m->data; |
1022 gchar *newdata; | 1020 |
1023 /* GG Number */ | 1021 if(b->user->gc == gc) { |
1024 gchar *name = gg_urlencode(b->name); | 1022 gchar *newdata; |
1025 /* GG Pseudo */ | 1023 /* GG Number */ |
1026 gchar *show = gg_urlencode(b->alias[0] ? b->alias : b->name); | 1024 gchar *name = gg_urlencode(b->name); |
1027 /* Group Name */ | 1025 /* GG Pseudo */ |
1028 gchar *gname = gg_urlencode(g->name); | 1026 gchar *show = gg_urlencode(b->alias[0] ? b->alias : b->name); |
1029 | 1027 /* Group Name */ |
1030 ptr = he->request; | 1028 gchar *gname = gg_urlencode(g->name); |
1031 newdata = g_strdup_printf("%s;%s;%s;%s;%s;%s;%s\r\n", | 1029 |
1032 show, show, show, show, "", gname, name); | 1030 ptr = he->request; |
1033 he->request = g_strconcat(ptr, newdata, NULL); | 1031 newdata = g_strdup_printf("%s;%s;%s;%s;%s;%s;%s\r\n", |
1034 | 1032 show, show, show, show, "", gname, name); |
1035 g_free(newdata); | 1033 he->request = g_strconcat(ptr, newdata, NULL); |
1036 g_free(ptr); | 1034 |
1037 | 1035 g_free(newdata); |
1038 g_free(gname); | 1036 g_free(ptr); |
1039 g_free(show); | 1037 |
1040 g_free(name); | 1038 g_free(gname); |
1041 | 1039 g_free(show); |
1040 g_free(name); | |
1041 } | |
1042 m = g_slist_next(m); | 1042 m = g_slist_next(m); |
1043 } | 1043 } |
1044 gr = g_slist_next(gr); | 1044 gr = g_slist_next(gr); |
1045 } | 1045 } |
1046 | 1046 |
1252 static void agg_set_permit_deny_dummy(struct gaim_connection *gc) | 1252 static void agg_set_permit_deny_dummy(struct gaim_connection *gc) |
1253 { | 1253 { |
1254 /* It's implemented on client side because GG server doesn't support this */ | 1254 /* It's implemented on client side because GG server doesn't support this */ |
1255 } | 1255 } |
1256 | 1256 |
1257 static void agg_permit_deny_dummy(struct gaim_connection *gc, char *who) | 1257 static void agg_permit_deny_dummy(struct gaim_connection *gc, const char *who) |
1258 { | 1258 { |
1259 /* It's implemented on client side because GG server doesn't support this */ | 1259 /* It's implemented on client side because GG server doesn't support this */ |
1260 } | 1260 } |
1261 | 1261 |
1262 static struct prpl *my_protocol = NULL; | 1262 static struct prpl *my_protocol = NULL; |