comparison src/conversation.c @ 1030:38452403563b

[gaim-migrate @ 1040] updating the buddy list to work better with multiple connections. there are still a bunch of things fucked up with this but i wanted more people to start working on it than just me, especially since i won't be here this weekend. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Fri, 27 Oct 2000 07:53:32 +0000
parents 1d8f05ea6bdf
children 643a4d81c18a
comparison
equal deleted inserted replaced
1029:740c6f933fe0 1030:38452403563b
133 fprintf(fd, " ---- New Conversation @ %s ----\n", full_date()); 133 fprintf(fd, " ---- New Conversation @ %s ----\n", full_date());
134 134
135 fclose(fd); 135 fclose(fd);
136 } 136 }
137 137
138 show_conv(c);
139 if (connections) 138 if (connections)
140 c->gc = (struct gaim_connection *)connections->data; 139 c->gc = (struct gaim_connection *)connections->data;
140 show_conv(c);
141 conversations = g_list_append(conversations, c); 141 conversations = g_list_append(conversations, c);
142 plugin_event(event_new_conversation, name, 0, 0, 0); 142 plugin_event(event_new_conversation, name, 0, 0, 0);
143 return c; 143 return c;
144 } 144 }
145 145
404 return FALSE; 404 return FALSE;
405 } 405 }
406 406
407 void add_callback(GtkWidget *widget, struct conversation *c) 407 void add_callback(GtkWidget *widget, struct conversation *c)
408 { 408 {
409 if (find_buddy(c->name) != NULL) { 409 if (c->gc && find_buddy(c->gc, c->name) != NULL) {
410 int dispstyle;
411 GtkWidget *parent = c->add->parent;
412
413 dispstyle = set_dispstyle(0);
414
415 sprintf(debug_buff,_("Removing '%s' from buddylist.\n"), c->name); 410 sprintf(debug_buff,_("Removing '%s' from buddylist.\n"), c->name);
416 debug_print(debug_buff); 411 debug_print(debug_buff);
417 remove_buddy(find_group_by_buddy(c->name), find_buddy(c->name)); 412 remove_buddy(c->gc, find_group_by_buddy(c->gc, c->name), find_buddy(c->gc, c->name));
418 build_edit_tree(); 413 build_edit_tree();
419 gtk_widget_destroy(c->add); 414 update_convo_add_button(c);
420 c->add = picture_button2(c->window, _("Add"), gnome_add_xpm, dispstyle);
421 gtk_signal_connect(GTK_OBJECT(c->add), "clicked", GTK_SIGNAL_FUNC(add_callback), c);
422 gtk_box_pack_end(GTK_BOX(parent), c->add, dispstyle, dispstyle, 0);
423 gtk_box_reorder_child(GTK_BOX(parent), c->add, 2);
424 gtk_widget_show(c->add);
425 } 415 }
426 else 416 else
427 { 417 {
428 show_add_buddy(c->name, NULL); 418 show_add_buddy(c->gc, c->name, NULL);
429 } 419 }
430 420
431 gtk_widget_grab_focus(c->entry); 421 gtk_widget_grab_focus(c->entry);
432 } 422 }
433 423
1179 char *smiley = g_malloc(7); 1169 char *smiley = g_malloc(7);
1180 struct buddy *b; 1170 struct buddy *b;
1181 1171
1182 if (!who) { 1172 if (!who) {
1183 if (flags & WFLAG_SEND) { 1173 if (flags & WFLAG_SEND) {
1184 b = find_buddy(c->gc->username); 1174 b = find_buddy(c->gc, c->gc->username);
1185 if (b) 1175 if (b)
1186 who = b->show; 1176 who = b->show;
1187 else 1177 else
1188 who = c->gc->username; 1178 who = c->gc->username;
1189 } else { 1179 } else {
1190 b = find_buddy(c->name); 1180 b = find_buddy(c->gc, c->name);
1191 if (b) 1181 if (b)
1192 who = b->show; 1182 who = b->show;
1193 else 1183 else
1194 who = c->name; 1184 who = c->name;
1195 } 1185 }
1196 } else { 1186 } else {
1197 b = find_buddy(who); 1187 b = find_buddy(c->gc, who);
1198 if (b) 1188 if (b)
1199 who = b->show; 1189 who = b->show;
1200 } 1190 }
1201 1191
1202 if (flags & WFLAG_SYSTEM) { 1192 if (flags & WFLAG_SYSTEM) {
1596 { 1586 {
1597 struct conversation *cnv = gtk_object_get_user_data(m); 1587 struct conversation *cnv = gtk_object_get_user_data(m);
1598 cnv->gc = c; 1588 cnv->gc = c;
1599 } 1589 }
1600 1590
1591 void update_convo_add_button(struct conversation *c)
1592 {
1593 int dispstyle = set_dispstyle(0);
1594 GtkWidget *parent = c->add->parent;
1595 gtk_widget_destroy(c->add);
1596
1597 if (c->gc && find_buddy(c->gc, c->name)) {
1598 /* remove */
1599 c->add = picture_button2(c->window, _("Remove"), gnome_remove_xpm, dispstyle);
1600 } else {
1601 c->add = picture_button2(c->window, _("Add"), gnome_remove_xpm, dispstyle);
1602 }
1603 gtk_signal_connect(GTK_OBJECT(c->add), "clicked", GTK_SIGNAL_FUNC(add_callback), c);
1604 gtk_box_pack_end(GTK_BOX(parent), c->add, dispstyle, dispstyle, 0);
1605 gtk_box_reorder_child(GTK_BOX(parent), c->add, 2);
1606 gtk_widget_show(c->add);
1607 }
1608
1601 static void create_convo_menu(struct conversation *cnv) 1609 static void create_convo_menu(struct conversation *cnv)
1602 { 1610 {
1603 GtkWidget *menu, *opt; 1611 GtkWidget *menu, *opt;
1604 GSList *g = connections; 1612 GSList *g = connections;
1605 struct gaim_connection *c; 1613 struct gaim_connection *c;
1640 1648
1641 if (connections) 1649 if (connections)
1642 C->gc = (struct gaim_connection *)connections->data; 1650 C->gc = (struct gaim_connection *)connections->data;
1643 else 1651 else
1644 C->gc = NULL; 1652 C->gc = NULL;
1653
1654 update_convo_add_button(C);
1645 1655
1646 c = c->next; 1656 c = c->next;
1647 } 1657 }
1648 } 1658 }
1649 1659
1682 1692
1683 send = picture_button2(win, _("Send"), tmp_send_xpm, dispstyle); 1693 send = picture_button2(win, _("Send"), tmp_send_xpm, dispstyle);
1684 info = picture_button2(win, _("Info"), tb_search_xpm, dispstyle); 1694 info = picture_button2(win, _("Info"), tb_search_xpm, dispstyle);
1685 warn = picture_button2(win, _("Warn"), warn_xpm, dispstyle); 1695 warn = picture_button2(win, _("Warn"), warn_xpm, dispstyle);
1686 close = picture_button2(win, _("Close"), cancel_xpm, dispstyle); 1696 close = picture_button2(win, _("Close"), cancel_xpm, dispstyle);
1687 if (find_buddy(c->name) != NULL) 1697 if (c->gc && find_buddy(c->gc, c->name) != NULL)
1688 add = picture_button2(win, _("Remove"), gnome_remove_xpm, dispstyle); 1698 add = picture_button2(win, _("Remove"), gnome_remove_xpm, dispstyle);
1689 else 1699 else
1690 add = picture_button2(win, _("Add"), gnome_add_xpm, dispstyle); 1700 add = picture_button2(win, _("Add"), gnome_add_xpm, dispstyle);
1691 block = picture_button2(win, _("Block"), block_xpm, dispstyle); 1701 block = picture_button2(win, _("Block"), block_xpm, dispstyle);
1692 1702