comparison src/protocols/oscar/oscar.c @ 4770:c4c28874ecd3

[gaim-migrate @ 5088] I want to go to sleep. This is drag-n-drop moving of buddies in the list. I think it works, but I didn't actually test it... I really should have though; I can't imagine it working fine as-is. ;) I'm holding off on the rest of my Edit Buddy List stuff for tomorrow... I love last minute things, don't I? Note: I created gaim_blist_members and gaim_blist_groups to reproduce the effects of the old groups GSList and the members GSList of the group struct that I removed. This is really sub-optimal and should be replaced to iterate the Buddy List directly. If someone wants to do that, please do. Even if you don't want to do that, just review the changes I made and make sure I didn't do anything stupid. It is past 6am and I'm a bit tired and prone to mistake making. Thanks. committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Fri, 14 Mar 2003 11:38:21 +0000
parents 03aa36cb4e38
children 6219ffd18c63
comparison
equal deleted inserted replaced
4769:e0afac5f85bd 4770:c4c28874ecd3
71 static struct prpl *my_protocol = NULL; 71 static struct prpl *my_protocol = NULL;
72 72
73 /* For win32 compatability */ 73 /* For win32 compatability */
74 G_MODULE_IMPORT GSList *connections; 74 G_MODULE_IMPORT GSList *connections;
75 G_MODULE_IMPORT int report_idle; 75 G_MODULE_IMPORT int report_idle;
76 G_MODULE_IMPORT GSList *groups;
77 76
78 static int caps_aim = AIM_CAPS_CHAT | AIM_CAPS_BUDDYICON | AIM_CAPS_IMIMAGE | AIM_CAPS_SENDFILE; 77 static int caps_aim = AIM_CAPS_CHAT | AIM_CAPS_BUDDYICON | AIM_CAPS_IMIMAGE | AIM_CAPS_SENDFILE;
79 static int caps_icq = AIM_CAPS_BUDDYICON | AIM_CAPS_IMIMAGE | AIM_CAPS_SENDFILE | AIM_CAPS_ICQUTF8; 78 static int caps_icq = AIM_CAPS_BUDDYICON | AIM_CAPS_IMIMAGE | AIM_CAPS_SENDFILE | AIM_CAPS_ICQUTF8;
80 79
81 static fu8_t features_aim[] = {0x01, 0x01, 0x01, 0x02}; 80 static fu8_t features_aim[] = {0x01, 0x01, 0x01, 0x02};
4492 { /* Add from local list to server list */ 4491 { /* Add from local list to server list */
4493 GaimBlistNode *gnode, *bnode; 4492 GaimBlistNode *gnode, *bnode;
4494 struct group *group; 4493 struct group *group;
4495 struct buddy *buddy; 4494 struct buddy *buddy;
4496 struct gaim_buddy_list *blist; 4495 struct gaim_buddy_list *blist;
4496 GSList *groups = gaim_blist_groups();
4497 GSList *cur; 4497 GSList *cur;
4498 4498
4499 /* Buddies */ 4499 /* Buddies */
4500 if ((blist = gaim_get_blist())) 4500 if ((blist = gaim_get_blist()))
4501 for (gnode = blist->root; gnode; gnode = gnode->next) { 4501 for (gnode = blist->root; gnode; gnode = gnode->next) {
4546 aim_ssi_setpresence(sess, fr->conn, tmp | 0x400); 4546 aim_ssi_setpresence(sess, fr->conn, tmp | 0x400);
4547 4547
4548 /* Check for maximum number of buddies */ 4548 /* Check for maximum number of buddies */
4549 for (cur=groups, tmp=0; cur; cur=g_slist_next(cur)) { 4549 for (cur=groups, tmp=0; cur; cur=g_slist_next(cur)) {
4550 struct group* gr = (struct group*)cur->data; 4550 struct group* gr = (struct group*)cur->data;
4551 GSList *buds = gr->members; 4551 GSList *buds = gaim_blist_members(gr);
4552 while(buds) { 4552 GSList *buds1 = buds;
4553 struct buddy *b = buds->data; 4553 while(buds1) {
4554 struct buddy *b = buds1->data;
4554 if(b->account == gc->account) 4555 if(b->account == gc->account)
4555 tmp++; 4556 tmp++;
4556 buds = buds->next; 4557 buds1 = buds1->next;
4557 } 4558 }
4558 } 4559 g_slist_free(buds);
4560 }
4561 g_slist_free(groups);
4562
4559 if (tmp > od->rights.maxbuddies) { 4563 if (tmp > od->rights.maxbuddies) {
4560 char *dialog_msg = g_strdup_printf(_("The maximum number of buddies allowed in your buddy list is %d, and you have %d." 4564 char *dialog_msg = g_strdup_printf(_("The maximum number of buddies allowed in your buddy list is %d, and you have %d."
4561 " Until you are below the limit, some buddies will not show up as online."), 4565 " Until you are below the limit, some buddies will not show up as online."),
4562 od->rights.maxbuddies, tmp); 4566 od->rights.maxbuddies, tmp);
4563 do_error_dialog(_("Maximum buddy list length exceeded."), dialog_msg, GAIM_WARNING); 4567 do_error_dialog(_("Maximum buddy list length exceeded."), dialog_msg, GAIM_WARNING);
5141 } 5145 }
5142 5146
5143 static void oscar_set_permit_deny(struct gaim_connection *gc) { 5147 static void oscar_set_permit_deny(struct gaim_connection *gc) {
5144 struct oscar_data *od = (struct oscar_data *)gc->proto_data; 5148 struct oscar_data *od = (struct oscar_data *)gc->proto_data;
5145 #ifdef NOSSI 5149 #ifdef NOSSI
5146 GSList *list, *g; 5150 GSList *list, *g = gaim_blist_groups(), *g1;
5147 char buf[MAXMSGLEN]; 5151 char buf[MAXMSGLEN];
5148 int at; 5152 int at;
5149 5153
5150 switch(gc->account->permdeny) { 5154 switch(gc->account->permdeny) {
5151 case 1: 5155 case 1:
5171 list = list->next; 5175 list = list->next;
5172 } 5176 }
5173 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_DENYADD, buf); 5177 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_DENYADD, buf);
5174 break; 5178 break;
5175 case 5: 5179 case 5:
5176 g = groups; 5180 g1 = g;
5177 at = 0; 5181 at = 0;
5178 while (g) { 5182 while (g1) {
5179 list = ((struct group *)g->data)->members; 5183 list = gaim_blist_members((struct group *)g->data);
5180 while (list) { 5184 GSList list1 = list;
5181 struct buddy *b = list->data; 5185 while (list1) {
5186 struct buddy *b = list1->data;
5182 if(b->account == gc->account) 5187 if(b->account == gc->account)
5183 at += g_snprintf(buf + at, sizeof(buf) - at, "%s&", b->name); 5188 at += g_snprintf(buf + at, sizeof(buf) - at, "%s&", b->name);
5184 list = list->next; 5189 list1 = list1->next;
5185 } 5190 }
5186 g = g->next; 5191 g_slist_free(list);
5187 } 5192 g1 = g1->next;
5193 }
5194 g_slist_free(g);
5188 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_PERMITADD, buf); 5195 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_PERMITADD, buf);
5189 break; 5196 break;
5190 default: 5197 default:
5191 break; 5198 break;
5192 } 5199 }
5410 5417
5411 static void oscar_show_awaitingauth(struct gaim_connection *gc) 5418 static void oscar_show_awaitingauth(struct gaim_connection *gc)
5412 { 5419 {
5413 struct oscar_data *od = gc->proto_data; 5420 struct oscar_data *od = gc->proto_data;
5414 gchar *nombre, *text, *tmp; 5421 gchar *nombre, *text, *tmp;
5415 GSList *curg, *curb; 5422 GSList *curg = gaim_blist_groups(), *curg1, *curb;
5416 int num=0; 5423 int num=0;
5417 5424
5418 text = g_strdup(_("You are awaiting authorization from the following buddies:<BR>")); 5425 text = g_strdup(_("You are awaiting authorization from the following buddies:<BR>"));
5419 5426
5420 for (curg=groups; curg; curg=g_slist_next(curg)) { 5427 for (curg1 = curg; curg1; curg1=g_slist_next(curg1)) {
5421 struct group *group = curg->data; 5428 struct group *group = curg1->data;
5422 for (curb=group->members; curb; curb=g_slist_next(curb)) { 5429 GSList *curb = gaim_blist_members(group);
5423 struct buddy *buddy = curb->data; 5430 GSList *curb1;
5431 for (curb1=curb; curb1; curb1=g_slist_next(curb1)) {
5432 struct buddy *buddy = curb1->data;
5424 if (buddy->account == gc->account && aim_ssi_waitingforauth(od->sess->ssi.local, group->name, buddy->name)) { 5433 if (buddy->account == gc->account && aim_ssi_waitingforauth(od->sess->ssi.local, group->name, buddy->name)) {
5425 if (gaim_get_buddy_alias_only(buddy)) 5434 if (gaim_get_buddy_alias_only(buddy))
5426 nombre = g_strdup_printf(" %s (%s)", buddy->name, gaim_get_buddy_alias_only(buddy)); 5435 nombre = g_strdup_printf(" %s (%s)", buddy->name, gaim_get_buddy_alias_only(buddy));
5427 else 5436 else
5428 nombre = g_strdup_printf(" %s", buddy->name); 5437 nombre = g_strdup_printf(" %s", buddy->name);
5431 text = tmp; 5440 text = tmp;
5432 g_free(nombre); 5441 g_free(nombre);
5433 num++; 5442 num++;
5434 } 5443 }
5435 } 5444 }
5436 } 5445 g_slist_free(curb);
5446 }
5447 g_slist_free(curg);
5437 5448
5438 if (!num) { 5449 if (!num) {
5439 tmp = g_strdup_printf("%s<BR>%s", text, _("<i>you are not waiting for authorization</i>")); 5450 tmp = g_strdup_printf("%s<BR>%s", text, _("<i>you are not waiting for authorization</i>"));
5440 g_free(text); 5451 g_free(text);
5441 text = tmp; 5452 text = tmp;