Mercurial > pidgin
comparison src/protocols/gg/gg.c @ 4491:3196d9044a45
[gaim-migrate @ 4766]
aim_user is dead. long live gaim_account.
committer: Tailor Script <tailor@pidgin.im>
author | Nathan Walp <nwalp@pidgin.im> |
---|---|
date | Fri, 31 Jan 2003 13:03:47 +0000 |
parents | 2afc0f845e74 |
children | 238e1dd2f1a7 |
comparison
equal
deleted
inserted
replaced
4490:70b892694e0b | 4491:3196d9044a45 |
---|---|
1 /* | 1 /* |
2 * gaim - Gadu-Gadu Protocol Plugin | 2 * gaim - Gadu-Gadu Protocol Plugin |
3 * $Id: gg.c 4727 2003-01-28 21:42:44Z seanegan $ | 3 * $Id: gg.c 4766 2003-01-31 13:03:47Z 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 |
128 return g_strcasecmp(arg_a, arg_b); | 128 return g_strcasecmp(arg_a, arg_b); |
129 } | 129 } |
130 | 130 |
131 static gboolean allowed_uin(struct gaim_connection *gc, char *uin) | 131 static gboolean allowed_uin(struct gaim_connection *gc, char *uin) |
132 { | 132 { |
133 switch (gc->user->permdeny) { | 133 switch (gc->account->permdeny) { |
134 case 1: | 134 case 1: |
135 /* permit all, deny none */ | 135 /* permit all, deny none */ |
136 return TRUE; | 136 return TRUE; |
137 break; | 137 break; |
138 case 2: | 138 case 2: |
139 /* deny all, permit none. */ | 139 /* deny all, permit none. */ |
140 return FALSE; | 140 return FALSE; |
141 break; | 141 break; |
142 case 3: | 142 case 3: |
143 /* permit some. */ | 143 /* permit some. */ |
144 if (g_slist_find_custom(gc->user->permit, uin, args_compare)) | 144 if (g_slist_find_custom(gc->account->permit, uin, args_compare)) |
145 return TRUE; | 145 return TRUE; |
146 return FALSE; | 146 return FALSE; |
147 break; | 147 break; |
148 case 4: | 148 case 4: |
149 /* deny some. */ | 149 /* deny some. */ |
150 if (g_slist_find_custom(gc->user->deny, uin, args_compare)) | 150 if (g_slist_find_custom(gc->account->deny, uin, args_compare)) |
151 return FALSE; | 151 return FALSE; |
152 return TRUE; | 152 return TRUE; |
153 break; | 153 break; |
154 default: | 154 default: |
155 return TRUE; | 155 return TRUE; |
276 /* Enhance these functions, more options and such stuff */ | 276 /* Enhance these functions, more options and such stuff */ |
277 static GList *agg_buddy_menu(struct gaim_connection *gc, char *who) | 277 static GList *agg_buddy_menu(struct gaim_connection *gc, char *who) |
278 { | 278 { |
279 GList *m = NULL; | 279 GList *m = NULL; |
280 struct proto_buddy_menu *pbm; | 280 struct proto_buddy_menu *pbm; |
281 struct buddy *b = find_buddy(gc->user, who); | 281 struct buddy *b = find_buddy(gc->account, who); |
282 static char buf[AGG_BUF_LEN]; | 282 static char buf[AGG_BUF_LEN]; |
283 | 283 |
284 if (!b) { | 284 if (!b) { |
285 return m; | 285 return m; |
286 } | 286 } |
530 signoff(gc); | 530 signoff(gc); |
531 return; | 531 return; |
532 } | 532 } |
533 } | 533 } |
534 | 534 |
535 static void agg_login(struct aim_user *user) | 535 static void agg_login(struct gaim_account *account) |
536 { | 536 { |
537 struct gaim_connection *gc = new_gaim_conn(user); | 537 struct gaim_connection *gc = new_gaim_conn(account); |
538 struct agg_data *gd = gc->proto_data = g_new0(struct agg_data, 1); | 538 struct agg_data *gd = gc->proto_data = g_new0(struct agg_data, 1); |
539 char buf[80]; | 539 char buf[80]; |
540 | 540 |
541 gc->checkbox = _("Send as message"); | 541 gc->checkbox = _("Send as message"); |
542 | 542 |
543 gd->sess = g_new0(struct gg_session, 1); | 543 gd->sess = g_new0(struct gg_session, 1); |
544 | 544 |
545 if (user->proto_opt[USEROPT_NICK][0]) | 545 if (account->proto_opt[USEROPT_NICK][0]) |
546 g_snprintf(gc->displayname, sizeof(gc->displayname), "%s", | 546 g_snprintf(gc->displayname, sizeof(gc->displayname), "%s", |
547 user->proto_opt[USEROPT_NICK]); | 547 account->proto_opt[USEROPT_NICK]); |
548 | 548 |
549 set_login_progress(gc, 1, _("Looking up GG server")); | 549 set_login_progress(gc, 1, _("Looking up GG server")); |
550 | 550 |
551 if (invalid_uin(user->username)) { | 551 if (invalid_uin(account->username)) { |
552 hide_login_progress(gc, _("Invalid Gadu-Gadu UIN specified")); | 552 hide_login_progress(gc, _("Invalid Gadu-Gadu UIN specified")); |
553 signoff(gc); | 553 signoff(gc); |
554 return; | 554 return; |
555 } | 555 } |
556 | 556 |
565 } | 565 } |
566 | 566 |
567 gg_login() sucks for me, so I'm using proxy_connect() | 567 gg_login() sucks for me, so I'm using proxy_connect() |
568 */ | 568 */ |
569 | 569 |
570 gd->sess->uin = (uin_t) strtol(user->username, (char **)NULL, 10); | 570 gd->sess->uin = (uin_t) strtol(account->username, (char **)NULL, 10); |
571 gd->sess->password = g_strdup(user->password); | 571 gd->sess->password = g_strdup(account->password); |
572 gd->sess->state = GG_STATE_CONNECTING; | 572 gd->sess->state = GG_STATE_CONNECTING; |
573 gd->sess->check = GG_CHECK_WRITE; | 573 gd->sess->check = GG_CHECK_WRITE; |
574 gd->sess->async = 1; | 574 gd->sess->async = 1; |
575 if (proxy_connect(GG_APPMSG_HOST, GG_APPMSG_PORT, login_callback, gc) < 0) { | 575 if (proxy_connect(GG_APPMSG_HOST, GG_APPMSG_PORT, login_callback, gc) < 0) { |
576 g_snprintf(buf, sizeof(buf), _("Connect to %s failed"), GG_APPMSG_HOST); | 576 g_snprintf(buf, sizeof(buf), _("Connect to %s failed"), GG_APPMSG_HOST); |
791 if (invalid_uin(name)) { | 791 if (invalid_uin(name)) { |
792 continue; | 792 continue; |
793 } | 793 } |
794 | 794 |
795 debug_printf("import_buddies_server_results: uin: %s\n", name); | 795 debug_printf("import_buddies_server_results: uin: %s\n", name); |
796 if (!find_buddy(gc->user, name)) { | 796 if (!find_buddy(gc->account, name)) { |
797 /* Default group if none specified on server */ | 797 /* Default group if none specified on server */ |
798 gchar *group = g_strdup("Gadu-Gadu"); | 798 gchar *group = g_strdup("Gadu-Gadu"); |
799 if (strlen(data_tbl[5])) { | 799 if (strlen(data_tbl[5])) { |
800 gchar **group_tbl = g_strsplit(data_tbl[5], ",", 2); | 800 gchar **group_tbl = g_strsplit(data_tbl[5], ",", 2); |
801 if (strlen(group_tbl[0])) { | 801 if (strlen(group_tbl[0])) { |
803 group = g_strdup(group_tbl[0]); | 803 group = g_strdup(group_tbl[0]); |
804 } | 804 } |
805 g_strfreev(group_tbl); | 805 g_strfreev(group_tbl); |
806 } | 806 } |
807 /* Add Buddy to our userlist */ | 807 /* Add Buddy to our userlist */ |
808 add_buddy(gc->user, group, name, strlen(show) ? show : name); | 808 add_buddy(gc->account, group, name, strlen(show) ? show : name); |
809 gaim_blist_save(); | 809 gaim_blist_save(); |
810 g_free(group); | 810 g_free(group); |
811 } | 811 } |
812 g_free(show); | 812 g_free(show); |
813 g_strfreev(data_tbl); | 813 g_strfreev(data_tbl); |
1015 struct group *g = gr->data; | 1015 struct group *g = gr->data; |
1016 GSList *m = g->members; | 1016 GSList *m = g->members; |
1017 while (m) { | 1017 while (m) { |
1018 struct buddy *b = m->data; | 1018 struct buddy *b = m->data; |
1019 | 1019 |
1020 if(b->user->gc == gc) { | 1020 if(b->account->gc == gc) { |
1021 gchar *newdata; | 1021 gchar *newdata; |
1022 /* GG Number */ | 1022 /* GG Number */ |
1023 gchar *name = gg_urlencode(b->name); | 1023 gchar *name = gg_urlencode(b->name); |
1024 /* GG Pseudo */ | 1024 /* GG Pseudo */ |
1025 gchar *show = gg_urlencode(b->alias[0] ? b->alias : b->name); | 1025 gchar *show = gg_urlencode(b->alias[0] ? b->alias : b->name); |