src/buddy.c

changeset 960
c4012584334f
parent 945
a337fdf46dcc
child 966
57ba1b059564
equal deleted inserted replaced
959:278bb65cea86 960:c4012584334f
46 #include "pixmaps/dt_icon.xpm" 46 #include "pixmaps/dt_icon.xpm"
47 #include "pixmaps/no_icon.xpm" 47 #include "pixmaps/no_icon.xpm"
48 #include "pixmaps/login_icon.xpm" 48 #include "pixmaps/login_icon.xpm"
49 #include "pixmaps/logout_icon.xpm" 49 #include "pixmaps/logout_icon.xpm"
50 50
51 #include "pixmaps/buddyadd.xpm"
52 #include "pixmaps/buddydel.xpm"
53 #include "pixmaps/buddychat.xpm"
54 #include "pixmaps/im.xpm"
55 #include "pixmaps/info.xpm"
56 #include "pixmaps/away_icon.xpm" 51 #include "pixmaps/away_icon.xpm"
57 #include "pixmaps/away_small.xpm" 52 #include "pixmaps/away_small.xpm"
58
59 #include "pixmaps/daemon-buddyadd.xpm"
60 #include "pixmaps/daemon-buddydel.xpm"
61 #include "pixmaps/daemon-buddychat.xpm"
62 #include "pixmaps/daemon-im.xpm"
63 #include "pixmaps/daemon-info.xpm"
64 53
65 #include "pixmaps/add_small.xpm" 54 #include "pixmaps/add_small.xpm"
66 #include "pixmaps/import_small.xpm" 55 #include "pixmaps/import_small.xpm"
67 #include "pixmaps/export_small.xpm" 56 #include "pixmaps/export_small.xpm"
68 #if defined(GAIM_PLUGINS) || defined(USE_PERL) 57 #if defined(GAIM_PLUGINS) || defined(USE_PERL)
284 } 273 }
285 274
286 #endif 275 #endif
287 276
288 277
289 void signoff() 278 static void signoff_all(GtkWidget *w, gpointer d)
279 {
280 GSList *c = connections;
281 struct gaim_connection *g = NULL;
282
283 while (c) {
284 g = (struct gaim_connection *)c->data;
285 signoff(g);
286 c = connections;
287 }
288 }
289
290 void signoff(struct gaim_connection *gc)
290 { 291 {
291 GList *mem; 292 GList *mem;
292 293
293 plugin_event(event_signoff, 0, 0, 0); 294 plugin_event(event_signoff, gc, 0, 0);
294 295 serv_close(gc);
296
297 if (connections) return;
295 while(groups) { 298 while(groups) {
296 mem = ((struct group *)groups->data)->members; 299 mem = ((struct group *)groups->data)->members;
297 while(mem) { 300 while(mem) {
298 g_free(mem->data); 301 g_free(mem->data);
299 mem = g_list_remove(mem, mem->data); 302 mem = g_list_remove(mem, mem->data);
302 groups = g_slist_remove(groups, groups->data); 305 groups = g_slist_remove(groups, groups->data);
303 } 306 }
304 307
305 sprintf(debug_buff, "date: %s\n", full_date()); 308 sprintf(debug_buff, "date: %s\n", full_date());
306 debug_print(debug_buff); 309 debug_print(debug_buff);
307 update_keepalive(FALSE); 310 update_keepalive(gc, FALSE);
308 serv_close();
309 destroy_all_dialogs(); 311 destroy_all_dialogs();
310 destroy_buddy(); 312 destroy_buddy();
311 hide_login_progress(""); 313 hide_login_progress("");
312 #ifdef USE_APPLET 314 #ifdef USE_APPLET
313 set_user_state(offline); 315 set_user_state(offline);
419 gtk_signal_connect(GTK_OBJECT(button), "activate", 421 gtk_signal_connect(GTK_OBJECT(button), "activate",
420 GTK_SIGNAL_FUNC(pressed_alias), b); 422 GTK_SIGNAL_FUNC(pressed_alias), b);
421 gtk_menu_append(GTK_MENU(menu), button); 423 gtk_menu_append(GTK_MENU(menu), button);
422 gtk_widget_show(button); 424 gtk_widget_show(button);
423 425
424 if (!USE_OSCAR) {
425 button = gtk_menu_item_new_with_label(_("Dir Info")); 426 button = gtk_menu_item_new_with_label(_("Dir Info"));
426 gtk_signal_connect(GTK_OBJECT(button), "activate", 427 gtk_signal_connect(GTK_OBJECT(button), "activate",
427 GTK_SIGNAL_FUNC(pressed_dir_info), b); 428 GTK_SIGNAL_FUNC(pressed_dir_info), b);
428 gtk_menu_append(GTK_MENU(menu), button); 429 gtk_menu_append(GTK_MENU(menu), button);
429 gtk_widget_show(button); 430 gtk_widget_show(button);
430 } else {
431 431
432 button = gtk_menu_item_new_with_label(_("Direct IM")); 432 button = gtk_menu_item_new_with_label(_("Direct IM"));
433 gtk_signal_connect(GTK_OBJECT(button), "activate", 433 gtk_signal_connect(GTK_OBJECT(button), "activate",
434 GTK_SIGNAL_FUNC(serv_do_imimage), b->name); 434 GTK_SIGNAL_FUNC(serv_do_imimage), b->name);
435 gtk_menu_append(GTK_MENU(menu), button); 435 gtk_menu_append(GTK_MENU(menu), button);
438 button = gtk_menu_item_new_with_label(_("Away Msg")); 438 button = gtk_menu_item_new_with_label(_("Away Msg"));
439 gtk_signal_connect(GTK_OBJECT(button), "activate", 439 gtk_signal_connect(GTK_OBJECT(button), "activate",
440 GTK_SIGNAL_FUNC(pressed_away_msg), b); 440 GTK_SIGNAL_FUNC(pressed_away_msg), b);
441 gtk_menu_append(GTK_MENU(menu), button); 441 gtk_menu_append(GTK_MENU(menu), button);
442 gtk_widget_show(button); 442 gtk_widget_show(button);
443 }
444 443
445 button = gtk_menu_item_new_with_label(_("Toggle Logging")); 444 button = gtk_menu_item_new_with_label(_("Toggle Logging"));
446 gtk_signal_connect(GTK_OBJECT(button), "activate", 445 gtk_signal_connect(GTK_OBJECT(button), "activate",
447 GTK_SIGNAL_FUNC(log_callback), b->name); 446 GTK_SIGNAL_FUNC(log_callback), b->name);
448 gtk_menu_append(GTK_MENU(menu), button); 447 gtk_menu_append(GTK_MENU(menu), button);
966 } 965 }
967 update_num_groups(); 966 update_num_groups();
968 } 967 }
969 968
970 969
971 void gaimreg_callback(GtkWidget *widget)
972 {
973 show_register_dialog();
974 }
975
976 void import_callback(GtkWidget *widget, void *null) 970 void import_callback(GtkWidget *widget, void *null)
977 { 971 {
978 show_import_dialog(); 972 show_import_dialog();
979 } 973 }
980 974
1204 c = find_conversation(name); 1198 c = find_conversation(name);
1205 if (c == NULL) 1199 if (c == NULL)
1206 c = new_conversation(name); 1200 c = new_conversation(name);
1207 1201
1208 write_to_conv(c, b->message, WFLAG_SEND, NULL); 1202 write_to_conv(c, b->message, WFLAG_SEND, NULL);
1209
1210 escape_text(b->message);
1211 1203
1212 serv_send_im(name, b->message, 0); 1204 serv_send_im(name, b->message, 0);
1213 } 1205 }
1214 1206
1215 rem_bp(NULL, b); 1207 rem_bp(NULL, b);
1833 GtkWidget *notebook; 1825 GtkWidget *notebook;
1834 GtkWidget *label; 1826 GtkWidget *label;
1835 GtkWidget *bbox; 1827 GtkWidget *bbox;
1836 GtkWidget *tbox; 1828 GtkWidget *tbox;
1837 1829
1830 if (blist) {
1831 gtk_widget_show(blist);
1832 return;
1833 }
1834
1838 1835
1839 #ifdef USE_APPLET 1836 #ifdef USE_APPLET
1840 blist = gtk_window_new(GTK_WINDOW_DIALOG); 1837 blist = gtk_window_new(GTK_WINDOW_DIALOG);
1841 #else 1838 #else
1842 blist = gtk_window_new(GTK_WINDOW_TOPLEVEL); 1839 blist = gtk_window_new(GTK_WINDOW_TOPLEVEL);
1862 gaim_new_item_with_pixmap(menu, _("Add A Buddy"), add_small_xpm, GTK_SIGNAL_FUNC(add_buddy_callback)); 1859 gaim_new_item_with_pixmap(menu, _("Add A Buddy"), add_small_xpm, GTK_SIGNAL_FUNC(add_buddy_callback));
1863 gaim_new_item_with_pixmap(menu, _("Join A Chat"), pounce_small_xpm, GTK_SIGNAL_FUNC(chat_callback)); 1860 gaim_new_item_with_pixmap(menu, _("Join A Chat"), pounce_small_xpm, GTK_SIGNAL_FUNC(chat_callback));
1864 gaim_seperator(menu); 1861 gaim_seperator(menu);
1865 gaim_new_item_with_pixmap(menu, _("Import Buddy List"), import_small_xpm, GTK_SIGNAL_FUNC(import_callback)); 1862 gaim_new_item_with_pixmap(menu, _("Import Buddy List"), import_small_xpm, GTK_SIGNAL_FUNC(import_callback));
1866 gaim_new_item_with_pixmap(menu, _("Export Buddy List"), export_small_xpm,GTK_SIGNAL_FUNC(export_callback)); 1863 gaim_new_item_with_pixmap(menu, _("Export Buddy List"), export_small_xpm,GTK_SIGNAL_FUNC(export_callback));
1867 if (!(general_options & OPT_GEN_REGISTERED))
1868 {
1869 gaim_seperator(menu);
1870 gaim_new_item_with_pixmap(menu, _("Register"), add_small_xpm, GTK_SIGNAL_FUNC(gaimreg_callback));
1871 }
1872 gaim_seperator(menu); 1864 gaim_seperator(menu);
1873 gaim_new_item_with_pixmap(menu, _("Signoff"), logout_icon_xpm, GTK_SIGNAL_FUNC(signoff)); 1865 gaim_new_item_with_pixmap(menu, _("Signoff"), logout_icon_xpm, GTK_SIGNAL_FUNC(signoff_all));
1874 1866
1875 #ifndef USE_APPLET 1867 #ifndef USE_APPLET
1876 gaim_new_item_with_pixmap(menu, _("Quit"), exit_small_xpm, GTK_SIGNAL_FUNC(do_quit)); 1868 gaim_new_item_with_pixmap(menu, _("Quit"), exit_small_xpm, GTK_SIGNAL_FUNC(do_quit));
1877 #else 1869 #else
1878 gaim_new_item_with_pixmap(menu, _("Close"), close_small_xpm, GTK_SIGNAL_FUNC(applet_destroy_buddy)); 1870 gaim_new_item_with_pixmap(menu, _("Close"), close_small_xpm, GTK_SIGNAL_FUNC(applet_destroy_buddy));
1926 gtk_widget_show(menuitem); 1918 gtk_widget_show(menuitem);
1927 menuitem = gtk_menu_item_new_with_label(_("Change Password")); 1919 menuitem = gtk_menu_item_new_with_label(_("Change Password"));
1928 gtk_menu_append(GTK_MENU(setmenu), menuitem); 1920 gtk_menu_append(GTK_MENU(setmenu), menuitem);
1929 gtk_signal_connect(GTK_OBJECT(menuitem), "activate", GTK_SIGNAL_FUNC(show_change_passwd), NULL); 1921 gtk_signal_connect(GTK_OBJECT(menuitem), "activate", GTK_SIGNAL_FUNC(show_change_passwd), NULL);
1930 gtk_widget_show(menuitem); 1922 gtk_widget_show(menuitem);
1923 gaim_new_item_with_pixmap(menu, _("Accounts"), add_small_xpm, GTK_SIGNAL_FUNC(account_editor));
1931 gaim_seperator(menu); 1924 gaim_seperator(menu);
1932 1925
1933 gaim_new_item_with_pixmap(menu, _("Preferences"), prefs_small_xpm, GTK_SIGNAL_FUNC(show_prefs)); 1926 gaim_new_item_with_pixmap(menu, _("Preferences"), prefs_small_xpm, GTK_SIGNAL_FUNC(show_prefs));
1934 1927
1935 #ifdef GAIM_PLUGINS 1928 #ifdef GAIM_PLUGINS

mercurial