Mercurial > pidgin
annotate src/buddy.c @ 1661:6cea395b627d
[gaim-migrate @ 1671]
don't do doubled login/logout messages when you get both updates within 10 seconds of each other
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Fri, 30 Mar 2001 10:27:16 +0000 |
parents | d029dc28a61e |
children | 88e72116639d |
rev | line source |
---|---|
1 | 1 /* |
2 * gaim | |
3 * | |
4 * Copyright (C) 1998-1999, Mark Spencer <markster@marko.net> | |
5 * | |
6 * This program is free software; you can redistribute it and/or modify | |
7 * it under the terms of the GNU General Public License as published by | |
8 * the Free Software Foundation; either version 2 of the License, or | |
9 * (at your option) any later version. | |
10 * | |
11 * This program is distributed in the hope that it will be useful, | |
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 * GNU General Public License for more details. | |
15 * | |
16 * You should have received a copy of the GNU General Public License | |
17 * along with this program; if not, write to the Free Software | |
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
19 * | |
20 */ | |
21 | |
349
b402a23f35df
[gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
342
diff
changeset
|
22 #ifdef HAVE_CONFIG_H |
b402a23f35df
[gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
342
diff
changeset
|
23 #include "../config.h" |
b402a23f35df
[gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
342
diff
changeset
|
24 #endif |
1 | 25 #ifdef USE_APPLET |
26 #include <gnome.h> | |
27 #include <applet-widget.h> | |
1261
07f0bb41bbe1
[gaim-migrate @ 1271]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
28 #include "applet.h" |
1 | 29 #endif /* USE_APPLET */ |
391
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
30 #ifdef GAIM_PLUGINS |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
31 #include <dlfcn.h> |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
32 #endif /* GAIM_PLUGINS */ |
1 | 33 #include <string.h> |
34 #include <stdio.h> | |
35 #include <stdlib.h> | |
36 #include <math.h> | |
37 #include <time.h> | |
1233
728a90516211
[gaim-migrate @ 1243]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1230
diff
changeset
|
38 #include <unistd.h> |
1 | 39 |
1634
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
40 #include <gdk/gdkkeysyms.h> |
1 | 41 #include <gtk/gtk.h> |
42 #include <gdk/gdkx.h> | |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
43 #include "prpl.h" |
1 | 44 #include "gaim.h" |
45 #include "pixmaps/login_icon.xpm" | |
46 #include "pixmaps/logout_icon.xpm" | |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
47 #include "pixmaps/no_icon.xpm" |
1 | 48 |
872 | 49 #include "pixmaps/away_small.xpm" |
1 | 50 |
714 | 51 #include "pixmaps/add_small.xpm" |
718 | 52 #include "pixmaps/import_small.xpm" |
733 | 53 #include "pixmaps/export_small.xpm" |
885
db5f5c33e83f
[gaim-migrate @ 895]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
875
diff
changeset
|
54 #if defined(GAIM_PLUGINS) || defined(USE_PERL) |
801 | 55 #include "pixmaps/plugins_small.xpm" |
56 #endif | |
57 #include "pixmaps/prefs_small.xpm" | |
58 #include "pixmaps/search_small.xpm" | |
747
eec93c5929b9
[gaim-migrate @ 757]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
746
diff
changeset
|
59 #ifdef USE_APPLET |
727 | 60 #include "pixmaps/close_small.xpm" |
1456
6650776468b3
[gaim-migrate @ 1466]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
61 #else |
6650776468b3
[gaim-migrate @ 1466]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
62 #include "pixmaps/exit_small.xpm" |
747
eec93c5929b9
[gaim-migrate @ 757]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
746
diff
changeset
|
63 #endif |
865 | 64 #include "pixmaps/pounce_small.xpm" |
874 | 65 #include "pixmaps/about_small.xpm" |
714 | 66 |
820 | 67 #include "pixmaps/tmp_send.xpm" |
1177 | 68 #include "pixmaps/send_small.xpm" |
820 | 69 #include "pixmaps/tb_search.xpm" |
870 | 70 #include "pixmaps/join.xpm" |
875 | 71 #include "pixmaps/gnome_add.xpm" |
72 #include "pixmaps/gnome_remove.xpm" | |
73 #include "pixmaps/group.xpm" | |
820 | 74 |
1 | 75 static GtkTooltips *tips; |
1634
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
76 static GtkAccelGroup *accel; |
1 | 77 static GtkWidget *editpane; |
78 static GtkWidget *buddypane; | |
696
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
79 static GtkWidget *imchatbox; |
1 | 80 static GtkWidget *edittree; |
81 static GtkWidget *imbutton, *infobutton, *chatbutton; | |
577
aa9a8bcddd80
[gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
544
diff
changeset
|
82 static GtkWidget *addbutton, *groupbutton, *rembutton; |
1 | 83 |
436 | 84 extern int ticker_prefs; |
1 | 85 |
86 GtkWidget *blist = NULL; | |
87 GtkWidget *bpmenu; | |
88 GtkWidget *buddies; | |
89 | |
430 | 90 void BuddyTickerLogonTimeout( gpointer data ); |
91 void BuddyTickerLogoutTimeout( gpointer data ); | |
1 | 92 |
93 /* Predefine some functions */ | |
94 static void new_bp_callback(GtkWidget *w, char *name); | |
95 | |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
96 /* stuff for actual display of buddy list */ |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
97 struct group_show { |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
98 GtkWidget *item; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
99 GtkWidget *label; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
100 GtkWidget *tree; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
101 GSList *members; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
102 char *name; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
103 }; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
104 static GSList *shows = NULL; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
105 |
1069
5d4926907b21
[gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1068
diff
changeset
|
106 static struct group_show *find_group_show(char *group); |
5d4926907b21
[gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1068
diff
changeset
|
107 static struct buddy_show *find_buddy_show(struct group_show *gs, char *name); |
5d4926907b21
[gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1068
diff
changeset
|
108 static int group_number(char *group); |
5d4926907b21
[gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1068
diff
changeset
|
109 static int buddy_number(char *group, char *buddy); |
5d4926907b21
[gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1068
diff
changeset
|
110 static struct group_show *new_group_show(char *group); |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
111 static struct buddy_show *new_buddy_show(struct group_show *gs, struct buddy *buddy, char **xpm); |
1108
cb338aa38e78
[gaim-migrate @ 1118]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1106
diff
changeset
|
112 static void remove_buddy_show(struct group_show *gs, struct buddy_show *bs); |
1069
5d4926907b21
[gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1068
diff
changeset
|
113 static struct group_show *find_gs_by_bs(struct buddy_show *b); |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
114 static void redo_buddy_list(); |
1 | 115 |
116 void destroy_buddy() | |
117 { | |
118 if (blist) | |
119 gtk_widget_destroy(blist); | |
120 blist=NULL; | |
700
d904bf694bd7
[gaim-migrate @ 710]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
696
diff
changeset
|
121 imchatbox = NULL; |
1544
f7bef430ccd1
[gaim-migrate @ 1554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1509
diff
changeset
|
122 awaymenu = NULL; |
f7bef430ccd1
[gaim-migrate @ 1554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1509
diff
changeset
|
123 protomenu = NULL; |
1 | 124 } |
125 | |
126 static void adjust_pic(GtkWidget *button, const char *c, gchar **xpm) | |
127 { | |
128 GdkPixmap *pm; | |
129 GdkBitmap *bm; | |
130 GtkWidget *pic; | |
131 GtkWidget *label; | |
132 | |
133 /*if the user had opted to put pictures on the buttons*/ | |
577
aa9a8bcddd80
[gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
544
diff
changeset
|
134 if (display_options & OPT_DISP_SHOW_BUTTON_XPM && xpm) { |
820 | 135 pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm, NULL, xpm); |
1 | 136 pic = gtk_pixmap_new(pm, bm); |
137 gtk_widget_show(pic); | |
644
b3900e312d8e
[gaim-migrate @ 654]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
608
diff
changeset
|
138 gdk_pixmap_unref(pm); |
804
17def2bb9720
[gaim-migrate @ 814]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
803
diff
changeset
|
139 gdk_bitmap_unref(bm); |
1 | 140 label = GTK_BIN(button)->child; |
141 gtk_container_remove(GTK_CONTAINER(button), label); | |
142 gtk_container_add(GTK_CONTAINER(button), pic); | |
143 } else { | |
144 label = gtk_label_new(c); | |
145 gtk_widget_show(label); | |
146 pic = GTK_BIN(button)->child; | |
147 gtk_container_remove(GTK_CONTAINER(button), pic); | |
148 gtk_container_add(GTK_CONTAINER(button), label); | |
149 } | |
150 | |
151 } | |
152 | |
153 | |
1072
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
154 void toggle_show_empty_groups() { |
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
155 if (display_options & OPT_DISP_NO_MT_GRP) { |
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
156 /* remove any group_shows with empty members */ |
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
157 GSList *s = shows; |
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
158 struct group_show *g; |
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
159 |
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
160 while (s) { |
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
161 g = (struct group_show *)s->data; |
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
162 if (!g_slist_length(g->members)) { |
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
163 shows = g_slist_remove(shows, g); |
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
164 s = shows; |
1108
cb338aa38e78
[gaim-migrate @ 1118]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1106
diff
changeset
|
165 gtk_tree_remove_item(GTK_TREE(buddies), g->item); |
1072
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
166 g_free(g->name); |
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
167 g_free(g); |
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
168 } else |
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
169 s = g_slist_next(s); |
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
170 } |
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
171 |
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
172 } else { |
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
173 /* put back all groups */ |
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
174 GSList *c = connections; |
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
175 struct gaim_connection *gc; |
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
176 GSList *m; |
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
177 struct group *g; |
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
178 |
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
179 while (c) { |
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
180 gc = (struct gaim_connection *)c->data; |
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
181 m = gc->groups; |
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
182 while (m) { |
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
183 g = (struct group *)m->data; |
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
184 m = g_slist_next(m); |
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
185 if (!find_group_show(g->name)) |
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
186 new_group_show(g->name); |
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
187 } |
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
188 c = g_slist_next(c); |
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
189 } |
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
190 |
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
191 } |
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
192 } |
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
193 |
1070
b288f17c2fb2
[gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1069
diff
changeset
|
194 static void update_num_group(struct group_show *gs) { |
b288f17c2fb2
[gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1069
diff
changeset
|
195 GSList *c = connections; |
b288f17c2fb2
[gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1069
diff
changeset
|
196 struct gaim_connection *gc; |
b288f17c2fb2
[gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1069
diff
changeset
|
197 struct group *g; |
b288f17c2fb2
[gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1069
diff
changeset
|
198 struct buddy_show *b; |
b288f17c2fb2
[gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1069
diff
changeset
|
199 int total = 0, on = 0; |
b288f17c2fb2
[gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1069
diff
changeset
|
200 char buf[256]; |
b288f17c2fb2
[gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1069
diff
changeset
|
201 |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
202 if (!g_slist_find(shows, gs)) { |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
203 debug_printf("update_num_group called for unfound group_show %s\n", gs->name); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
204 return; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
205 } |
1085
8da0bf36fb99
[gaim-migrate @ 1095]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1083
diff
changeset
|
206 |
1070
b288f17c2fb2
[gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1069
diff
changeset
|
207 while (c) { |
b288f17c2fb2
[gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1069
diff
changeset
|
208 gc = (struct gaim_connection *)c->data; |
b288f17c2fb2
[gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1069
diff
changeset
|
209 g = find_group(gc, gs->name); |
b288f17c2fb2
[gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1069
diff
changeset
|
210 if (g) { |
b288f17c2fb2
[gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1069
diff
changeset
|
211 total += g_slist_length(g->members); |
b288f17c2fb2
[gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1069
diff
changeset
|
212 } |
b288f17c2fb2
[gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1069
diff
changeset
|
213 c = g_slist_next(c); |
b288f17c2fb2
[gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1069
diff
changeset
|
214 } |
b288f17c2fb2
[gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1069
diff
changeset
|
215 |
b288f17c2fb2
[gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1069
diff
changeset
|
216 c = gs->members; |
b288f17c2fb2
[gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1069
diff
changeset
|
217 while (c) { |
b288f17c2fb2
[gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1069
diff
changeset
|
218 b = (struct buddy_show *)c->data; |
b288f17c2fb2
[gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1069
diff
changeset
|
219 on += g_slist_length(b->connlist); |
b288f17c2fb2
[gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1069
diff
changeset
|
220 c = g_slist_next(c); |
b288f17c2fb2
[gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1069
diff
changeset
|
221 } |
b288f17c2fb2
[gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1069
diff
changeset
|
222 |
b288f17c2fb2
[gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1069
diff
changeset
|
223 if (display_options & OPT_DISP_SHOW_GRPNUM) |
b288f17c2fb2
[gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1069
diff
changeset
|
224 g_snprintf(buf, sizeof buf, "%s (%d/%d)", gs->name, on, total); |
b288f17c2fb2
[gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1069
diff
changeset
|
225 else |
b288f17c2fb2
[gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1069
diff
changeset
|
226 g_snprintf(buf, sizeof buf, "%s", gs->name); |
b288f17c2fb2
[gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1069
diff
changeset
|
227 |
b288f17c2fb2
[gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1069
diff
changeset
|
228 gtk_label_set_text(GTK_LABEL(gs->label), buf); |
b288f17c2fb2
[gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1069
diff
changeset
|
229 } |
b288f17c2fb2
[gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1069
diff
changeset
|
230 |
b288f17c2fb2
[gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1069
diff
changeset
|
231 void update_num_groups() { |
b288f17c2fb2
[gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1069
diff
changeset
|
232 GSList *s = shows; |
b288f17c2fb2
[gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1069
diff
changeset
|
233 struct group_show *g; |
b288f17c2fb2
[gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1069
diff
changeset
|
234 |
b288f17c2fb2
[gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1069
diff
changeset
|
235 while (s) { |
b288f17c2fb2
[gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1069
diff
changeset
|
236 g = (struct group_show *)s->data; |
b288f17c2fb2
[gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1069
diff
changeset
|
237 update_num_group(g); |
b288f17c2fb2
[gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1069
diff
changeset
|
238 s = g_slist_next(s); |
b288f17c2fb2
[gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1069
diff
changeset
|
239 } |
b288f17c2fb2
[gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1069
diff
changeset
|
240 } |
b288f17c2fb2
[gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1069
diff
changeset
|
241 |
1 | 242 void update_button_pix() |
243 { | |
244 | |
875 | 245 adjust_pic(addbutton, _("Add"), (gchar **)gnome_add_xpm); |
246 adjust_pic(groupbutton, _("Group"), (gchar **)group_xpm); | |
247 adjust_pic(rembutton, _("Remove"), (gchar **)gnome_remove_xpm); | |
248 | |
820 | 249 if (!(display_options & OPT_DISP_NO_BUTTONS)) { |
870 | 250 adjust_pic(chatbutton, _("Chat"), (gchar **)join_xpm); |
820 | 251 adjust_pic(imbutton, _("IM"), (gchar **)tmp_send_xpm); |
252 adjust_pic(infobutton, _("Info"), (gchar **)tb_search_xpm); | |
253 } | |
544
53a85529d670
[gaim-migrate @ 554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
535
diff
changeset
|
254 gtk_widget_hide(addbutton->parent); |
53a85529d670
[gaim-migrate @ 554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
535
diff
changeset
|
255 gtk_widget_show(addbutton->parent); |
696
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
256 if (!(display_options & OPT_DISP_NO_BUTTONS)) { |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
257 gtk_widget_hide(chatbutton->parent); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
258 gtk_widget_show(chatbutton->parent); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
259 } |
820 | 260 } |
1 | 261 |
262 | |
263 | |
264 #ifdef USE_APPLET | |
265 gint applet_destroy_buddy( GtkWidget *widget, GdkEvent *event,gpointer *data ) { | |
746
5a908dd5cfc4
[gaim-migrate @ 756]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
733
diff
changeset
|
266 applet_buddy_show = FALSE; |
5a908dd5cfc4
[gaim-migrate @ 756]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
733
diff
changeset
|
267 gtk_widget_hide(blist); |
1 | 268 return (TRUE); |
269 } | |
270 | |
271 #endif | |
272 | |
273 | |
966
f7886476f9d9
[gaim-migrate @ 976]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
274 void signoff_all(GtkWidget *w, gpointer d) |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
945
diff
changeset
|
275 { |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
945
diff
changeset
|
276 GSList *c = connections; |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
945
diff
changeset
|
277 struct gaim_connection *g = NULL; |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
945
diff
changeset
|
278 |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
945
diff
changeset
|
279 while (c) { |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
945
diff
changeset
|
280 g = (struct gaim_connection *)c->data; |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
945
diff
changeset
|
281 signoff(g); |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
945
diff
changeset
|
282 c = connections; |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
945
diff
changeset
|
283 } |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
945
diff
changeset
|
284 } |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
945
diff
changeset
|
285 |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
945
diff
changeset
|
286 void signoff(struct gaim_connection *gc) |
1 | 287 { |
1000
91b7377e7b45
[gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
991
diff
changeset
|
288 plugin_event(event_signoff, gc, 0, 0, 0); |
1575
427e1409917c
[gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1544
diff
changeset
|
289 system_log(log_signoff, gc, NULL, OPT_LOG_BUDDY_SIGNON | OPT_LOG_MY_SIGNON); |
1081
efcacae6acdb
[gaim-migrate @ 1091]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1077
diff
changeset
|
290 update_keepalive(gc, FALSE); |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
945
diff
changeset
|
291 serv_close(gc); |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
292 redo_buddy_list(); |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1397
diff
changeset
|
293 do_away_menu(); |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1496
diff
changeset
|
294 do_proto_menu(); |
1115
114cd406b022
[gaim-migrate @ 1125]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1109
diff
changeset
|
295 #ifdef USE_APPLET |
114cd406b022
[gaim-migrate @ 1125]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1109
diff
changeset
|
296 if (connections) |
114cd406b022
[gaim-migrate @ 1125]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1109
diff
changeset
|
297 set_user_state(online); |
114cd406b022
[gaim-migrate @ 1125]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1109
diff
changeset
|
298 #endif |
1124
a70d5200edde
[gaim-migrate @ 1134]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1117
diff
changeset
|
299 update_connection_dependent_prefs(); |
94
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
300 |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
945
diff
changeset
|
301 if (connections) return; |
1 | 302 |
1091
3d6ab4f1fa55
[gaim-migrate @ 1101]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1089
diff
changeset
|
303 { |
3d6ab4f1fa55
[gaim-migrate @ 1101]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1089
diff
changeset
|
304 GSList *s = shows; |
3d6ab4f1fa55
[gaim-migrate @ 1101]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1089
diff
changeset
|
305 struct group_show *g; |
3d6ab4f1fa55
[gaim-migrate @ 1101]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1089
diff
changeset
|
306 GSList *m; |
3d6ab4f1fa55
[gaim-migrate @ 1101]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1089
diff
changeset
|
307 struct buddy_show *b; |
3d6ab4f1fa55
[gaim-migrate @ 1101]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1089
diff
changeset
|
308 while (s) { |
3d6ab4f1fa55
[gaim-migrate @ 1101]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1089
diff
changeset
|
309 g = (struct group_show *)s->data; |
3d6ab4f1fa55
[gaim-migrate @ 1101]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1089
diff
changeset
|
310 debug_printf("group_show still exists: %s\n", g->name); |
3d6ab4f1fa55
[gaim-migrate @ 1101]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1089
diff
changeset
|
311 m = g->members; |
3d6ab4f1fa55
[gaim-migrate @ 1101]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1089
diff
changeset
|
312 while (m) { |
3d6ab4f1fa55
[gaim-migrate @ 1101]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1089
diff
changeset
|
313 b = (struct buddy_show *)m->data; |
3d6ab4f1fa55
[gaim-migrate @ 1101]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1089
diff
changeset
|
314 debug_printf("buddy_show still exists: %s\n", b->name); |
3d6ab4f1fa55
[gaim-migrate @ 1101]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1089
diff
changeset
|
315 m = g_slist_remove(m, b); |
3d6ab4f1fa55
[gaim-migrate @ 1101]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1089
diff
changeset
|
316 if (b->log_timer > 0) |
3d6ab4f1fa55
[gaim-migrate @ 1101]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1089
diff
changeset
|
317 gtk_timeout_remove(b->log_timer); |
1098
b335c0ce305e
[gaim-migrate @ 1108]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1097
diff
changeset
|
318 b->log_timer = 0; |
1108
cb338aa38e78
[gaim-migrate @ 1118]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1106
diff
changeset
|
319 gtk_tree_remove_item(GTK_TREE(g->tree), b->item); |
1091
3d6ab4f1fa55
[gaim-migrate @ 1101]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1089
diff
changeset
|
320 g_free(b->show); |
3d6ab4f1fa55
[gaim-migrate @ 1101]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1089
diff
changeset
|
321 g_free(b->name); |
3d6ab4f1fa55
[gaim-migrate @ 1101]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1089
diff
changeset
|
322 g_free(b); |
3d6ab4f1fa55
[gaim-migrate @ 1101]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1089
diff
changeset
|
323 } |
1108
cb338aa38e78
[gaim-migrate @ 1118]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1106
diff
changeset
|
324 gtk_tree_remove_item(GTK_TREE(buddies), g->item); |
1091
3d6ab4f1fa55
[gaim-migrate @ 1101]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1089
diff
changeset
|
325 s = g_slist_remove(s, g); |
3d6ab4f1fa55
[gaim-migrate @ 1101]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1089
diff
changeset
|
326 g_free(g->name); |
3d6ab4f1fa55
[gaim-migrate @ 1101]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1089
diff
changeset
|
327 g_free(g); |
3d6ab4f1fa55
[gaim-migrate @ 1101]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1089
diff
changeset
|
328 } |
3d6ab4f1fa55
[gaim-migrate @ 1101]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1089
diff
changeset
|
329 shows = NULL; |
3d6ab4f1fa55
[gaim-migrate @ 1101]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1089
diff
changeset
|
330 } |
3d6ab4f1fa55
[gaim-migrate @ 1101]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1089
diff
changeset
|
331 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1242
diff
changeset
|
332 debug_printf("date: %s\n", full_date()); |
1 | 333 destroy_all_dialogs(); |
334 destroy_buddy(); | |
335 #ifdef USE_APPLET | |
746
5a908dd5cfc4
[gaim-migrate @ 756]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
733
diff
changeset
|
336 set_user_state(offline); |
5a908dd5cfc4
[gaim-migrate @ 756]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
733
diff
changeset
|
337 applet_buddy_show = FALSE; |
1 | 338 applet_widget_unregister_callback(APPLET_WIDGET(applet),"signoff"); |
18 | 339 remove_applet_away(); |
1 | 340 #else |
341 show_login(); | |
342 #endif /* USE_APPLET */ | |
436 | 343 if ( ticker_prefs & OPT_DISP_SHOW_BUDDYTICKER ) |
344 BuddyTickerSignoff(); | |
1 | 345 } |
346 | |
347 void handle_click_group(GtkWidget *widget, GdkEventButton *event, gpointer func_data) | |
348 { | |
349 if (event->type == GDK_2BUTTON_PRESS) { | |
350 if (GTK_TREE_ITEM(widget)->expanded) | |
351 gtk_tree_item_collapse(GTK_TREE_ITEM(widget)); | |
352 else | |
353 gtk_tree_item_expand(GTK_TREE_ITEM(widget)); | |
354 } else { | |
355 } | |
356 } | |
357 | |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
358 void pressed_im(GtkWidget *widget, struct buddy_show *b) |
1 | 359 { |
360 struct conversation *c; | |
361 | |
362 c = find_conversation(b->name); | |
363 | |
364 if (c != NULL) { | |
87 | 365 gdk_window_show(c->window->window); |
1 | 366 } else { |
367 c = new_conversation(b->name); | |
1150
aa3dda7fc352
[gaim-migrate @ 1160]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1138
diff
changeset
|
368 |
aa3dda7fc352
[gaim-migrate @ 1160]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1138
diff
changeset
|
369 c->gc = b->connlist->data; |
1340 | 370 |
1150
aa3dda7fc352
[gaim-migrate @ 1160]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1138
diff
changeset
|
371 gtk_option_menu_set_history(GTK_OPTION_MENU(c->menu), |
aa3dda7fc352
[gaim-migrate @ 1160]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1138
diff
changeset
|
372 g_slist_index(connections, b->connlist->data)); |
1340 | 373 |
374 update_buttons_by_protocol(c); | |
1 | 375 } |
376 } | |
377 | |
1477
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1465
diff
changeset
|
378 void pressed_log (GtkWidget *widget, char *name) |
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1465
diff
changeset
|
379 { |
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1465
diff
changeset
|
380 show_log(name); |
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1465
diff
changeset
|
381 } |
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1465
diff
changeset
|
382 |
1634
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
383 void show_syslog() |
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
384 { |
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
385 show_log(NULL); |
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
386 } |
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
387 |
438 | 388 void pressed_ticker(char *buddy) |
389 { | |
390 struct conversation *c; | |
391 | |
392 c = find_conversation(buddy); | |
393 | |
394 if (c != NULL) { | |
395 gdk_window_show(c->window->window); | |
396 } else { | |
397 c = new_conversation(buddy); | |
398 } | |
399 } | |
400 | |
1397
d2799e0672ee
[gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1396
diff
changeset
|
401 void pressed_alias_bs(GtkWidget *widget, struct buddy_show *b) |
710
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
703
diff
changeset
|
402 { |
1397
d2799e0672ee
[gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1396
diff
changeset
|
403 alias_dialog_bs(b); |
d2799e0672ee
[gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1396
diff
changeset
|
404 } |
d2799e0672ee
[gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1396
diff
changeset
|
405 |
d2799e0672ee
[gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1396
diff
changeset
|
406 void pressed_alias_bud(GtkWidget *widget, struct buddy *b) |
d2799e0672ee
[gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1396
diff
changeset
|
407 { |
d2799e0672ee
[gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1396
diff
changeset
|
408 alias_dialog_bud(b); |
1 | 409 } |
410 | |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
411 void handle_click_buddy(GtkWidget *widget, GdkEventButton *event, struct buddy_show *b) |
1 | 412 { |
1102
d7944415b1cc
[gaim-migrate @ 1112]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1098
diff
changeset
|
413 if (!b->connlist) return; |
1 | 414 if (event->type == GDK_2BUTTON_PRESS && event->button == 1) { |
415 struct conversation *c; | |
416 | |
417 c = find_conversation(b->name); | |
418 | |
419 if (c != NULL) { | |
87 | 420 gdk_window_show(c->window->window); |
1 | 421 } else { |
422 c = new_conversation(b->name); | |
1150
aa3dda7fc352
[gaim-migrate @ 1160]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1138
diff
changeset
|
423 |
aa3dda7fc352
[gaim-migrate @ 1160]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1138
diff
changeset
|
424 c->gc = b->connlist->data; |
aa3dda7fc352
[gaim-migrate @ 1160]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1138
diff
changeset
|
425 gtk_option_menu_set_history(GTK_OPTION_MENU(c->menu), |
aa3dda7fc352
[gaim-migrate @ 1160]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1138
diff
changeset
|
426 g_slist_index(connections, b->connlist->data)); |
1340 | 427 |
428 update_buttons_by_protocol(c); | |
1 | 429 } |
1594
ac8eddd16e89
[gaim-migrate @ 1604]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1591
diff
changeset
|
430 if (display_options & OPT_DISP_ONE_WINDOW) |
ac8eddd16e89
[gaim-migrate @ 1604]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1591
diff
changeset
|
431 raise_convo_tab(c); |
1 | 432 } else if (event->type == GDK_BUTTON_PRESS && event->button == 3) { |
1032
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
433 GtkWidget *menu; |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
434 GtkWidget *button; |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
435 GtkWidget *menuitem; |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
436 GtkWidget *conmenu; |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
437 GSList *cn = b->connlist; |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
438 struct gaim_connection *g; |
1 | 439 /* We're gonna make us a menu right here */ |
440 | |
441 menu = gtk_menu_new(); | |
442 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
443 button = gtk_menu_item_new_with_label(_("IM")); |
1 | 444 gtk_signal_connect(GTK_OBJECT(button), "activate", |
445 GTK_SIGNAL_FUNC(pressed_im), b); | |
446 gtk_menu_append(GTK_MENU(menu), button); | |
447 gtk_widget_show(button); | |
448 | |
710
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
703
diff
changeset
|
449 button = gtk_menu_item_new_with_label(_("Alias")); |
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
703
diff
changeset
|
450 gtk_signal_connect(GTK_OBJECT(button), "activate", |
1397
d2799e0672ee
[gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1396
diff
changeset
|
451 GTK_SIGNAL_FUNC(pressed_alias_bs), b); |
710
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
703
diff
changeset
|
452 gtk_menu_append(GTK_MENU(menu), button); |
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
703
diff
changeset
|
453 gtk_widget_show(button); |
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
703
diff
changeset
|
454 |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
455 button = gtk_menu_item_new_with_label(_("Add Buddy Pounce")); |
1 | 456 gtk_signal_connect(GTK_OBJECT(button), "activate", |
457 GTK_SIGNAL_FUNC(new_bp_callback), b->name); | |
458 gtk_menu_append(GTK_MENU(menu), button); | |
459 gtk_widget_show(button); | |
460 | |
1477
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1465
diff
changeset
|
461 button = gtk_menu_item_new_with_label(_("View Log")); |
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1465
diff
changeset
|
462 gtk_signal_connect(GTK_OBJECT(button), "activate", |
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1465
diff
changeset
|
463 GTK_SIGNAL_FUNC(pressed_log), b->name); |
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1465
diff
changeset
|
464 gtk_menu_append(GTK_MENU(menu), button); |
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1465
diff
changeset
|
465 gtk_widget_show(button); |
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1465
diff
changeset
|
466 |
1032
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
467 if (g_slist_length(cn) > 1) { |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
468 while (cn) { |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
469 g = (struct gaim_connection *)cn->data; |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1496
diff
changeset
|
470 if (g->prpl->buddy_menu) { |
1032
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
471 menuitem = gtk_menu_item_new_with_label(g->username); |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
472 gtk_menu_append(GTK_MENU(menu), menuitem); |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
473 gtk_widget_show(menuitem); |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
474 |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
475 conmenu = gtk_menu_new(); |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
476 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), conmenu); |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
477 gtk_widget_show(conmenu); |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
478 |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1496
diff
changeset
|
479 (*g->prpl->buddy_menu)(conmenu, g, b->name); |
1032
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
480 } |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
481 cn = g_slist_next(cn); |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
482 } |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
483 } else { |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
484 g = (struct gaim_connection *)cn->data; |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1496
diff
changeset
|
485 if (g->prpl->buddy_menu) |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1496
diff
changeset
|
486 (*g->prpl->buddy_menu)(menu, g, b->name); |
1032
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
487 } |
1 | 488 |
489 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, | |
490 event->button, event->time); | |
491 | |
492 } else if (event->type == GDK_3BUTTON_PRESS && event->button == 2) { | |
493 if (!strcasecmp("zilding", normalize(b->name))) | |
494 show_ee_dialog(0); | |
495 else if (!strcasecmp("robflynn", normalize(b->name))) | |
496 show_ee_dialog(1); | |
497 else if (!strcasecmp("flynorange", normalize(b->name))) | |
498 show_ee_dialog(2); | |
338
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
318
diff
changeset
|
499 else if (!strcasecmp("ewarmenhoven", normalize(b->name))) |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
318
diff
changeset
|
500 show_ee_dialog(3); |
1 | 501 |
502 } else { | |
503 | |
504 /* Anything for other buttons? :) */ | |
505 } | |
506 } | |
507 | |
1396
df7c3cacac92
[gaim-migrate @ 1406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1392
diff
changeset
|
508 static void un_alias(GtkWidget *a, struct buddy *b) |
df7c3cacac92
[gaim-migrate @ 1406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1392
diff
changeset
|
509 { |
df7c3cacac92
[gaim-migrate @ 1406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1392
diff
changeset
|
510 struct group *g = find_group_by_buddy(b->gc, b->name); |
df7c3cacac92
[gaim-migrate @ 1406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1392
diff
changeset
|
511 struct group_show *gs = find_group_show(g->name); |
1397
d2799e0672ee
[gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1396
diff
changeset
|
512 struct buddy_show *bs = NULL; |
1396
df7c3cacac92
[gaim-migrate @ 1406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1392
diff
changeset
|
513 GtkCTreeNode *node = gtk_ctree_find_by_row_data(GTK_CTREE(edittree), NULL, b); |
df7c3cacac92
[gaim-migrate @ 1406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1392
diff
changeset
|
514 g_snprintf(b->show, sizeof(b->show), "%s", b->name); |
df7c3cacac92
[gaim-migrate @ 1406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1392
diff
changeset
|
515 gtk_ctree_node_set_text(GTK_CTREE(edittree), node, 0, b->name); |
df7c3cacac92
[gaim-migrate @ 1406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1392
diff
changeset
|
516 if (gs) bs = find_buddy_show(gs, b->name); |
df7c3cacac92
[gaim-migrate @ 1406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1392
diff
changeset
|
517 if (bs) gtk_label_set(GTK_LABEL(bs->label), b->name); |
df7c3cacac92
[gaim-migrate @ 1406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1392
diff
changeset
|
518 do_export(0, 0); |
df7c3cacac92
[gaim-migrate @ 1406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1392
diff
changeset
|
519 } |
1 | 520 |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
521 static gboolean click_edit_tree(GtkWidget *widget, GdkEventButton *event, gpointer data) |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
522 { |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
523 GtkCTreeNode *node; |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
524 int *type; |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
525 int row, column; |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
526 GtkWidget *menu; |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
527 GtkWidget *button; |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
528 |
1392
dc6ba774bfc5
[gaim-migrate @ 1402]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1391
diff
changeset
|
529 if (event->button != 3 || event->type != GDK_BUTTON_PRESS) |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
530 return TRUE; |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
531 |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
532 if (!gtk_clist_get_selection_info(GTK_CLIST(edittree), event->x, event->y, &row, &column)) |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
533 return TRUE; |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
534 |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
535 node = gtk_ctree_node_nth(GTK_CTREE(edittree), row); |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
536 type = gtk_ctree_node_get_row_data(GTK_CTREE(edittree), node); |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
537 if (*type == EDIT_GROUP) { |
1509
defa15eb9147
[gaim-migrate @ 1519]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
538 /*struct group *group = (struct group *)type; |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
539 menu = gtk_menu_new(); |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
540 |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
541 button = gtk_menu_item_new_with_label(_("Rename")); |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
542 gtk_signal_connect(GTK_OBJECT(button), "activate", |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
543 GTK_SIGNAL_FUNC(rename_group), node); |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
544 gtk_menu_append(GTK_MENU(menu), button); |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
545 gtk_widget_show(button); |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
546 |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
547 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
548 event->button, event->time); |
1509
defa15eb9147
[gaim-migrate @ 1519]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
549 */ |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
550 } else if (*type == EDIT_BUDDY) { |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
551 struct buddy *b = (struct buddy *)type; |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
552 menu = gtk_menu_new(); |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
553 |
1392
dc6ba774bfc5
[gaim-migrate @ 1402]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1391
diff
changeset
|
554 button = gtk_menu_item_new_with_label(_("Alias")); |
dc6ba774bfc5
[gaim-migrate @ 1402]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1391
diff
changeset
|
555 gtk_signal_connect(GTK_OBJECT(button), "activate", |
1397
d2799e0672ee
[gaim-migrate @ 1407]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1396
diff
changeset
|
556 GTK_SIGNAL_FUNC(pressed_alias_bud), b); |
1392
dc6ba774bfc5
[gaim-migrate @ 1402]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1391
diff
changeset
|
557 gtk_menu_append(GTK_MENU(menu), button); |
dc6ba774bfc5
[gaim-migrate @ 1402]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1391
diff
changeset
|
558 gtk_widget_show(button); |
dc6ba774bfc5
[gaim-migrate @ 1402]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1391
diff
changeset
|
559 |
1396
df7c3cacac92
[gaim-migrate @ 1406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1392
diff
changeset
|
560 if (strcmp(b->name, b->show)) { |
df7c3cacac92
[gaim-migrate @ 1406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1392
diff
changeset
|
561 button = gtk_menu_item_new_with_label(_("Un-Alias")); |
df7c3cacac92
[gaim-migrate @ 1406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1392
diff
changeset
|
562 gtk_signal_connect(GTK_OBJECT(button), "activate", |
df7c3cacac92
[gaim-migrate @ 1406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1392
diff
changeset
|
563 GTK_SIGNAL_FUNC(un_alias), b); |
df7c3cacac92
[gaim-migrate @ 1406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1392
diff
changeset
|
564 gtk_menu_append(GTK_MENU(menu), button); |
df7c3cacac92
[gaim-migrate @ 1406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1392
diff
changeset
|
565 gtk_widget_show(button); |
df7c3cacac92
[gaim-migrate @ 1406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1392
diff
changeset
|
566 } |
df7c3cacac92
[gaim-migrate @ 1406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1392
diff
changeset
|
567 |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
568 button = gtk_menu_item_new_with_label(_("Add Buddy Pounce")); |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
569 gtk_signal_connect(GTK_OBJECT(button), "activate", |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
570 GTK_SIGNAL_FUNC(new_bp_callback), b->name); |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
571 gtk_menu_append(GTK_MENU(menu), button); |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
572 gtk_widget_show(button); |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
573 |
1477
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1465
diff
changeset
|
574 button = gtk_menu_item_new_with_label(_("View Log")); |
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1465
diff
changeset
|
575 gtk_signal_connect(GTK_OBJECT(button), "activate", |
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1465
diff
changeset
|
576 GTK_SIGNAL_FUNC(pressed_log), b->name); |
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1465
diff
changeset
|
577 gtk_menu_append(GTK_MENU(menu), button); |
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1465
diff
changeset
|
578 gtk_widget_show(button); |
1d0fc2622b29
[gaim-migrate @ 1487]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1465
diff
changeset
|
579 |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
580 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
581 event->button, event->time); |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
582 } |
1456
6650776468b3
[gaim-migrate @ 1466]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
583 |
6650776468b3
[gaim-migrate @ 1466]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
584 return TRUE; |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
585 } |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
586 |
1 | 587 |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
588 void remove_buddy(struct gaim_connection *gc, struct group *rem_g, struct buddy *rem_b) |
1 | 589 { |
940 | 590 GSList *grp; |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
591 GSList *mem; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
592 struct conversation *c; |
1069
5d4926907b21
[gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1068
diff
changeset
|
593 struct group_show *gs; |
5d4926907b21
[gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1068
diff
changeset
|
594 struct buddy_show *bs; |
1 | 595 |
596 struct group *delg; | |
597 struct buddy *delb; | |
598 | |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
599 /* we assume that gc is not NULL and that the buddy exists somewhere within the |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
600 * gc's buddy list, therefore we can safely remove it. we need to ensure this |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
601 * via the UI |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
602 */ |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
603 |
1364
ce379d65a5e3
[gaim-migrate @ 1374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1352
diff
changeset
|
604 grp = g_slist_find(gc->groups, rem_g); |
ce379d65a5e3
[gaim-migrate @ 1374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1352
diff
changeset
|
605 delg = (struct group *)grp->data; |
ce379d65a5e3
[gaim-migrate @ 1374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1352
diff
changeset
|
606 mem = delg->members; |
ce379d65a5e3
[gaim-migrate @ 1374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1352
diff
changeset
|
607 |
ce379d65a5e3
[gaim-migrate @ 1374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1352
diff
changeset
|
608 mem = g_slist_find(mem, rem_b); |
ce379d65a5e3
[gaim-migrate @ 1374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1352
diff
changeset
|
609 delb = (struct buddy *)mem->data; |
ce379d65a5e3
[gaim-migrate @ 1374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1352
diff
changeset
|
610 |
ce379d65a5e3
[gaim-migrate @ 1374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1352
diff
changeset
|
611 delg->members = g_slist_remove(delg->members, delb); |
ce379d65a5e3
[gaim-migrate @ 1374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1352
diff
changeset
|
612 serv_remove_buddy(gc, delb->name); |
ce379d65a5e3
[gaim-migrate @ 1374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1352
diff
changeset
|
613 |
1069
5d4926907b21
[gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1068
diff
changeset
|
614 gs = find_group_show(rem_g->name); |
5d4926907b21
[gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1068
diff
changeset
|
615 if (gs) { |
5d4926907b21
[gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1068
diff
changeset
|
616 bs = find_buddy_show(gs, rem_b->name); |
5d4926907b21
[gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1068
diff
changeset
|
617 if (bs) { |
5d4926907b21
[gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1068
diff
changeset
|
618 if (g_slist_find(bs->connlist, gc)) { |
5d4926907b21
[gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1068
diff
changeset
|
619 bs->connlist = g_slist_remove(bs->connlist, gc); |
5d4926907b21
[gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1068
diff
changeset
|
620 if (!g_slist_length(bs->connlist)) { |
5d4926907b21
[gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1068
diff
changeset
|
621 gs->members = g_slist_remove(gs->members, bs); |
5d4926907b21
[gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1068
diff
changeset
|
622 if (bs->log_timer > 0) |
5d4926907b21
[gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1068
diff
changeset
|
623 gtk_timeout_remove(bs->log_timer); |
1098
b335c0ce305e
[gaim-migrate @ 1108]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1097
diff
changeset
|
624 bs->log_timer = 0; |
1108
cb338aa38e78
[gaim-migrate @ 1118]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1106
diff
changeset
|
625 remove_buddy_show(gs, bs); |
1069
5d4926907b21
[gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1068
diff
changeset
|
626 g_free(bs->show); |
5d4926907b21
[gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1068
diff
changeset
|
627 g_free(bs->name); |
5d4926907b21
[gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1068
diff
changeset
|
628 g_free(bs); |
1083
12478dd1e9d7
[gaim-migrate @ 1093]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1081
diff
changeset
|
629 if (!g_slist_length(gs->members) && |
12478dd1e9d7
[gaim-migrate @ 1093]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1081
diff
changeset
|
630 (display_options & OPT_DISP_NO_MT_GRP)) { |
1069
5d4926907b21
[gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1068
diff
changeset
|
631 shows = g_slist_remove(shows, gs); |
1108
cb338aa38e78
[gaim-migrate @ 1118]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1106
diff
changeset
|
632 gtk_tree_remove_item(GTK_TREE(buddies), gs->item); |
1069
5d4926907b21
[gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1068
diff
changeset
|
633 g_free(gs->name); |
5d4926907b21
[gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1068
diff
changeset
|
634 g_free(gs); |
1083
12478dd1e9d7
[gaim-migrate @ 1093]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1081
diff
changeset
|
635 } else |
12478dd1e9d7
[gaim-migrate @ 1093]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1081
diff
changeset
|
636 update_num_group(gs); |
12478dd1e9d7
[gaim-migrate @ 1093]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1081
diff
changeset
|
637 } else |
12478dd1e9d7
[gaim-migrate @ 1093]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1081
diff
changeset
|
638 update_num_group(gs); |
1364
ce379d65a5e3
[gaim-migrate @ 1374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1352
diff
changeset
|
639 } else |
ce379d65a5e3
[gaim-migrate @ 1374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1352
diff
changeset
|
640 update_num_group(gs); |
ce379d65a5e3
[gaim-migrate @ 1374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1352
diff
changeset
|
641 } else |
ce379d65a5e3
[gaim-migrate @ 1374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1352
diff
changeset
|
642 update_num_group(gs); |
1069
5d4926907b21
[gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1068
diff
changeset
|
643 } |
5d4926907b21
[gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1068
diff
changeset
|
644 |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
645 c = find_conversation(delb->name); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
646 if (c) |
1352 | 647 update_buttons_by_protocol(c); |
1364
ce379d65a5e3
[gaim-migrate @ 1374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1352
diff
changeset
|
648 g_free(delb); |
228 | 649 |
650 // flush buddy list to cache | |
651 | |
652 do_export( (GtkWidget *) NULL, 0 ); | |
1 | 653 } |
654 | |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
655 void remove_group(struct gaim_connection *gc, struct group *rem_g) |
1 | 656 { |
940 | 657 GSList *grp; |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
658 GSList *mem; |
1297
aa6a0fe8e03f
[gaim-migrate @ 1307]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1261
diff
changeset
|
659 struct group_show *gs; |
1 | 660 |
661 struct group *delg; | |
662 struct buddy *delb; | |
663 | |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
664 /* we assume that the group actually does exist within the gc, and that the gc is not NULL. |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
665 * the UI is responsible for this */ |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
666 |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
667 grp = g_slist_find(gc->groups, rem_g); |
1 | 668 delg = (struct group *)grp->data; |
669 mem = delg->members; | |
670 | |
671 while(delg->members) { | |
672 delb = (struct buddy *)delg->members->data; | |
1083
12478dd1e9d7
[gaim-migrate @ 1093]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1081
diff
changeset
|
673 remove_buddy(gc, delg, delb); /* this should take care of removing |
12478dd1e9d7
[gaim-migrate @ 1093]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1081
diff
changeset
|
674 the group_show if necessary */ |
1 | 675 } |
676 | |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
677 gc->groups = g_slist_remove(gc->groups, delg); |
1297
aa6a0fe8e03f
[gaim-migrate @ 1307]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1261
diff
changeset
|
678 |
aa6a0fe8e03f
[gaim-migrate @ 1307]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1261
diff
changeset
|
679 if ((gs = find_group_show(delg->name)) != NULL) { |
1465
163b9ee8d789
[gaim-migrate @ 1475]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
680 shows = g_slist_remove(shows, gs); |
1297
aa6a0fe8e03f
[gaim-migrate @ 1307]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1261
diff
changeset
|
681 gtk_tree_remove_item(GTK_TREE(buddies), gs->item); |
aa6a0fe8e03f
[gaim-migrate @ 1307]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1261
diff
changeset
|
682 g_free(gs->name); |
aa6a0fe8e03f
[gaim-migrate @ 1307]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1261
diff
changeset
|
683 g_free(gs); |
aa6a0fe8e03f
[gaim-migrate @ 1307]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1261
diff
changeset
|
684 } |
1 | 685 g_free(delg); |
686 | |
228 | 687 // flush buddy list to cache |
688 | |
689 do_export( (GtkWidget *) NULL, 0 ); | |
1 | 690 } |
691 | |
692 | |
693 | |
694 | |
695 | |
696 gboolean edit_drag_compare_func (GtkCTree *ctree, GtkCTreeNode *source_node, | |
697 GtkCTreeNode *new_parent, GtkCTreeNode *new_sibling) | |
698 { | |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
699 int *type; |
1 | 700 |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
701 type = (int *)gtk_ctree_node_get_row_data(GTK_CTREE(ctree), source_node); |
1 | 702 |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
703 if (*type == EDIT_GC) { |
1 | 704 if (!new_parent) |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
705 return TRUE; |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
706 } else if (*type == EDIT_BUDDY) { |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
707 if (new_parent) { |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
708 type = (int *)gtk_ctree_node_get_row_data(GTK_CTREE(ctree), new_parent); |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
709 if (*type == EDIT_GROUP) |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
710 return TRUE; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
711 } |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
712 } else /* group */ { |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
713 if (g_slist_length(connections) > 1 && new_parent) { |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
714 type = (int *)gtk_ctree_node_get_row_data(GTK_CTREE(ctree), new_parent); |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
715 if (*type == EDIT_GC) |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
716 return TRUE; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
717 } else if (g_slist_length(connections) == 1 && !new_parent) |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
718 return TRUE; |
1 | 719 } |
720 | |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
721 return FALSE; |
1 | 722 } |
723 | |
724 | |
1069
5d4926907b21
[gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1068
diff
changeset
|
725 static void redo_buddy_list() { |
5d4926907b21
[gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1068
diff
changeset
|
726 /* so here we can safely assume that we don't have to add or delete anything, we |
5d4926907b21
[gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1068
diff
changeset
|
727 * just have to go through and reorder everything. remember, nothing is going to |
5d4926907b21
[gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1068
diff
changeset
|
728 * change connections, so we can assume that we don't have to change any user |
5d4926907b21
[gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1068
diff
changeset
|
729 * data or anything. this is just a simple reordering. so calm down. */ |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
730 /* note: we only have to do this if we want to strongly enforce order; however, |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
731 * order doesn't particularly matter to the stability of the program. but, it's |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
732 * kind of nice to have */ |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
733 /* the easy way to implement this is just to go through shows and destroy all the |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
734 * group_shows, then go through the connections and put everything back. though, |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
735 * there are slight complications with that; most of them deal with timeouts and |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
736 * people not seeing the login icon for the full 10 seconds. butt fuck them. */ |
1069
5d4926907b21
[gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1068
diff
changeset
|
737 GSList *s = shows; |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
738 struct group_show *gs; |
1069
5d4926907b21
[gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1068
diff
changeset
|
739 GSList *m; |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
740 struct buddy_show *bs; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
741 GSList *c = connections; |
1069
5d4926907b21
[gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1068
diff
changeset
|
742 struct gaim_connection *gc; |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
743 GSList *gr; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
744 struct group *g; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
745 struct buddy *b; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
746 |
1150
aa3dda7fc352
[gaim-migrate @ 1160]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1138
diff
changeset
|
747 if (!blist) return; |
aa3dda7fc352
[gaim-migrate @ 1160]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1138
diff
changeset
|
748 |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
749 while (s) { |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
750 gs = (struct group_show *)s->data; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
751 s = g_slist_remove(s, gs); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
752 m = gs->members; |
1108
cb338aa38e78
[gaim-migrate @ 1118]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1106
diff
changeset
|
753 gtk_tree_remove_item(GTK_TREE(buddies), gs->item); |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
754 while (m) { |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
755 bs = (struct buddy_show *)m->data; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
756 m = g_slist_remove(m, bs); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
757 if (bs->log_timer > 0) |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
758 gtk_timeout_remove(bs->log_timer); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
759 g_free(bs->show); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
760 g_free(bs->name); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
761 g_free(bs); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
762 } |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
763 g_free(gs->name); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
764 g_free(gs); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
765 } |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
766 shows = NULL; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
767 while (c) { |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
768 gc = (struct gaim_connection *)c->data; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
769 c = c->next; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
770 gr = gc->groups; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
771 while (gr) { |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
772 g = (struct group *)gr->data; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
773 gr = gr->next; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
774 gs = find_group_show(g->name); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
775 if (!gs && !(display_options & OPT_DISP_NO_MT_GRP)) |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
776 gs = new_group_show(g->name); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
777 m = g->members; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
778 while (m) { |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
779 b = (struct buddy *)m->data; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
780 m = m->next; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
781 if (b->present) { |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
782 if (!gs) |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
783 gs = new_group_show(g->name); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
784 bs = find_buddy_show(gs, b->name); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
785 if (!bs) { |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
786 if (gc->prpl->list_icon) |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
787 bs = new_buddy_show(gs, b, |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
788 (*gc->prpl->list_icon)(b->uc)); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
789 else |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
790 bs = new_buddy_show(gs, b, (char **)no_icon_xpm); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
791 } |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
792 bs->connlist = g_slist_append(bs->connlist, gc); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
793 } |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
794 } |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
795 } |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
796 } |
1069
5d4926907b21
[gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1068
diff
changeset
|
797 } |
1 | 798 |
799 static void edit_tree_move (GtkCTree *ctree, GtkCTreeNode *child, GtkCTreeNode *parent, | |
800 GtkCTreeNode *sibling, gpointer data) | |
801 { | |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
802 struct gaim_connection *gc, *pc = NULL, *sc = NULL; |
1456
6650776468b3
[gaim-migrate @ 1466]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
803 int *ctype, *ptype = NULL, *stype = NULL; |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
804 |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
805 ctype = (int *)gtk_ctree_node_get_row_data(GTK_CTREE(ctree), child); |
1 | 806 |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
807 if (parent) |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
808 ptype = (int *)gtk_ctree_node_get_row_data(GTK_CTREE(ctree), parent); |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
809 |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
810 if (sibling) |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
811 stype = (int *)gtk_ctree_node_get_row_data(GTK_CTREE(ctree), sibling); |
1 | 812 |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
813 if (*ctype == EDIT_GC) { |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
814 /* not that it particularly matters which order the connections |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
815 * are in, but just for debugging sake, i guess.... */ |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
816 gc = (struct gaim_connection *)ctype; |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
817 connections = g_slist_remove(connections, gc); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
818 if (sibling) { |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
819 int pos; |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
820 sc = (struct gaim_connection *)stype; |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
821 pos = g_slist_index(connections, sc); |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
822 if (pos) |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
823 connections = g_slist_insert(connections, gc, pos); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
824 else |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
825 connections = g_slist_prepend(connections, gc); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
826 } else |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
827 connections = g_slist_append(connections, gc); |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
828 } else if (*ctype == EDIT_BUDDY) { |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
829 /* we moved a buddy. hopefully we just changed groups or positions or something. |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
830 * if we changed connections, we copy the buddy to the new connection. if the new |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
831 * connection already had the buddy in its buddy list but in a different group, |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
832 * we change the group that the buddy is in */ |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
833 struct group *old_g, *new_g = (struct group *)ptype; |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
834 struct buddy *s = NULL, *buddy = (struct buddy *)ctype; |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
835 int pos; |
1 | 836 |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
837 if (buddy->gc != new_g->gc) { |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
838 /* we changed connections */ |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
839 struct buddy *a; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
840 |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
841 a = find_buddy(new_g->gc, buddy->name); |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
842 |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
843 if (a) { |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
844 /* the buddy is in the new connection, so we'll remove it from |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
845 * its current group and add it to the proper group below */ |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
846 struct group *og; |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
847 og = find_group_by_buddy(new_g->gc, buddy->name); |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
848 og->members = g_slist_remove(og->members, a); |
1 | 849 } else { |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
850 /* we don't have this buddy yet; let's add him */ |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
851 serv_add_buddy(new_g->gc, buddy->name); |
1 | 852 } |
853 } | |
854 | |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
855 old_g = find_group_by_buddy(buddy->gc, buddy->name); |
1 | 856 |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
857 if (buddy->gc == new_g->gc) |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
858 /* this is the same connection, so we'll remove it from its old group */ |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
859 old_g->members = g_slist_remove(old_g->members, buddy); |
1 | 860 |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
861 if (sibling) { |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
862 s = (struct buddy *)stype; |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
863 pos = g_slist_index(new_g->members, s); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
864 if (pos) |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
865 new_g->members = g_slist_insert(new_g->members, buddy, pos); |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
866 else |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
867 new_g->members = g_slist_prepend(new_g->members, buddy); |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
868 } else |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
869 new_g->members = g_slist_append(new_g->members, buddy); |
1 | 870 |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
871 if (buddy->gc != new_g->gc) |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
872 build_edit_tree(); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
873 } else /* group */ { |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
874 /* move the group. if moving connections, copy the group, and each buddy in the |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
875 * group. if the buddy exists in the new connection, leave it where it is. */ |
1 | 876 |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
877 struct group *g, *g2, *group; |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
878 int pos; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
879 |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
880 pc = (struct gaim_connection *)ptype; |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
881 group = (struct group *)ctype; |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
882 |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
883 if (g_slist_length(connections) > 1) { |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
884 g = find_group(pc, group->name); |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
885 if (!g) |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
886 g = add_group(pc, group->name); |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
887 |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
888 pc->groups = g_slist_remove(pc->groups, g); |
1 | 889 |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
890 if (sibling) { |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
891 g2 = (struct group *)stype; |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
892 pos = g_slist_index(pc->groups, g2); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
893 if (pos) |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
894 pc->groups = g_slist_insert(pc->groups, g, pos); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
895 else |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
896 pc->groups = g_slist_prepend(pc->groups, g); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
897 } else |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
898 pc->groups = g_slist_append(pc->groups, g); |
1 | 899 |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
900 if (pc != group->gc) { |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
901 GSList *mem; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
902 struct buddy *b; |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
903 g2 = group; |
1 | 904 |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
905 mem = g2->members; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
906 while (mem) { |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
907 b = (struct buddy *)mem->data; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
908 if (!find_buddy(pc, b->name)) |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
909 add_buddy(pc, g->name, b->name, b->show); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
910 mem = mem->next; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
911 } |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
912 |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
913 build_edit_tree(); |
912
5a517b4f0be4
[gaim-migrate @ 922]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
905
diff
changeset
|
914 } |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
915 } else { |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
916 g = group; |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
917 gc = g->gc; |
1 | 918 |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
919 gc->groups = g_slist_remove(gc->groups, g); |
1 | 920 |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
921 if (sibling) { |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
922 g2 = (struct group *)stype; |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
923 pos = g_slist_index(gc->groups, g2); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
924 if (pos) |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
925 gc->groups = g_slist_insert(gc->groups, g, pos); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
926 else |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
927 gc->groups = g_slist_prepend(gc->groups, g); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
928 } else |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
929 gc->groups = g_slist_append(gc->groups, g); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
930 } |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
931 } |
1 | 932 |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
933 do_export( (GtkWidget *) NULL, 0 ); |
1069
5d4926907b21
[gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1068
diff
changeset
|
934 |
5d4926907b21
[gaim-migrate @ 1079]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1068
diff
changeset
|
935 redo_buddy_list(); |
1070
b288f17c2fb2
[gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1069
diff
changeset
|
936 update_num_groups(); |
1 | 937 } |
938 | |
939 | |
940 | |
941 void build_edit_tree() | |
942 { | |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
943 GtkCTreeNode *c = NULL, *p = NULL, *n; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
944 GSList *con = connections; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
945 GSList *grp; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
946 GSList *mem; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
947 struct gaim_connection *z; |
1 | 948 struct group *g; |
949 struct buddy *b; | |
950 char *text[1]; | |
951 | |
1032
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
952 if (!blist) return; |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
953 |
1 | 954 gtk_clist_freeze(GTK_CLIST(edittree)); |
955 gtk_clist_clear(GTK_CLIST(edittree)); | |
956 | |
957 | |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
958 while (con) { |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
959 z = (struct gaim_connection *)con->data; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
960 |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
961 if (g_slist_length(connections) > 1) { |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
962 text[0] = z->username; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
963 |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
964 c = gtk_ctree_insert_node(GTK_CTREE(edittree), NULL, |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
965 NULL, text, 5, NULL, NULL, |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
966 NULL, NULL, 0, 1); |
1 | 967 |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
968 gtk_ctree_node_set_row_data(GTK_CTREE(edittree), c, z); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
969 } else |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
970 c = NULL; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
971 |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
972 grp = z->groups; |
1 | 973 |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
974 while(grp) { |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
975 g = (struct group *)grp->data; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
976 |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
977 text[0] = g->name; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
978 |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
979 p = gtk_ctree_insert_node(GTK_CTREE(edittree), c, |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
980 NULL, text, 5, NULL, NULL, |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
981 NULL, NULL, 0, 1); |
1 | 982 |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
983 gtk_ctree_node_set_row_data(GTK_CTREE(edittree), p, g); |
1 | 984 |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
985 n = NULL; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
986 |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
987 mem = g->members; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
988 |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
989 while(mem) { |
1396
df7c3cacac92
[gaim-migrate @ 1406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1392
diff
changeset
|
990 char buf[256]; |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
991 b = (struct buddy *)mem->data; |
1396
df7c3cacac92
[gaim-migrate @ 1406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1392
diff
changeset
|
992 if (strcmp(b->name, b->show)) { |
df7c3cacac92
[gaim-migrate @ 1406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1392
diff
changeset
|
993 g_snprintf(buf, sizeof(buf), "%s (%s)", b->name, b->show); |
df7c3cacac92
[gaim-migrate @ 1406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1392
diff
changeset
|
994 text[0] = buf; |
df7c3cacac92
[gaim-migrate @ 1406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1392
diff
changeset
|
995 } else |
df7c3cacac92
[gaim-migrate @ 1406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1392
diff
changeset
|
996 text[0] = b->name; |
1 | 997 |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
998 n = gtk_ctree_insert_node(GTK_CTREE(edittree), |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
999 p, NULL, text, 5, |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1000 NULL, NULL, |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1001 NULL, NULL, 1, 1); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1002 |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
1003 gtk_ctree_node_set_row_data(GTK_CTREE(edittree), n, b); |
1 | 1004 |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1005 mem = mem->next; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1006 |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1007 } |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1008 grp = g_slist_next(grp); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1009 } |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1010 con = g_slist_next(con); |
1 | 1011 } |
1012 | |
1013 gtk_clist_thaw(GTK_CLIST(edittree)); | |
1014 | |
1015 } | |
1016 | |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1017 struct buddy *add_buddy(struct gaim_connection *gc, char *group, char *buddy, char *show) |
1 | 1018 { |
1019 struct buddy *b; | |
1020 struct group *g; | |
1088
18a14e6dd0af
[gaim-migrate @ 1098]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1085
diff
changeset
|
1021 struct group_show *gs = find_group_show(group); |
1 | 1022 |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1023 if ((b = find_buddy(gc, buddy)) != NULL) |
1 | 1024 return b; |
1025 | |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1026 g = find_group(gc, group); |
1 | 1027 |
1028 if (g == NULL) | |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1029 g = add_group(gc, group); |
1 | 1030 |
1031 b = (struct buddy *)g_new0(struct buddy, 1); | |
1032 | |
1033 if (!b) | |
1034 return NULL; | |
1035 | |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
1036 b->edittype = EDIT_BUDDY; |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
1037 b->gc = gc; |
1 | 1038 b->present = 0; |
1039 | |
1040 g_snprintf(b->name, sizeof(b->name), "%s", buddy); | |
710
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
703
diff
changeset
|
1041 g_snprintf(b->show, sizeof(b->show), "%s", show ? (show[0] ? show : buddy) : buddy); |
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
703
diff
changeset
|
1042 |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1043 g->members = g_slist_append(g->members, b); |
1 | 1044 |
1045 b->idle = 0; | |
515
b33ed0a7f49b
[gaim-migrate @ 525]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
514
diff
changeset
|
1046 b->caps = 0; |
1088
18a14e6dd0af
[gaim-migrate @ 1098]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1085
diff
changeset
|
1047 |
18a14e6dd0af
[gaim-migrate @ 1098]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1085
diff
changeset
|
1048 if (gs) update_num_group(gs); |
1 | 1049 |
1050 return b; | |
1051 } | |
1052 | |
921
d2e865d64dd8
[gaim-migrate @ 931]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
920
diff
changeset
|
1053 |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1054 struct group *add_group(struct gaim_connection *gc, char *group) |
1 | 1055 { |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1056 struct group *g = find_group(gc, group); |
318
35796808896a
[gaim-migrate @ 328]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
281
diff
changeset
|
1057 if (g) |
35796808896a
[gaim-migrate @ 328]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
281
diff
changeset
|
1058 return g; |
1 | 1059 g = (struct group *)g_new0(struct group, 1); |
1060 if (!g) | |
1061 return NULL; | |
1062 | |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
1063 g->edittype = EDIT_GROUP; |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
1064 g->gc = gc; |
1 | 1065 strncpy(g->name, group, sizeof(g->name)); |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1066 gc->groups = g_slist_append(gc->groups, g); |
1 | 1067 |
1068 g->members = NULL; | |
1069 | |
1092
a930439f29b1
[gaim-migrate @ 1102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1091
diff
changeset
|
1070 if (!blist) return g; |
1088
18a14e6dd0af
[gaim-migrate @ 1098]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1085
diff
changeset
|
1071 |
1 | 1072 build_edit_tree(); |
1073 | |
1072
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
1074 if (!(display_options & OPT_DISP_NO_MT_GRP) && !find_group_show(group)) |
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
1075 new_group_show(group); |
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
1076 |
1 | 1077 return g; |
1078 } | |
1079 | |
1080 | |
1081 static void do_del_buddy(GtkWidget *w, GtkCTree *ctree) | |
1082 { | |
1083 GtkCTreeNode *node; | |
1084 struct buddy *b; | |
1085 struct group *g; | |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
1086 int *type; |
1 | 1087 GList *i; |
1088 | |
1089 i = GTK_CLIST(edittree)->selection; | |
1090 if (i) { | |
1091 node = i->data; | |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
1092 type = (int *)gtk_ctree_node_get_row_data(GTK_CTREE(edittree), node); |
1 | 1093 |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
1094 if (*type == EDIT_BUDDY) { |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
1095 b = (struct buddy *)type; |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
1096 g = find_group_by_buddy(b->gc, b->name); |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
1097 remove_buddy(b->gc, g, b); |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
1098 } else if (*type == EDIT_GROUP) { |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
1099 remove_group(((struct group *)type)->gc, (struct group *)type); |
1 | 1100 } |
1101 | |
1102 build_edit_tree(); | |
228 | 1103 |
1104 // flush buddy list to cache | |
1105 | |
1106 do_export( (GtkWidget *) NULL, 0 ); | |
1107 | |
1 | 1108 } else { |
1109 /* Nothing selected. */ | |
1110 } | |
1111 } | |
1112 | |
1113 | |
1114 void import_callback(GtkWidget *widget, void *null) | |
1115 { | |
1116 show_import_dialog(); | |
1117 } | |
1118 | |
1119 void export_callback(GtkWidget *widget, void *null) | |
1120 { | |
1121 show_export_dialog(); | |
1122 } | |
1123 | |
1124 | |
1125 | |
1126 void do_quit() | |
1127 { | |
391
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
1128 #ifdef GAIM_PLUGINS |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
1129 GList *c; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
1130 struct gaim_plugin *p; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
1131 void (*gaim_plugin_remove)(); |
1591
5c74d8b6cb57
[gaim-migrate @ 1601]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1590
diff
changeset
|
1132 #endif |
5c74d8b6cb57
[gaim-migrate @ 1601]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1590
diff
changeset
|
1133 |
5c74d8b6cb57
[gaim-migrate @ 1601]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1590
diff
changeset
|
1134 #ifdef USE_APPLET |
5c74d8b6cb57
[gaim-migrate @ 1601]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1590
diff
changeset
|
1135 applet = NULL; |
5c74d8b6cb57
[gaim-migrate @ 1601]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1590
diff
changeset
|
1136 #endif |
5c74d8b6cb57
[gaim-migrate @ 1601]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1590
diff
changeset
|
1137 |
5c74d8b6cb57
[gaim-migrate @ 1601]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1590
diff
changeset
|
1138 #ifdef GAIM_PLUGINS |
391
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
1139 /* first we tell those who have requested it we're quitting */ |
1000
91b7377e7b45
[gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
991
diff
changeset
|
1140 plugin_event(event_quit, 0, 0, 0, 0); |
391
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
1141 |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
1142 /* then we remove everyone in a mass suicide */ |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
1143 c = plugins; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
1144 while (c) { |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
1145 p = (struct gaim_plugin *)c->data; |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
1146 if (g_module_symbol(p->handle, "gaim_plugin_remove", (gpointer *)&gaim_plugin_remove)) |
391
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
1147 (*gaim_plugin_remove)(); |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
1148 /* we don't need to worry about removing callbacks since |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
1149 * there won't be any more chance to call them back :) */ |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
1150 g_free(p); |
403
d6f02d7f78d8
[gaim-migrate @ 413]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
391
diff
changeset
|
1151 c = c->next; |
391
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
1152 } |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
1153 #endif |
1575
427e1409917c
[gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1544
diff
changeset
|
1154 system_log(log_quit, NULL, NULL, OPT_LOG_BUDDY_SIGNON | OPT_LOG_MY_SIGNON); |
784
4c292b3f74ea
[gaim-migrate @ 794]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
780
diff
changeset
|
1155 #ifdef USE_PERL |
4c292b3f74ea
[gaim-migrate @ 794]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
780
diff
changeset
|
1156 perl_end(); |
4c292b3f74ea
[gaim-migrate @ 794]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
780
diff
changeset
|
1157 #endif |
391
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
1158 |
1117
f3e0f41beddb
[gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1115
diff
changeset
|
1159 gtk_main_quit(); |
1 | 1160 } |
1161 | |
1162 void add_buddy_callback(GtkWidget *widget, void *dummy) | |
1163 { | |
1164 char *grp = NULL; | |
1165 GtkCTreeNode *node; | |
1166 GList *i; | |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1167 struct gaim_connection *gc = NULL; |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
1168 int *type; |
1 | 1169 |
1170 i = GTK_CLIST(edittree)->selection; | |
1171 if (i) { | |
1172 node = i->data; | |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
1173 type = (int *)gtk_ctree_node_get_row_data(GTK_CTREE(edittree), node); |
1 | 1174 |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
1175 if (*type == EDIT_BUDDY) { |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
1176 struct buddy *b = (struct buddy *)type; |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
1177 struct group *g = find_group_by_buddy(b->gc, b->name); |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
1178 grp = g->name; |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
1179 gc = b->gc; |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
1180 } else if (*type == EDIT_GROUP) { |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
1181 struct group *g = (struct group *)type; |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
1182 grp = g->name; |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
1183 gc = g->gc; |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
1184 } else { |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
1185 gc = (struct gaim_connection *)type; |
1 | 1186 } |
1187 } | |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1188 show_add_buddy(gc, NULL, grp); |
1 | 1189 |
1190 } | |
1191 | |
577
aa9a8bcddd80
[gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
544
diff
changeset
|
1192 void add_group_callback(GtkWidget *widget, void *dummy) |
aa9a8bcddd80
[gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
544
diff
changeset
|
1193 { |
1072
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
1194 GtkCTreeNode *node; |
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
1195 GList *i; |
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
1196 struct gaim_connection *gc = NULL; |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
1197 int *type; |
1072
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
1198 |
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
1199 i = GTK_CLIST(edittree)->selection; |
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
1200 if (i) { |
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
1201 node = i->data; |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
1202 type = (int *)gtk_ctree_node_get_row_data(GTK_CTREE(edittree), node); |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
1203 if (*type == EDIT_BUDDY) |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
1204 gc = ((struct buddy *)type)->gc; |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
1205 else if (*type == EDIT_GROUP) |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
1206 gc = ((struct group *)type)->gc; |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
1207 else |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
1208 gc = (struct gaim_connection *)type; |
1072
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
1209 } |
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
1210 show_add_group(gc); |
577
aa9a8bcddd80
[gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
544
diff
changeset
|
1211 } |
aa9a8bcddd80
[gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
544
diff
changeset
|
1212 |
935
5e6ca3dd4d02
[gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
921
diff
changeset
|
1213 static void im_callback(GtkWidget *widget, GtkTree *tree) |
5e6ca3dd4d02
[gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
921
diff
changeset
|
1214 { |
5e6ca3dd4d02
[gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
921
diff
changeset
|
1215 GList *i; |
1032
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
1216 struct buddy_show *b = NULL; |
935
5e6ca3dd4d02
[gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
921
diff
changeset
|
1217 struct conversation *c; |
5e6ca3dd4d02
[gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
921
diff
changeset
|
1218 i = GTK_TREE_SELECTION(tree); |
5e6ca3dd4d02
[gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
921
diff
changeset
|
1219 if (i) { |
5e6ca3dd4d02
[gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
921
diff
changeset
|
1220 b = gtk_object_get_user_data(GTK_OBJECT(i->data)); |
1095
ca8206682e3f
[gaim-migrate @ 1105]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1092
diff
changeset
|
1221 } |
ca8206682e3f
[gaim-migrate @ 1105]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1092
diff
changeset
|
1222 if (!i || !b) { |
935
5e6ca3dd4d02
[gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
921
diff
changeset
|
1223 show_im_dialog(); |
5e6ca3dd4d02
[gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
921
diff
changeset
|
1224 return; |
5e6ca3dd4d02
[gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
921
diff
changeset
|
1225 } |
5e6ca3dd4d02
[gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
921
diff
changeset
|
1226 if (!b->name) |
5e6ca3dd4d02
[gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
921
diff
changeset
|
1227 return; |
5e6ca3dd4d02
[gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
921
diff
changeset
|
1228 |
5e6ca3dd4d02
[gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
921
diff
changeset
|
1229 c = find_conversation(b->name); |
5e6ca3dd4d02
[gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
921
diff
changeset
|
1230 if (c == NULL) { |
5e6ca3dd4d02
[gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
921
diff
changeset
|
1231 c = new_conversation(b->name); |
5e6ca3dd4d02
[gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
921
diff
changeset
|
1232 } else { |
5e6ca3dd4d02
[gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
921
diff
changeset
|
1233 gdk_window_raise(c->window->window); |
5e6ca3dd4d02
[gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
921
diff
changeset
|
1234 } |
5e6ca3dd4d02
[gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
921
diff
changeset
|
1235 } |
5e6ca3dd4d02
[gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
921
diff
changeset
|
1236 |
5e6ca3dd4d02
[gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
921
diff
changeset
|
1237 |
1 | 1238 static void info_callback(GtkWidget *widget, GtkTree *tree) |
1239 { | |
1240 GList *i; | |
1032
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
1241 struct buddy_show *b = NULL; |
1 | 1242 i = GTK_TREE_SELECTION(tree); |
1243 if (i) { | |
1244 b = gtk_object_get_user_data(GTK_OBJECT(i->data)); | |
1095
ca8206682e3f
[gaim-migrate @ 1105]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1092
diff
changeset
|
1245 } |
ca8206682e3f
[gaim-migrate @ 1105]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1092
diff
changeset
|
1246 if (!i || !b) { |
935
5e6ca3dd4d02
[gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
921
diff
changeset
|
1247 show_info_dialog(); |
1 | 1248 return; |
1249 } | |
1250 if (!b->name) | |
1251 return; | |
1032
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
1252 serv_get_info(b->connlist->data, b->name); |
1 | 1253 } |
1254 | |
1255 | |
1256 void chat_callback(GtkWidget *widget, GtkTree *tree) | |
1257 { | |
1258 join_chat(); | |
1259 } | |
1260 | |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1261 struct group *find_group(struct gaim_connection *gc, char *group) |
1 | 1262 { |
1263 struct group *g; | |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1264 GSList *grp; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1265 GSList *c = connections; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1266 struct gaim_connection *z; |
1 | 1267 char *grpname = g_malloc(strlen(group) + 1); |
1268 | |
1269 strcpy(grpname, normalize(group)); | |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1270 if (gc) { |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1271 grp = gc->groups; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1272 while (grp) { |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1273 g = (struct group *)grp->data; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1274 if (!strcasecmp(normalize(g->name), grpname)) { |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1275 g_free(grpname); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1276 return g; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1277 } |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1278 grp = g_slist_next(grp); |
1 | 1279 } |
1280 | |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1281 g_free(grpname); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1282 return NULL; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1283 } else { |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1284 while(c) { |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1285 z = (struct gaim_connection *)c->data; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1286 grp = z->groups; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1287 while (grp) { |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1288 g = (struct group *)grp->data; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1289 if (!strcasecmp(normalize(g->name), grpname)) { |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1290 g_free(grpname); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1291 return g; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1292 } |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1293 grp = g_slist_next(grp); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1294 } |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1295 |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1296 c = c->next; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1297 } |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1298 g_free(grpname); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1299 return NULL; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1300 } |
1 | 1301 } |
1302 | |
1303 | |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1304 struct group *find_group_by_buddy(struct gaim_connection *gc, char *who) |
1 | 1305 { |
1306 struct group *g; | |
1307 struct buddy *b; | |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1308 GSList *grp; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1309 GSList *mem; |
1 | 1310 char *whoname = g_malloc(strlen(who) + 1); |
1311 | |
1312 strcpy(whoname, normalize(who)); | |
1313 | |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1314 if (gc) { |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1315 grp = gc->groups; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1316 while(grp) { |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1317 g = (struct group *)grp->data; |
1 | 1318 |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1319 mem = g->members; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1320 while(mem) { |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1321 b = (struct buddy *)mem->data; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1322 if (!strcasecmp(normalize(b->name), whoname)) { |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1323 g_free(whoname); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1324 return g; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1325 } |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1326 mem = mem->next; |
1 | 1327 } |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1328 grp = g_slist_next(grp); |
1 | 1329 } |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1330 g_free(whoname); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1331 return NULL; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1332 } else { |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1333 GSList *c = connections; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1334 struct gaim_connection *z; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1335 while (c) { |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1336 z = (struct gaim_connection *)c->data; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1337 grp = z->groups; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1338 while(grp) { |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1339 g = (struct group *)grp->data; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1340 |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1341 mem = g->members; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1342 while(mem) { |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1343 b = (struct buddy *)mem->data; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1344 if (!strcasecmp(normalize(b->name), whoname)) { |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1345 g_free(whoname); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1346 return g; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1347 } |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1348 mem = mem->next; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1349 } |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1350 grp = g_slist_next(grp); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1351 } |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1352 c = c->next; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1353 } |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1354 g_free(whoname); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1355 return NULL; |
1 | 1356 } |
1357 } | |
1358 | |
1359 | |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1360 struct buddy *find_buddy(struct gaim_connection *gc, char *who) |
1 | 1361 { |
1362 struct group *g; | |
1363 struct buddy *b; | |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1364 GSList *grp; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1365 GSList *c; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1366 struct gaim_connection *z; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1367 GSList *mem; |
1 | 1368 char *whoname = g_malloc(strlen(who) + 1); |
1369 | |
1370 strcpy(whoname, normalize(who)); | |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1371 if (gc) { |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1372 grp = gc->groups; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1373 while(grp) { |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1374 g = (struct group *)grp->data; |
1 | 1375 |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1376 mem = g->members; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1377 while(mem) { |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1378 b = (struct buddy *)mem->data; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1379 if (!strcasecmp(normalize(b->name), whoname)) { |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1380 g_free(whoname); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1381 return b; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1382 } |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1383 mem = mem->next; |
1 | 1384 } |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1385 grp = g_slist_next(grp); |
1 | 1386 } |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1387 g_free(whoname); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1388 return NULL; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1389 } else { |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1390 c = connections; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1391 while (c) { |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1392 z = (struct gaim_connection *)c->data; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1393 grp = z->groups; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1394 while(grp) { |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1395 g = (struct group *)grp->data; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1396 |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1397 mem = g->members; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1398 while(mem) { |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1399 b = (struct buddy *)mem->data; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1400 if (!strcasecmp(normalize(b->name), whoname)) { |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1401 g_free(whoname); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1402 return b; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1403 } |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1404 mem = mem->next; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1405 } |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1406 grp = g_slist_next(grp); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1407 } |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1408 c = c->next; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1409 } |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1410 g_free(whoname); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1411 return NULL; |
1 | 1412 } |
1413 } | |
1414 | |
1415 | |
1416 void rem_bp(GtkWidget *w, struct buddy_pounce *b) | |
1417 { | |
1418 buddy_pounces = g_list_remove(buddy_pounces, b); | |
689
4e3f5d9cacd5
[gaim-migrate @ 699]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
1419 do_bp_menu(); |
4e3f5d9cacd5
[gaim-migrate @ 699]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
1420 save_prefs(); |
1 | 1421 } |
1422 | |
1235
a9cf2f61a7b1
[gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1233
diff
changeset
|
1423 void do_pounce(char *name, int when) |
1 | 1424 { |
26 | 1425 char *who; |
1 | 1426 |
1427 struct buddy_pounce *b; | |
1428 struct conversation *c; | |
1155 | 1429 struct aim_user *u; |
1 | 1430 |
1431 GList *bp = buddy_pounces; | |
1432 | |
26 | 1433 who = g_strdup(normalize(name)); |
1 | 1434 |
1435 while(bp) { | |
1155 | 1436 b = (struct buddy_pounce *)bp->data; |
26 | 1437 bp = bp->next; /* increment the list here because rem_bp can make our handle bad */ |
1438 | |
1235
a9cf2f61a7b1
[gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1233
diff
changeset
|
1439 if (!(b->options & when)) continue; |
a9cf2f61a7b1
[gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1233
diff
changeset
|
1440 |
1155 | 1441 u = find_user(b->pouncer, b->protocol); /* find our user */ |
1442 if (u == NULL) continue; | |
1443 | |
1230
5395053cdee1
[gaim-migrate @ 1240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1229
diff
changeset
|
1444 /* check and see if we're signed on as the pouncer */ |
5395053cdee1
[gaim-migrate @ 1240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1229
diff
changeset
|
1445 if (u->gc == NULL) continue; |
5395053cdee1
[gaim-migrate @ 1240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1229
diff
changeset
|
1446 |
1155 | 1447 if (!strcasecmp(who, normalize(b->name))) { /* find someone to pounce */ |
1235
a9cf2f61a7b1
[gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1233
diff
changeset
|
1448 if (b->options & OPT_POUNCE_POPUP) |
1 | 1449 { |
1450 c = find_conversation(name); | |
1451 if (c == NULL) | |
1452 c = new_conversation(name); | |
1453 } | |
1235
a9cf2f61a7b1
[gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1233
diff
changeset
|
1454 if (b->options & OPT_POUNCE_SEND_IM) |
1 | 1455 { |
1456 c = find_conversation(name); | |
1457 if (c == NULL) | |
1458 c = new_conversation(name); | |
1459 | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
438
diff
changeset
|
1460 write_to_conv(c, b->message, WFLAG_SEND, NULL); |
1155 | 1461 serv_send_im(u->gc, name, b->message, 0); |
1 | 1462 } |
1235
a9cf2f61a7b1
[gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1233
diff
changeset
|
1463 if (b->options & OPT_POUNCE_COMMAND) |
1229
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1183
diff
changeset
|
1464 { |
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1183
diff
changeset
|
1465 int pid = fork(); |
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1183
diff
changeset
|
1466 |
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1183
diff
changeset
|
1467 if (pid == 0) { |
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1183
diff
changeset
|
1468 char *args[4]; |
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1183
diff
changeset
|
1469 args[0] = "sh"; |
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1183
diff
changeset
|
1470 args[1] = "-c"; |
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1183
diff
changeset
|
1471 args[2] = b->command; |
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1183
diff
changeset
|
1472 args[3] = NULL; |
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1183
diff
changeset
|
1473 execvp(args[0], args); |
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1183
diff
changeset
|
1474 _exit(0); |
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1183
diff
changeset
|
1475 } else if (pid > 0) { |
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1183
diff
changeset
|
1476 gtk_timeout_add(100, (GtkFunction)clean_pid, NULL); |
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1183
diff
changeset
|
1477 } |
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1183
diff
changeset
|
1478 } |
1 | 1479 |
1235
a9cf2f61a7b1
[gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1233
diff
changeset
|
1480 if (!(b->options & OPT_POUNCE_SAVE)) |
a9cf2f61a7b1
[gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1233
diff
changeset
|
1481 rem_bp(NULL, b); |
1 | 1482 |
1483 } | |
1484 } | |
1485 g_free(who); | |
1486 } | |
1487 | |
1488 static void new_bp_callback(GtkWidget *w, char *name) | |
1489 { | |
1490 show_new_bp(name); | |
1491 } | |
1492 | |
1493 void do_bp_menu() | |
1494 { | |
1495 GtkWidget *menuitem, *mess, *messmenu; | |
1496 static GtkWidget *remmenu; | |
1497 GtkWidget *remitem; | |
1498 GtkWidget *sep; | |
1499 GList *l; | |
1500 struct buddy_pounce *b; | |
1501 GList *bp = buddy_pounces; | |
1502 | |
1503 l = gtk_container_children(GTK_CONTAINER(bpmenu)); | |
1504 | |
1505 while(l) { | |
1506 gtk_widget_destroy(GTK_WIDGET(l->data)); | |
1507 l = l->next; | |
1508 } | |
1509 | |
1510 remmenu = gtk_menu_new(); | |
1511 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1512 menuitem = gtk_menu_item_new_with_label(_("New Buddy Pounce")); |
1 | 1513 gtk_menu_append(GTK_MENU(bpmenu), menuitem); |
1514 gtk_widget_show(menuitem); | |
1515 gtk_signal_connect(GTK_OBJECT(menuitem), "activate", GTK_SIGNAL_FUNC(new_bp_callback), NULL); | |
1516 | |
1517 | |
1518 while(bp) { | |
1519 | |
1520 b = (struct buddy_pounce *)bp->data; | |
1521 remitem = gtk_menu_item_new_with_label(b->name); | |
1522 gtk_menu_append(GTK_MENU(remmenu), remitem); | |
1523 gtk_widget_show(remitem); | |
1524 gtk_signal_connect(GTK_OBJECT(remitem), "activate", GTK_SIGNAL_FUNC(rem_bp), b); | |
1525 | |
1526 bp = bp->next; | |
1527 | |
1528 } | |
1529 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1530 menuitem = gtk_menu_item_new_with_label(_("Remove Buddy Pounce")); |
1 | 1531 gtk_menu_append(GTK_MENU(bpmenu), menuitem); |
1532 gtk_widget_show(menuitem); | |
1533 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), remmenu); | |
1534 gtk_widget_show(remmenu); | |
1535 | |
1536 sep = gtk_hseparator_new(); | |
1537 menuitem = gtk_menu_item_new(); | |
1538 gtk_menu_append(GTK_MENU(bpmenu), menuitem); | |
1539 gtk_container_add(GTK_CONTAINER(menuitem), sep); | |
1540 gtk_widget_set_sensitive(menuitem, FALSE); | |
1541 gtk_widget_show(menuitem); | |
1542 gtk_widget_show(sep); | |
1543 | |
1138 | 1544 bp = buddy_pounces; |
1 | 1545 |
1546 while(bp) { | |
1547 | |
1548 b = (struct buddy_pounce *)bp->data; | |
1549 | |
1550 menuitem = gtk_menu_item_new_with_label(b->name); | |
1551 gtk_menu_append(GTK_MENU(bpmenu), menuitem); | |
1552 messmenu = gtk_menu_new(); | |
1553 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), messmenu); | |
1554 gtk_widget_show(menuitem); | |
1555 | |
1556 mess = gtk_menu_item_new_with_label(b->message); | |
1557 gtk_menu_append(GTK_MENU(messmenu), mess); | |
1558 gtk_widget_show(mess); | |
1559 | |
1560 bp = bp->next; | |
1561 | |
1562 } | |
1563 | |
1564 } | |
1565 | |
1566 | |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1567 static struct group_show *find_group_show(char *group) { |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1568 GSList *m = shows; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1569 struct group_show *g = NULL; |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
1570 char *who = g_strdup(normalize(group)); |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1571 |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1572 while (m) { |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1573 g = (struct group_show *)m->data; |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
1574 if (!strcasecmp(normalize(g->name), who)) |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1575 break; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1576 g = NULL; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1577 m = m->next; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1578 } |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
1579 g_free(who); |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1580 |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1581 return g; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1582 } |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1583 |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1584 static struct buddy_show *find_buddy_show(struct group_show *gs, char *name) { |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1585 GSList *m = gs->members; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1586 struct buddy_show *b = NULL; |
1098
b335c0ce305e
[gaim-migrate @ 1108]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1097
diff
changeset
|
1587 char *who = g_strdup(normalize(name)); |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1588 |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1589 while (m) { |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1590 b = (struct buddy_show *)m->data; |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
1591 if (!strcasecmp(normalize(b->name), who)) |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1592 break; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1593 b = NULL; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1594 m = m->next; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1595 } |
1098
b335c0ce305e
[gaim-migrate @ 1108]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1097
diff
changeset
|
1596 g_free(who); |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1597 |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1598 return b; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1599 } |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1600 |
1037
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1601 static int group_number(char *group) { |
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1602 GSList *c = connections; |
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1603 struct gaim_connection *g; |
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1604 GSList *m; |
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1605 struct group *p; |
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1606 int pos = 0; |
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1607 |
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1608 while (c) { |
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1609 g = (struct gaim_connection *)c->data; |
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1610 m = g->groups; |
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1611 while (m) { |
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1612 p = (struct group *)m->data; |
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1613 if (!strcmp(p->name, group)) |
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1614 return pos; |
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1615 if (find_group_show(p->name)) |
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1616 pos++; |
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1617 m = m->next; |
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1618 } |
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1619 c = c->next; |
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1620 } |
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1621 /* um..... we'll never get here */ |
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1622 return -1; |
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1623 } |
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1624 |
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1625 static int buddy_number(char *group, char *buddy) { |
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1626 GSList *c = connections; |
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1627 struct gaim_connection *g; |
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1628 struct group *p; |
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1629 GSList *z; |
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1630 struct buddy *b; |
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1631 int pos = 0; |
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1632 char *tmp1 = g_strdup(normalize(buddy)); |
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1633 struct group_show *gs = find_group_show(group); |
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1634 |
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1635 while (c) { |
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1636 g = (struct gaim_connection *)c->data; |
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1637 p = find_group(g, group); |
1049
749e25dc90cb
[gaim-migrate @ 1059]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1047
diff
changeset
|
1638 if (!p) { |
749e25dc90cb
[gaim-migrate @ 1059]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1047
diff
changeset
|
1639 c = c->next; |
749e25dc90cb
[gaim-migrate @ 1059]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1047
diff
changeset
|
1640 continue; |
749e25dc90cb
[gaim-migrate @ 1059]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1047
diff
changeset
|
1641 } |
1037
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1642 z = p->members; |
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1643 while (z) { |
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1644 b = (struct buddy *)z->data; |
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1645 if (!strcmp(tmp1, normalize(b->name))) { |
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1646 g_free(tmp1); |
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1647 return pos; |
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1648 } |
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1649 if (find_buddy_show(gs, b->name)) |
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1650 pos++; |
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1651 z = z->next; |
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1652 } |
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1653 c = c->next; |
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1654 } |
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1655 /* we shouldn't ever get here */ |
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1656 debug_printf("got to bad place in buddy_number\n"); |
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1657 g_free(tmp1); |
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1658 return -1; |
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1659 } |
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1660 |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1661 static struct group_show *new_group_show(char *group) { |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1662 struct group_show *g = g_new0(struct group_show, 1); |
1037
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1663 int pos = group_number(group); |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1664 |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1665 g->name = g_strdup(group); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1666 |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1667 g->item = gtk_tree_item_new(); |
1037
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1668 gtk_tree_insert(GTK_TREE(buddies), g->item, pos); |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1669 gtk_signal_connect(GTK_OBJECT(g->item), "button_press_event", |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1670 GTK_SIGNAL_FUNC(handle_click_group), NULL); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1671 gtk_widget_show(g->item); |
1 | 1672 |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1673 g->label = gtk_label_new(group); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1674 gtk_misc_set_alignment(GTK_MISC(g->label), 0.0, 0.5); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1675 gtk_container_add(GTK_CONTAINER(g->item), g->label); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1676 gtk_widget_show(g->label); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1677 |
1037
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1678 shows = g_slist_insert(shows, g, pos); |
1072
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
1679 update_num_groups(g); |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1680 return g; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1681 } |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1682 |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
1683 static struct buddy_show *new_buddy_show(struct group_show *gs, struct buddy *buddy, char **xpm) { |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1684 struct buddy_show *b = g_new0(struct buddy_show, 1); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1685 GtkWidget *box; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1686 GdkPixmap *pm; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1687 GdkBitmap *bm; |
1037
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1688 int pos = buddy_number(gs->name, buddy->name); |
1299
18c3874ea051
[gaim-migrate @ 1309]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1297
diff
changeset
|
1689 b->sound = 0; |
1 | 1690 |
1409
17e544f8c7fb
[gaim-migrate @ 1419]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1401
diff
changeset
|
1691 if (gs->members == NULL) { |
17e544f8c7fb
[gaim-migrate @ 1419]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1401
diff
changeset
|
1692 gs->tree = gtk_tree_new(); |
17e544f8c7fb
[gaim-migrate @ 1419]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1401
diff
changeset
|
1693 gtk_tree_item_set_subtree(GTK_TREE_ITEM(gs->item), gs->tree); |
17e544f8c7fb
[gaim-migrate @ 1419]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1401
diff
changeset
|
1694 gtk_tree_item_expand(GTK_TREE_ITEM(gs->item)); |
17e544f8c7fb
[gaim-migrate @ 1419]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1401
diff
changeset
|
1695 gtk_widget_show(gs->tree); |
17e544f8c7fb
[gaim-migrate @ 1419]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1401
diff
changeset
|
1696 } |
17e544f8c7fb
[gaim-migrate @ 1419]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1401
diff
changeset
|
1697 |
1036
faa5afc2b89e
[gaim-migrate @ 1046]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1033
diff
changeset
|
1698 b->name = g_strdup(buddy->name); |
faa5afc2b89e
[gaim-migrate @ 1046]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1033
diff
changeset
|
1699 b->show = g_strdup(buddy->show); |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1700 |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1701 b->item = gtk_tree_item_new(); |
1037
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1702 gtk_tree_insert(GTK_TREE(gs->tree), b->item, pos); |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1703 gtk_object_set_user_data(GTK_OBJECT(b->item), b); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1704 gtk_signal_connect(GTK_OBJECT(b->item), "button_press_event", |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1705 GTK_SIGNAL_FUNC(handle_click_buddy), b); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1706 gtk_widget_show(b->item); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1707 |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1708 box = gtk_hbox_new(FALSE, 1); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1709 gtk_container_add(GTK_CONTAINER(b->item), box); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1710 gtk_widget_show(box); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1711 |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
1712 pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm, NULL, xpm); |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1713 b->pix = gtk_pixmap_new(pm, bm); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1714 gtk_box_pack_start(GTK_BOX(box), b->pix, FALSE, FALSE, 1); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1715 gtk_widget_show(b->pix); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1716 gdk_pixmap_unref(pm); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1717 gdk_bitmap_unref(bm); |
1 | 1718 |
1036
faa5afc2b89e
[gaim-migrate @ 1046]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1033
diff
changeset
|
1719 b->label = gtk_label_new(buddy->show); |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1720 gtk_misc_set_alignment(GTK_MISC(b->label), 0.0, 0.5); |
1242
8cb5c1000ea9
[gaim-migrate @ 1252]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
1721 gtk_box_pack_start(GTK_BOX(box), b->label, FALSE, FALSE, 1); |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1722 gtk_widget_show(b->label); |
1 | 1723 |
1242
8cb5c1000ea9
[gaim-migrate @ 1252]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
1724 b->warn = gtk_label_new(""); |
8cb5c1000ea9
[gaim-migrate @ 1252]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
1725 gtk_box_pack_start(GTK_BOX(box), b->warn, FALSE, FALSE, 1); |
8cb5c1000ea9
[gaim-migrate @ 1252]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
1726 gtk_widget_show(b->warn); |
8cb5c1000ea9
[gaim-migrate @ 1252]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
1727 |
1058
4927ce25d8cc
[gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
1728 b->idle = gtk_label_new(""); |
1242
8cb5c1000ea9
[gaim-migrate @ 1252]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
1729 gtk_box_pack_end(GTK_BOX(box), b->idle, FALSE, FALSE, 1); |
1058
4927ce25d8cc
[gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
1730 gtk_widget_show(b->idle); |
4927ce25d8cc
[gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
1731 |
1037
1c663beef29d
[gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1036
diff
changeset
|
1732 gs->members = g_slist_insert(gs->members, b, pos); |
1070
b288f17c2fb2
[gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1069
diff
changeset
|
1733 update_num_group(gs); |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1734 return b; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1735 } |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1736 |
1108
cb338aa38e78
[gaim-migrate @ 1118]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1106
diff
changeset
|
1737 static void remove_buddy_show(struct group_show *gs, struct buddy_show *bs) { |
cb338aa38e78
[gaim-migrate @ 1118]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1106
diff
changeset
|
1738 /* the name of this function may be misleading, but don't let it fool you. the point |
cb338aa38e78
[gaim-migrate @ 1118]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1106
diff
changeset
|
1739 * of this is to remove bs->item from gs->tree, and make sure gs->tree still exists |
cb338aa38e78
[gaim-migrate @ 1118]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1106
diff
changeset
|
1740 * and is a valid tree afterwards. Otherwise, Bad Things will happen. */ |
cb338aa38e78
[gaim-migrate @ 1118]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1106
diff
changeset
|
1741 gtk_tree_remove_item(GTK_TREE(gs->tree), bs->item); |
cb338aa38e78
[gaim-migrate @ 1118]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1106
diff
changeset
|
1742 bs->item = NULL; |
cb338aa38e78
[gaim-migrate @ 1118]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1106
diff
changeset
|
1743 } |
cb338aa38e78
[gaim-migrate @ 1118]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1106
diff
changeset
|
1744 |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1745 static struct group_show *find_gs_by_bs(struct buddy_show *b) { |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1746 GSList *m, *n; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1747 struct group_show *g = NULL; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1748 struct buddy_show *h; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1749 |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1750 m = shows; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1751 while (m) { |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1752 g = (struct group_show *)m->data; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1753 n = g->members; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1754 while (n) { |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1755 h = (struct buddy_show *)n->data; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1756 if (h == b) |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1757 return g; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1758 n = n->next; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1759 } |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1760 g = NULL; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1761 m = m->next; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1762 } |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1763 |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1764 return g; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1765 } |
1 | 1766 |
1089
f0f5c10cce63
[gaim-migrate @ 1099]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1088
diff
changeset
|
1767 static gint log_timeout(struct buddy_show *b) { |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1768 if (!b->connlist) { |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1769 struct group_show *g = find_gs_by_bs(b); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1770 g->members = g_slist_remove(g->members, b); |
1091
3d6ab4f1fa55
[gaim-migrate @ 1101]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1089
diff
changeset
|
1771 if (blist) |
1108
cb338aa38e78
[gaim-migrate @ 1118]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1106
diff
changeset
|
1772 remove_buddy_show(g, b); |
1091
3d6ab4f1fa55
[gaim-migrate @ 1101]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1089
diff
changeset
|
1773 else |
3d6ab4f1fa55
[gaim-migrate @ 1101]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1089
diff
changeset
|
1774 debug_printf("log_timeout but buddy list not available\n"); |
1083
12478dd1e9d7
[gaim-migrate @ 1093]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1081
diff
changeset
|
1775 if ((g->members == NULL) && (display_options & OPT_DISP_NO_MT_GRP)) { |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1776 shows = g_slist_remove(shows, g); |
1091
3d6ab4f1fa55
[gaim-migrate @ 1101]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1089
diff
changeset
|
1777 if (blist) |
1108
cb338aa38e78
[gaim-migrate @ 1118]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1106
diff
changeset
|
1778 gtk_tree_remove_item(GTK_TREE(buddies), g->item); |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1779 g_free(g->name); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1780 g_free(g); |
1089
f0f5c10cce63
[gaim-migrate @ 1099]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1088
diff
changeset
|
1781 } |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
1782 gtk_timeout_remove(b->log_timer); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
1783 b->log_timer = 0; |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1784 g_free(b->name); |
1036
faa5afc2b89e
[gaim-migrate @ 1046]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1033
diff
changeset
|
1785 g_free(b->show); |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1786 g_free(b); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1787 } else { |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1788 /* um.... what do we have to do here? just update the pixmap? */ |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1789 GdkPixmap *pm; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1790 GdkBitmap *bm; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1791 gchar **xpm = NULL; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1792 struct buddy *light = find_buddy(b->connlist->data, b->name); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1793 if (((struct gaim_connection *)b->connlist->data)->prpl->list_icon) |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1794 xpm = (*((struct gaim_connection *)b->connlist->data)->prpl->list_icon)(light->uc); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1795 if (xpm == NULL) |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1796 xpm = (char **)no_icon_xpm; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1797 pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm, NULL, xpm); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1798 gtk_widget_hide(b->pix); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1799 gtk_pixmap_set(GTK_PIXMAP(b->pix), pm, bm); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1800 gtk_widget_show(b->pix); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1801 if (ticker_prefs & OPT_DISP_SHOW_BUDDYTICKER) |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1802 BuddyTickerSetPixmap(b->name, pm, bm); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1803 gdk_pixmap_unref(pm); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1804 gdk_bitmap_unref(bm); |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
1805 gtk_timeout_remove(b->log_timer); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
1806 b->log_timer = 0; |
1299
18c3874ea051
[gaim-migrate @ 1309]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1297
diff
changeset
|
1807 b->sound = 0; |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1808 } |
1091
3d6ab4f1fa55
[gaim-migrate @ 1101]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1089
diff
changeset
|
1809 return 0; |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1810 } |
513
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1811 |
1068
ed28707debdc
[gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1066
diff
changeset
|
1812 static char *caps_string(gushort caps) |
ed28707debdc
[gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1066
diff
changeset
|
1813 { |
ed28707debdc
[gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1066
diff
changeset
|
1814 static char buf[256], *tmp; |
ed28707debdc
[gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1066
diff
changeset
|
1815 int count = 0, i = 0; |
ed28707debdc
[gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1066
diff
changeset
|
1816 gushort bit = 1; |
1310
035945fca2d5
[gaim-migrate @ 1320]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1299
diff
changeset
|
1817 while (bit <= 0x80) { |
1068
ed28707debdc
[gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1066
diff
changeset
|
1818 if (bit & caps) { |
ed28707debdc
[gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1066
diff
changeset
|
1819 switch (bit) { |
ed28707debdc
[gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1066
diff
changeset
|
1820 case 0x1: |
ed28707debdc
[gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1066
diff
changeset
|
1821 tmp = _("Buddy Icon"); |
ed28707debdc
[gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1066
diff
changeset
|
1822 break; |
ed28707debdc
[gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1066
diff
changeset
|
1823 case 0x2: |
ed28707debdc
[gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1066
diff
changeset
|
1824 tmp = _("Voice"); |
ed28707debdc
[gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1066
diff
changeset
|
1825 break; |
ed28707debdc
[gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1066
diff
changeset
|
1826 case 0x4: |
ed28707debdc
[gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1066
diff
changeset
|
1827 tmp = _("IM Image"); |
ed28707debdc
[gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1066
diff
changeset
|
1828 break; |
ed28707debdc
[gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1066
diff
changeset
|
1829 case 0x8: |
ed28707debdc
[gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1066
diff
changeset
|
1830 tmp = _("Chat"); |
ed28707debdc
[gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1066
diff
changeset
|
1831 break; |
ed28707debdc
[gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1066
diff
changeset
|
1832 case 0x10: |
ed28707debdc
[gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1066
diff
changeset
|
1833 tmp = _("Get File"); |
ed28707debdc
[gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1066
diff
changeset
|
1834 break; |
ed28707debdc
[gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1066
diff
changeset
|
1835 case 0x20: |
ed28707debdc
[gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1066
diff
changeset
|
1836 tmp = _("Send File"); |
ed28707debdc
[gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1066
diff
changeset
|
1837 break; |
1310
035945fca2d5
[gaim-migrate @ 1320]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1299
diff
changeset
|
1838 case 0x40: |
035945fca2d5
[gaim-migrate @ 1320]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1299
diff
changeset
|
1839 tmp = _("Games"); |
035945fca2d5
[gaim-migrate @ 1320]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1299
diff
changeset
|
1840 break; |
035945fca2d5
[gaim-migrate @ 1320]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1299
diff
changeset
|
1841 case 0x80: |
035945fca2d5
[gaim-migrate @ 1320]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1299
diff
changeset
|
1842 tmp = _("Stocks"); |
035945fca2d5
[gaim-migrate @ 1320]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1299
diff
changeset
|
1843 break; |
1068
ed28707debdc
[gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1066
diff
changeset
|
1844 default: |
ed28707debdc
[gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1066
diff
changeset
|
1845 tmp = NULL; |
ed28707debdc
[gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1066
diff
changeset
|
1846 break; |
ed28707debdc
[gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1066
diff
changeset
|
1847 } |
ed28707debdc
[gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1066
diff
changeset
|
1848 if (tmp) |
ed28707debdc
[gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1066
diff
changeset
|
1849 i += g_snprintf(buf+i, sizeof(buf)-i, "%s%s", (count ? ", " : ""), tmp); |
ed28707debdc
[gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1066
diff
changeset
|
1850 count++; |
ed28707debdc
[gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1066
diff
changeset
|
1851 } |
ed28707debdc
[gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1066
diff
changeset
|
1852 bit <<= 1; |
ed28707debdc
[gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1066
diff
changeset
|
1853 } |
ed28707debdc
[gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1066
diff
changeset
|
1854 return buf; |
ed28707debdc
[gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1066
diff
changeset
|
1855 } |
ed28707debdc
[gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1066
diff
changeset
|
1856 |
1163
8f70ecf3e884
[gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1159
diff
changeset
|
1857 /* for this we're just going to assume the first connection that registered the buddy. |
8f70ecf3e884
[gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1159
diff
changeset
|
1858 * if it's not the one you were hoping for then you're shit out of luck */ |
1058
4927ce25d8cc
[gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
1859 static void update_idle_time(struct buddy_show *bs) { |
1075
2fe18b2d6105
[gaim-migrate @ 1085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1072
diff
changeset
|
1860 /* this also updates the tooltip since that has idle time in it */ |
1242
8cb5c1000ea9
[gaim-migrate @ 1252]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
1861 char idlet[16], warnl[16]; |
1058
4927ce25d8cc
[gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
1862 time_t t; |
4927ce25d8cc
[gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
1863 int ihrs, imin; |
4927ce25d8cc
[gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
1864 struct buddy *b; |
4927ce25d8cc
[gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
1865 |
1163
8f70ecf3e884
[gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1159
diff
changeset
|
1866 char infotip[2048]; |
1068
ed28707debdc
[gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1066
diff
changeset
|
1867 char warn[256]; |
ed28707debdc
[gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1066
diff
changeset
|
1868 char caps[256]; |
ed28707debdc
[gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1066
diff
changeset
|
1869 char *sotime, *itime; |
ed28707debdc
[gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1066
diff
changeset
|
1870 |
1058
4927ce25d8cc
[gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
1871 time(&t); |
1166
d8324d695678
[gaim-migrate @ 1176]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1164
diff
changeset
|
1872 if (!bs->connlist) return; |
1163
8f70ecf3e884
[gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1159
diff
changeset
|
1873 b = find_buddy(bs->connlist->data, bs->name); |
8f70ecf3e884
[gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1159
diff
changeset
|
1874 if (!b) return; |
8f70ecf3e884
[gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1159
diff
changeset
|
1875 ihrs = (t - b->idle) / 3600; imin = ((t - b->idle) / 60) % 60; |
1058
4927ce25d8cc
[gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
1876 |
1163
8f70ecf3e884
[gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1159
diff
changeset
|
1877 if (ihrs) |
8f70ecf3e884
[gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1159
diff
changeset
|
1878 g_snprintf(idlet, sizeof idlet, "(%d:%02d)", ihrs, imin); |
8f70ecf3e884
[gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1159
diff
changeset
|
1879 else |
8f70ecf3e884
[gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1159
diff
changeset
|
1880 g_snprintf(idlet, sizeof idlet, "(%d)", imin); |
1058
4927ce25d8cc
[gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
1881 |
1163
8f70ecf3e884
[gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1159
diff
changeset
|
1882 gtk_widget_hide(bs->idle); |
8f70ecf3e884
[gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1159
diff
changeset
|
1883 if (b->idle) |
8f70ecf3e884
[gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1159
diff
changeset
|
1884 gtk_label_set(GTK_LABEL(bs->idle), idlet); |
8f70ecf3e884
[gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1159
diff
changeset
|
1885 else |
8f70ecf3e884
[gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1159
diff
changeset
|
1886 gtk_label_set(GTK_LABEL(bs->idle), ""); |
8f70ecf3e884
[gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1159
diff
changeset
|
1887 if (display_options & OPT_DISP_SHOW_IDLETIME) |
8f70ecf3e884
[gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1159
diff
changeset
|
1888 gtk_widget_show(bs->idle); |
1068
ed28707debdc
[gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1066
diff
changeset
|
1889 |
1163
8f70ecf3e884
[gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1159
diff
changeset
|
1890 /* now we do the tooltip */ |
1496
d33bf6548543
[gaim-migrate @ 1506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1477
diff
changeset
|
1891 if (b->signon) { |
d33bf6548543
[gaim-migrate @ 1506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1477
diff
changeset
|
1892 char *stime = sec_to_text(t - b->signon + |
d33bf6548543
[gaim-migrate @ 1506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1477
diff
changeset
|
1893 ((struct gaim_connection *)bs->connlist->data)->correction_time); |
d33bf6548543
[gaim-migrate @ 1506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1477
diff
changeset
|
1894 sotime = g_strdup_printf(_("Logged in: %s\n"), stime); |
d33bf6548543
[gaim-migrate @ 1506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1477
diff
changeset
|
1895 g_free(stime); |
d33bf6548543
[gaim-migrate @ 1506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1477
diff
changeset
|
1896 } |
1068
ed28707debdc
[gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1066
diff
changeset
|
1897 |
1163
8f70ecf3e884
[gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1159
diff
changeset
|
1898 if (b->idle) |
8f70ecf3e884
[gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1159
diff
changeset
|
1899 itime = sec_to_text(t - b->idle); |
8f70ecf3e884
[gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1159
diff
changeset
|
1900 else { |
8f70ecf3e884
[gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1159
diff
changeset
|
1901 itime = g_malloc(1); itime[0] = 0; |
8f70ecf3e884
[gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1159
diff
changeset
|
1902 } |
1068
ed28707debdc
[gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1066
diff
changeset
|
1903 |
1242
8cb5c1000ea9
[gaim-migrate @ 1252]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
1904 if (b->evil) { |
1163
8f70ecf3e884
[gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1159
diff
changeset
|
1905 g_snprintf(warn, sizeof warn, _("Warnings: %d%%\n"), b->evil); |
1242
8cb5c1000ea9
[gaim-migrate @ 1252]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
1906 g_snprintf(warnl, sizeof warnl, "(%d%%)", b->evil); |
8cb5c1000ea9
[gaim-migrate @ 1252]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
1907 } else { |
1163
8f70ecf3e884
[gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1159
diff
changeset
|
1908 warn[0] = '\0'; |
1242
8cb5c1000ea9
[gaim-migrate @ 1252]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
1909 warnl[0] = '\0'; |
8cb5c1000ea9
[gaim-migrate @ 1252]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
1910 } |
8cb5c1000ea9
[gaim-migrate @ 1252]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
1911 gtk_widget_hide(bs->warn); |
8cb5c1000ea9
[gaim-migrate @ 1252]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
1912 gtk_label_set(GTK_LABEL(bs->warn), warnl); |
8cb5c1000ea9
[gaim-migrate @ 1252]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
1913 if (display_options & OPT_DISP_SHOW_WARN) |
8cb5c1000ea9
[gaim-migrate @ 1252]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
1914 gtk_widget_show(bs->warn); |
1068
ed28707debdc
[gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1066
diff
changeset
|
1915 |
1163
8f70ecf3e884
[gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1159
diff
changeset
|
1916 if (b->caps) |
8f70ecf3e884
[gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1159
diff
changeset
|
1917 g_snprintf(caps, sizeof caps, _("Capabilities: %s\n"), caps_string(b->caps)); |
8f70ecf3e884
[gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1159
diff
changeset
|
1918 else |
8f70ecf3e884
[gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1159
diff
changeset
|
1919 caps[0] = '\0'; |
1068
ed28707debdc
[gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1066
diff
changeset
|
1920 |
1163
8f70ecf3e884
[gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1159
diff
changeset
|
1921 g_snprintf(infotip, sizeof infotip, _("Alias: %s \nScreen Name: %s\n" |
1496
d33bf6548543
[gaim-migrate @ 1506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1477
diff
changeset
|
1922 "%s%s%s%s%s%s"), |
d33bf6548543
[gaim-migrate @ 1506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1477
diff
changeset
|
1923 b->show, b->name, |
d33bf6548543
[gaim-migrate @ 1506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1477
diff
changeset
|
1924 (b->signon ? sotime : ""), warn, |
1163
8f70ecf3e884
[gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1159
diff
changeset
|
1925 (b->idle ? _("Idle: ") : ""), itime, |
8f70ecf3e884
[gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1159
diff
changeset
|
1926 (b->idle ? "\n" : ""), caps); |
1068
ed28707debdc
[gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1066
diff
changeset
|
1927 |
1163
8f70ecf3e884
[gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1159
diff
changeset
|
1928 gtk_tooltips_set_tip(tips, GTK_WIDGET(bs->item), infotip, ""); |
1068
ed28707debdc
[gaim-migrate @ 1078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1066
diff
changeset
|
1929 |
1496
d33bf6548543
[gaim-migrate @ 1506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1477
diff
changeset
|
1930 if (b->signon) |
d33bf6548543
[gaim-migrate @ 1506]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1477
diff
changeset
|
1931 g_free(sotime); |
1163
8f70ecf3e884
[gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1159
diff
changeset
|
1932 g_free(itime); |
1058
4927ce25d8cc
[gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
1933 } |
4927ce25d8cc
[gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
1934 |
4927ce25d8cc
[gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
1935 void update_idle_times() { |
4927ce25d8cc
[gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
1936 GSList *grp = shows; |
4927ce25d8cc
[gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
1937 GSList *mem; |
4927ce25d8cc
[gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
1938 struct buddy_show *b; |
4927ce25d8cc
[gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
1939 struct group_show *g; |
4927ce25d8cc
[gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
1940 |
4927ce25d8cc
[gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
1941 while (grp) { |
4927ce25d8cc
[gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
1942 g = (struct group_show *)grp->data; |
4927ce25d8cc
[gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
1943 mem = g->members; |
4927ce25d8cc
[gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
1944 while (mem) { |
4927ce25d8cc
[gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
1945 b = (struct buddy_show *)mem->data; |
4927ce25d8cc
[gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
1946 update_idle_time(b); |
4927ce25d8cc
[gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
1947 mem = mem->next; |
4927ce25d8cc
[gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
1948 } |
4927ce25d8cc
[gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
1949 grp = grp->next; |
4927ce25d8cc
[gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
1950 } |
4927ce25d8cc
[gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
1951 } |
4927ce25d8cc
[gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
1952 |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1953 void set_buddy(struct gaim_connection *gc, struct buddy *b) |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1954 { |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1955 struct group *g = find_group_by_buddy(gc, b->name); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1956 struct group_show *gs; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1957 struct buddy_show *bs; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1958 GdkPixmap *pm; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1959 GdkBitmap *bm; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1960 char **xpm = NULL; |
1058
4927ce25d8cc
[gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
1961 |
1063
e1408fb04c36
[gaim-migrate @ 1073]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1061
diff
changeset
|
1962 if (!blist) return; |
e1408fb04c36
[gaim-migrate @ 1073]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1061
diff
changeset
|
1963 |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1964 if (b->present) { |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1965 if ((gs = find_group_show(g->name)) == NULL) |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1966 gs = new_group_show(g->name); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1967 if ((bs = find_buddy_show(gs, b->name)) == NULL) |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
1968 bs = new_buddy_show(gs, b, (char **)login_icon_xpm); |
1164
ed5bb86253c6
[gaim-migrate @ 1174]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1163
diff
changeset
|
1969 if (!g_slist_find(bs->connlist, gc)) |
ed5bb86253c6
[gaim-migrate @ 1174]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1163
diff
changeset
|
1970 bs->connlist = g_slist_append(bs->connlist, gc); |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1971 if (b->present == 1) { |
1299
18c3874ea051
[gaim-migrate @ 1309]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1297
diff
changeset
|
1972 if (bs->sound != 2) |
18c3874ea051
[gaim-migrate @ 1309]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1297
diff
changeset
|
1973 play_sound(BUDDY_ARRIVE); |
1039
67ed2ee5be9f
[gaim-migrate @ 1049]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1037
diff
changeset
|
1974 pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm, |
67ed2ee5be9f
[gaim-migrate @ 1049]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1037
diff
changeset
|
1975 NULL, (char **)login_icon_xpm); |
67ed2ee5be9f
[gaim-migrate @ 1049]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1037
diff
changeset
|
1976 gtk_widget_hide(bs->pix); |
67ed2ee5be9f
[gaim-migrate @ 1049]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1037
diff
changeset
|
1977 gtk_pixmap_set(GTK_PIXMAP(bs->pix), pm, bm); |
67ed2ee5be9f
[gaim-migrate @ 1049]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1037
diff
changeset
|
1978 gtk_widget_show(bs->pix); |
1066
d6c70d58a4b2
[gaim-migrate @ 1076]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1063
diff
changeset
|
1979 if (ticker_prefs & OPT_DISP_SHOW_BUDDYTICKER) { |
d6c70d58a4b2
[gaim-migrate @ 1076]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1063
diff
changeset
|
1980 BuddyTickerAddUser(b->name, pm, bm); |
d6c70d58a4b2
[gaim-migrate @ 1076]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1063
diff
changeset
|
1981 gtk_timeout_add(10000, (GtkFunction)BuddyTickerLogonTimeout, b->name); |
d6c70d58a4b2
[gaim-migrate @ 1076]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1063
diff
changeset
|
1982 } |
1039
67ed2ee5be9f
[gaim-migrate @ 1049]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1037
diff
changeset
|
1983 gdk_pixmap_unref(pm); |
67ed2ee5be9f
[gaim-migrate @ 1049]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1037
diff
changeset
|
1984 gdk_bitmap_unref(bm); |
121
3571b593f423
[gaim-migrate @ 131]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
120
diff
changeset
|
1985 b->present = 2; |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
1986 if (bs->log_timer > 0) |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
1987 gtk_timeout_remove(bs->log_timer); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
1988 bs->log_timer = gtk_timeout_add(10000, (GtkFunction)log_timeout, bs); |
1070
b288f17c2fb2
[gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1069
diff
changeset
|
1989 update_num_group(gs); |
1661
6cea395b627d
[gaim-migrate @ 1671]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1634
diff
changeset
|
1990 if ((bs->sound != 2) && (display_options & OPT_DISP_SHOW_LOGON)) { |
1066
d6c70d58a4b2
[gaim-migrate @ 1076]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1063
diff
changeset
|
1991 struct conversation *c = find_conversation(b->name); |
d6c70d58a4b2
[gaim-migrate @ 1076]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1063
diff
changeset
|
1992 if (c) { |
d6c70d58a4b2
[gaim-migrate @ 1076]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1063
diff
changeset
|
1993 char tmp[1024]; |
d6c70d58a4b2
[gaim-migrate @ 1076]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1063
diff
changeset
|
1994 g_snprintf(tmp, sizeof(tmp), _("<HR><B>%s logged in%s%s.</B><BR><HR>"), b->name, |
d6c70d58a4b2
[gaim-migrate @ 1076]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1063
diff
changeset
|
1995 ((display_options & OPT_DISP_SHOW_TIME) ? " @ " : ""), |
d6c70d58a4b2
[gaim-migrate @ 1076]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1063
diff
changeset
|
1996 ((display_options & OPT_DISP_SHOW_TIME) ? date() : "")); |
d6c70d58a4b2
[gaim-migrate @ 1076]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1063
diff
changeset
|
1997 write_to_conv(c, tmp, WFLAG_SYSTEM, NULL); |
d6c70d58a4b2
[gaim-migrate @ 1076]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1063
diff
changeset
|
1998 } |
d6c70d58a4b2
[gaim-migrate @ 1076]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1063
diff
changeset
|
1999 } |
1661
6cea395b627d
[gaim-migrate @ 1671]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1634
diff
changeset
|
2000 bs->sound = 2; |
1098
b335c0ce305e
[gaim-migrate @ 1108]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1097
diff
changeset
|
2001 } else if (bs->log_timer == 0) { |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
2002 if (gc->prpl->list_icon) |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
2003 xpm = (*gc->prpl->list_icon)(b->uc); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
2004 if (xpm == NULL) |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
2005 xpm = (char **)no_icon_xpm; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
2006 pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm, NULL, xpm); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
2007 gtk_widget_hide(bs->pix); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
2008 gtk_pixmap_set(GTK_PIXMAP(bs->pix), pm, bm); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
2009 gtk_widget_show(bs->pix); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
2010 if (ticker_prefs & OPT_DISP_SHOW_BUDDYTICKER) |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
2011 BuddyTickerSetPixmap(b->name, pm, bm); |
644
b3900e312d8e
[gaim-migrate @ 654]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
608
diff
changeset
|
2012 gdk_pixmap_unref(pm); |
804
17def2bb9720
[gaim-migrate @ 814]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
803
diff
changeset
|
2013 gdk_bitmap_unref(bm); |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
2014 } |
1058
4927ce25d8cc
[gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
2015 update_idle_time(bs); |
1 | 2016 } else { |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
2017 gs = find_group_show(g->name); |
1061
04cce2035541
[gaim-migrate @ 1071]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1058
diff
changeset
|
2018 if (!gs) return; |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
2019 bs = find_buddy_show(gs, b->name); |
1061
04cce2035541
[gaim-migrate @ 1071]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1058
diff
changeset
|
2020 if (!bs) return; |
1097
40189d5443c0
[gaim-migrate @ 1107]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1095
diff
changeset
|
2021 if (!bs->connlist) return; /* we won't do signoff updates for |
40189d5443c0
[gaim-migrate @ 1107]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1095
diff
changeset
|
2022 buddies that have already signed |
40189d5443c0
[gaim-migrate @ 1107]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1095
diff
changeset
|
2023 off */ |
1299
18c3874ea051
[gaim-migrate @ 1309]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1297
diff
changeset
|
2024 if (bs->sound != 1) |
18c3874ea051
[gaim-migrate @ 1309]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1297
diff
changeset
|
2025 play_sound(BUDDY_LEAVE); |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
2026 |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
2027 bs->connlist = g_slist_remove(bs->connlist, gc); |
1032
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
2028 if (bs->log_timer > 0) |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
2029 gtk_timeout_remove(bs->log_timer); |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
2030 bs->log_timer = gtk_timeout_add(10000, (GtkFunction)log_timeout, bs); |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1103
diff
changeset
|
2031 update_num_group(gs); |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
2032 pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm, NULL, logout_icon_xpm); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
2033 gtk_widget_hide(bs->pix); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
2034 gtk_pixmap_set(GTK_PIXMAP(bs->pix), pm, bm); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
2035 gtk_widget_show(bs->pix); |
1066
d6c70d58a4b2
[gaim-migrate @ 1076]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1063
diff
changeset
|
2036 if (ticker_prefs & OPT_DISP_SHOW_BUDDYTICKER) { |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
2037 BuddyTickerSetPixmap(b->name, pm, bm); |
1066
d6c70d58a4b2
[gaim-migrate @ 1076]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1063
diff
changeset
|
2038 gtk_timeout_add(10000, (GtkFunction)BuddyTickerLogoutTimeout, b->name); |
d6c70d58a4b2
[gaim-migrate @ 1076]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1063
diff
changeset
|
2039 } |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
2040 gdk_pixmap_unref(pm); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
2041 gdk_bitmap_unref(bm); |
1661
6cea395b627d
[gaim-migrate @ 1671]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1634
diff
changeset
|
2042 if ((bs->sound != 1) && (display_options & OPT_DISP_SHOW_LOGON)) { |
1066
d6c70d58a4b2
[gaim-migrate @ 1076]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1063
diff
changeset
|
2043 struct conversation *c = find_conversation(b->name); |
d6c70d58a4b2
[gaim-migrate @ 1076]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1063
diff
changeset
|
2044 if (c) { |
d6c70d58a4b2
[gaim-migrate @ 1076]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1063
diff
changeset
|
2045 char tmp[1024]; |
d6c70d58a4b2
[gaim-migrate @ 1076]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1063
diff
changeset
|
2046 g_snprintf(tmp, sizeof(tmp), _("<HR><B>%s logged out%s%s.</B><BR><HR>"), b->name, |
d6c70d58a4b2
[gaim-migrate @ 1076]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1063
diff
changeset
|
2047 ((display_options & OPT_DISP_SHOW_TIME) ? " @ " : ""), |
d6c70d58a4b2
[gaim-migrate @ 1076]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1063
diff
changeset
|
2048 ((display_options & OPT_DISP_SHOW_TIME) ? date() : "")); |
d6c70d58a4b2
[gaim-migrate @ 1076]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1063
diff
changeset
|
2049 write_to_conv(c, tmp, WFLAG_SYSTEM, NULL); |
d6c70d58a4b2
[gaim-migrate @ 1076]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1063
diff
changeset
|
2050 } |
d6c70d58a4b2
[gaim-migrate @ 1076]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1063
diff
changeset
|
2051 } |
1661
6cea395b627d
[gaim-migrate @ 1671]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1634
diff
changeset
|
2052 |
6cea395b627d
[gaim-migrate @ 1671]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1634
diff
changeset
|
2053 bs->sound = 1; |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
2054 } |
1 | 2055 } |
2056 | |
2057 | |
2058 static void move_blist_window(GtkWidget *w, GdkEventConfigure *e, void *dummy) | |
2059 { | |
2060 int x, y, width, height; | |
2061 int save = 0; | |
1420
9be6790092dc
[gaim-migrate @ 1430]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1413
diff
changeset
|
2062 gdk_window_get_position(blist->window, &x, &y); |
1 | 2063 gdk_window_get_size(blist->window, &width, &height); |
2064 | |
2065 if(e->send_event) { /* Is a position event */ | |
2066 if (blist_pos.x != x || blist_pos.y != y) | |
2067 save = 1; | |
2068 blist_pos.x = x; | |
2069 blist_pos.y = y; | |
2070 } else { /* Is a size event */ | |
1420
9be6790092dc
[gaim-migrate @ 1430]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1413
diff
changeset
|
2071 if (blist_pos.xoff != x || blist_pos.yoff != y || blist_pos.width != width) |
1 | 2072 save = 1; |
1420
9be6790092dc
[gaim-migrate @ 1430]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1413
diff
changeset
|
2073 |
1 | 2074 blist_pos.width = width; |
2075 blist_pos.height = height; | |
1420
9be6790092dc
[gaim-migrate @ 1430]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1413
diff
changeset
|
2076 blist_pos.xoff = x; |
9be6790092dc
[gaim-migrate @ 1430]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1413
diff
changeset
|
2077 blist_pos.yoff = y; |
1 | 2078 } |
2079 | |
2080 if (save) | |
2081 save_prefs(); | |
2082 | |
2083 } | |
2084 | |
2085 | |
2086 /******************************************************************* | |
2087 * | |
2088 * Helper funs for making the menu | |
2089 * | |
2090 *******************************************************************/ | |
2091 | |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1496
diff
changeset
|
2092 void gaim_separator(GtkWidget *menu) |
1 | 2093 { |
2094 GtkWidget *sep, *menuitem; | |
2095 sep = gtk_hseparator_new(); | |
2096 menuitem = gtk_menu_item_new(); | |
2097 gtk_menu_append(GTK_MENU(menu), menuitem); | |
2098 gtk_container_add(GTK_CONTAINER(menuitem), sep); | |
2099 gtk_widget_set_sensitive(menuitem, FALSE); | |
2100 gtk_widget_show(menuitem); | |
2101 gtk_widget_show(sep); | |
2102 } | |
2103 | |
1634
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2104 GtkWidget *gaim_new_item(GtkWidget *menu, const char *str) |
1 | 2105 { |
2106 GtkWidget *menuitem; | |
1634
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2107 GtkWidget *label; |
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2108 |
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2109 menuitem = gtk_menu_item_new(); |
1 | 2110 if (menu) |
2111 gtk_menu_append(GTK_MENU(menu), menuitem); | |
2112 gtk_widget_show(menuitem); | |
1634
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2113 |
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2114 label = gtk_label_new(str); |
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2115 gtk_label_set_pattern(GTK_LABEL(label), "_"); |
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2116 gtk_container_add(GTK_CONTAINER(menuitem), label); |
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2117 gtk_widget_show(label); |
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2118 |
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2119 gtk_widget_add_accelerator(menuitem, "activate-item", accel, str[0], |
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2120 GDK_MOD1_MASK, GTK_ACCEL_LOCKED); |
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2121 gtk_widget_lock_accelerators(menuitem); |
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2122 |
1 | 2123 return menuitem; |
2124 } | |
2125 | |
1634
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2126 GtkWidget *gaim_new_item_with_pixmap(GtkWidget *menu, const char *str, char **xpm, GtkSignalFunc sf, |
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2127 guint accel_key, guint accel_mods, char *mod) |
714 | 2128 { |
2129 GtkWidget *menuitem; | |
2130 GtkWidget *hbox; | |
2131 GtkWidget *label; | |
2132 GtkWidget *pixmap; | |
2133 GdkPixmap *pm; | |
2134 GdkBitmap *mask; | |
2135 | |
2136 menuitem = gtk_menu_item_new(); | |
1634
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2137 if (menu) |
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2138 gtk_menu_append(GTK_MENU(menu), menuitem); |
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2139 if (sf) |
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2140 /* passing 1 is necessary so if we sign off closing the account editor doesn't exit */ |
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2141 gtk_signal_connect(GTK_OBJECT(menuitem), "activate", sf, (void *)1); |
714 | 2142 gtk_widget_show(menuitem); |
2143 | |
2144 /* Create our container */ | |
718 | 2145 hbox = gtk_hbox_new(FALSE, 2); |
1634
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2146 gtk_container_add(GTK_CONTAINER(menuitem), hbox); |
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2147 gtk_widget_show(hbox); |
714 | 2148 |
2149 /* Create our pixmap and pack it */ | |
719
7e5523de52e2
[gaim-migrate @ 729]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
718
diff
changeset
|
2150 gtk_widget_realize(menu->parent); |
714 | 2151 pm = gdk_pixmap_create_from_xpm_d(menu->parent->window, &mask, NULL, xpm); |
2152 pixmap = gtk_pixmap_new(pm, mask); | |
2153 gtk_widget_show(pixmap); | |
803
7f75b17d4e14
[gaim-migrate @ 813]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
801
diff
changeset
|
2154 gdk_pixmap_unref(pm); |
804
17def2bb9720
[gaim-migrate @ 814]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
803
diff
changeset
|
2155 gdk_bitmap_unref(mask); |
718 | 2156 gtk_box_pack_start(GTK_BOX(hbox), pixmap, FALSE, FALSE, 2); |
2157 | |
2158 /* Create our label and pack it */ | |
2159 label = gtk_label_new(str); | |
2160 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2); | |
1634
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2161 gtk_widget_show(label); |
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2162 |
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2163 if (mod) { |
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2164 label = gtk_label_new(mod); |
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2165 gtk_box_pack_end(GTK_BOX(hbox), label, FALSE, FALSE, 2); |
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2166 gtk_widget_show(label); |
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2167 } |
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2168 |
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2169 if (accel_key) { |
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2170 gtk_widget_add_accelerator(menuitem, "activate", accel, accel_key, |
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2171 accel_mods, GTK_ACCEL_LOCKED); |
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2172 gtk_widget_lock_accelerators(menuitem); |
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2173 } |
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2174 |
714 | 2175 return menuitem; |
2176 } | |
2177 | |
1 | 2178 |
2179 | |
696
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
2180 void build_imchat_box(gboolean on) |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
2181 { |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
2182 if (on) { |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
2183 if (imchatbox) return; |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
2184 |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
2185 imbutton = gtk_button_new_with_label(_("IM")); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
2186 infobutton = gtk_button_new_with_label(_("Info")); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
2187 chatbutton = gtk_button_new_with_label(_("Chat")); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
2188 |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
2189 imchatbox = gtk_hbox_new(TRUE, 10); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
2190 |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
2191 if (display_options & OPT_DISP_COOL_LOOK) |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
2192 { |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
2193 gtk_button_set_relief(GTK_BUTTON(imbutton), GTK_RELIEF_NONE); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
2194 gtk_button_set_relief(GTK_BUTTON(infobutton), GTK_RELIEF_NONE); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
2195 gtk_button_set_relief(GTK_BUTTON(chatbutton), GTK_RELIEF_NONE); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
2196 } |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
2197 |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
2198 /* Put the buttons in the hbox */ |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
2199 gtk_widget_show(imbutton); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
2200 gtk_widget_show(chatbutton); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
2201 gtk_widget_show(infobutton); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
2202 |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
2203 gtk_box_pack_start(GTK_BOX(imchatbox), imbutton, TRUE, TRUE, 0); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
2204 gtk_box_pack_start(GTK_BOX(imchatbox), infobutton, TRUE, TRUE, 0); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
2205 gtk_box_pack_start(GTK_BOX(imchatbox), chatbutton, TRUE, TRUE, 0); |
1172 | 2206 gtk_container_border_width(GTK_CONTAINER(imchatbox), 5); |
696
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
2207 |
935
5e6ca3dd4d02
[gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
921
diff
changeset
|
2208 gtk_signal_connect(GTK_OBJECT(imbutton), "clicked", GTK_SIGNAL_FUNC(im_callback), buddies); |
696
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
2209 gtk_signal_connect(GTK_OBJECT(infobutton), "clicked", GTK_SIGNAL_FUNC(info_callback), buddies); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
2210 gtk_signal_connect(GTK_OBJECT(chatbutton), "clicked", GTK_SIGNAL_FUNC(chat_callback), buddies); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
2211 |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
2212 gtk_tooltips_set_tip(tips,infobutton, _("Information on selected Buddy"), "Penguin"); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
2213 gtk_tooltips_set_tip(tips,imbutton, _("Send Instant Message"), "Penguin"); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
2214 gtk_tooltips_set_tip(tips,chatbutton, _("Start/join a Buddy Chat"), "Penguin"); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
2215 |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
2216 gtk_box_pack_start(GTK_BOX(buddypane), imchatbox, FALSE, FALSE, 0); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
2217 |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
2218 gtk_widget_show(imchatbox); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
2219 } else { |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
2220 if (imchatbox) |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
2221 gtk_widget_destroy(imchatbox); |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
2222 imchatbox = NULL; |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
2223 } |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
2224 } |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
2225 |
1 | 2226 |
2227 | |
2228 void show_buddy_list() | |
2229 { | |
2230 | |
2231 /* Build the buddy list, based on *config */ | |
2232 | |
2233 GtkWidget *sw; | |
2234 GtkWidget *menu; | |
798
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
784
diff
changeset
|
2235 #ifdef USE_PERL |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
784
diff
changeset
|
2236 GtkWidget *perlmenu; |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
784
diff
changeset
|
2237 #endif |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1496
diff
changeset
|
2238 #ifdef NO_MULTI |
1 | 2239 GtkWidget *setmenu; |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1496
diff
changeset
|
2240 GtkWidget *findmenu; |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1496
diff
changeset
|
2241 #endif |
1 | 2242 GtkWidget *menubar; |
2243 GtkWidget *vbox; | |
2244 GtkWidget *menuitem; | |
2245 GtkWidget *notebook; | |
2246 GtkWidget *label; | |
2247 GtkWidget *bbox; | |
2248 GtkWidget *tbox; | |
2249 | |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
945
diff
changeset
|
2250 if (blist) { |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
945
diff
changeset
|
2251 gtk_widget_show(blist); |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
945
diff
changeset
|
2252 return; |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
945
diff
changeset
|
2253 } |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
945
diff
changeset
|
2254 |
1 | 2255 |
2256 #ifdef USE_APPLET | |
2257 blist = gtk_window_new(GTK_WINDOW_DIALOG); | |
2258 #else | |
2259 blist = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |
2260 #endif | |
2261 | |
905 | 2262 gtk_window_set_wmclass(GTK_WINDOW(blist), "buddy_list", "Gaim" ); |
2263 | |
1 | 2264 gtk_widget_realize(blist); |
2265 aol_icon(blist->window); | |
2266 | |
2267 gtk_window_set_policy(GTK_WINDOW(blist), TRUE, TRUE, TRUE); | |
1634
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2268 |
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2269 accel = gtk_accel_group_new(); |
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2270 gtk_accel_group_attach(accel, GTK_OBJECT(blist)); |
1 | 2271 |
2272 menubar = gtk_menu_bar_new(); | |
2273 | |
2274 menu = gtk_menu_new(); | |
1634
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2275 gtk_menu_set_accel_group(GTK_MENU(menu), accel); |
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2276 |
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2277 |
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2278 menuitem = gaim_new_item(NULL, _("File")); |
1 | 2279 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), menu); |
2280 gtk_menu_bar_append(GTK_MENU_BAR(menubar), menuitem); | |
2281 | |
1634
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2282 gaim_new_item_with_pixmap(menu, _("Add A Buddy"), add_small_xpm, |
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2283 GTK_SIGNAL_FUNC(add_buddy_callback), 'b', GDK_CONTROL_MASK, "Ctl+B"); |
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2284 gaim_new_item_with_pixmap(menu, _("Join A Chat"), pounce_small_xpm, |
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2285 GTK_SIGNAL_FUNC(chat_callback), 'c', GDK_CONTROL_MASK, "Ctl+C"); |
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2286 gaim_new_item_with_pixmap(menu, _("New Instant Message"), send_small_xpm, |
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2287 GTK_SIGNAL_FUNC(show_im_dialog), 'i', GDK_CONTROL_MASK, "Ctl+I"); |
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2288 |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1496
diff
changeset
|
2289 gaim_separator(menu); |
1634
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2290 |
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2291 gaim_new_item_with_pixmap(menu, _("Import Buddy List"), import_small_xpm, |
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2292 GTK_SIGNAL_FUNC(import_callback), 0, 0, 0); |
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2293 gaim_new_item_with_pixmap(menu, _("Export Buddy List"), export_small_xpm, |
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2294 GTK_SIGNAL_FUNC(export_callback), 0, 0, 0); |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1496
diff
changeset
|
2295 gaim_separator(menu); |
1634
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2296 gaim_new_item_with_pixmap(menu, _("Signoff"), logout_icon_xpm, |
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2297 GTK_SIGNAL_FUNC(signoff_all), 'd', GDK_CONTROL_MASK, "Ctl+D"); |
1 | 2298 |
2299 #ifndef USE_APPLET | |
1634
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2300 gaim_new_item_with_pixmap(menu, _("Quit"), exit_small_xpm, |
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2301 GTK_SIGNAL_FUNC(do_quit), 'q', GDK_CONTROL_MASK, "Ctl+Q"); |
1 | 2302 #else |
1634
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2303 gaim_new_item_with_pixmap(menu, _("Close"), close_small_xpm, |
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2304 GTK_SIGNAL_FUNC(applet_destroy_buddy), 'x', GDK_CONTROL_MASK, "Ctl+X"); |
1 | 2305 #endif |
2306 | |
2307 menu = gtk_menu_new(); | |
2308 | |
1634
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2309 menuitem = gaim_new_item(NULL, _("Tools")); |
1 | 2310 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), menu); |
2311 gtk_menu_bar_append(GTK_MENU_BAR(menubar), menuitem); | |
2312 | |
2313 awaymenu = gtk_menu_new(); | |
1634
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2314 menuitem = gaim_new_item_with_pixmap(menu, _("Away"), away_small_xpm, NULL, 0, 0, 0); |
1 | 2315 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), awaymenu); |
2316 do_away_menu(); | |
2317 | |
2318 bpmenu = gtk_menu_new(); | |
1634
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2319 menuitem = gaim_new_item_with_pixmap(menu, _("Buddy Pounce"), pounce_small_xpm, NULL, 0, 0, 0); |
1 | 2320 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), bpmenu); |
2321 do_bp_menu(); | |
2322 | |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1496
diff
changeset
|
2323 gaim_separator(menu); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1496
diff
changeset
|
2324 |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1496
diff
changeset
|
2325 #ifdef NO_MULTI |
1 | 2326 findmenu = gtk_menu_new(); |
2327 gtk_widget_show(findmenu); | |
801 | 2328 menuitem = gaim_new_item_with_pixmap(menu, _("Search for Buddy"), search_small_xpm, NULL); |
1 | 2329 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), findmenu); |
2330 gtk_widget_show(menuitem); | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
2331 menuitem = gtk_menu_item_new_with_label(_("by Email")); |
1 | 2332 gtk_menu_append(GTK_MENU(findmenu), menuitem); |
2333 gtk_signal_connect(GTK_OBJECT(menuitem), "activate", GTK_SIGNAL_FUNC(show_find_email), NULL); | |
2334 gtk_widget_show(menuitem); | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
2335 menuitem = gtk_menu_item_new_with_label(_("by Dir Info")); |
1 | 2336 gtk_menu_append(GTK_MENU(findmenu), menuitem); |
2337 gtk_signal_connect(GTK_OBJECT(menuitem), "activate", GTK_SIGNAL_FUNC(show_find_info), NULL); | |
2338 gtk_widget_show(menuitem); | |
2339 | |
2340 setmenu = gtk_menu_new(); | |
2341 gtk_widget_show(setmenu); | |
864 | 2342 //menuitem = gaim_new_item(menu, _("Settings"), NULL); |
2343 menuitem = gaim_new_item_with_pixmap(menu, _("Settings"), prefs_small_xpm, NULL); | |
1 | 2344 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), setmenu); |
864 | 2345 //gtk_widget_show(menuitem); |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
2346 menuitem = gtk_menu_item_new_with_label(_("User Info")); |
1 | 2347 gtk_menu_append(GTK_MENU(setmenu), menuitem); |
2348 gtk_signal_connect(GTK_OBJECT(menuitem), "activate", GTK_SIGNAL_FUNC(show_set_info), NULL); | |
2349 gtk_widget_show(menuitem); | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
2350 menuitem = gtk_menu_item_new_with_label(_("Directory Info")); |
1 | 2351 gtk_menu_append(GTK_MENU(setmenu), menuitem); |
2352 gtk_signal_connect(GTK_OBJECT(menuitem), "activate", GTK_SIGNAL_FUNC(show_set_dir), NULL); | |
2353 gtk_widget_show(menuitem); | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
2354 menuitem = gtk_menu_item_new_with_label(_("Change Password")); |
146 | 2355 gtk_menu_append(GTK_MENU(setmenu), menuitem); |
2356 gtk_signal_connect(GTK_OBJECT(menuitem), "activate", GTK_SIGNAL_FUNC(show_change_passwd), NULL); | |
2357 gtk_widget_show(menuitem); | |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1496
diff
changeset
|
2358 #else |
1634
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2359 gaim_new_item_with_pixmap(menu, _("Accounts"), add_small_xpm, |
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2360 GTK_SIGNAL_FUNC(account_editor), 'a', GDK_CONTROL_MASK, "Ctl+A"); |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1496
diff
changeset
|
2361 |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1496
diff
changeset
|
2362 protomenu = gtk_menu_new(); |
1634
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2363 menuitem = gaim_new_item_with_pixmap(menu, _("Protocol Actions"), prefs_small_xpm, NULL, 0, 0, 0); |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1496
diff
changeset
|
2364 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), protomenu); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1496
diff
changeset
|
2365 do_proto_menu(); |
991
3dbc2cd326e2
[gaim-migrate @ 1001]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
2366 #endif |
1 | 2367 |
1634
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2368 gaim_new_item_with_pixmap(menu, _("Preferences"), prefs_small_xpm, |
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2369 GTK_SIGNAL_FUNC(show_prefs), 'p', GDK_CONTROL_MASK, "Ctl+P"); |
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2370 gaim_new_item_with_pixmap(menu, _("View System Log"), prefs_small_xpm, |
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2371 GTK_SIGNAL_FUNC(show_syslog), 0, 0, 0); |
90
f5b305c0d974
[gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
87
diff
changeset
|
2372 |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1496
diff
changeset
|
2373 gaim_separator(menu); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1496
diff
changeset
|
2374 |
152
cb0d3ec5a4c8
[gaim-migrate @ 162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
150
diff
changeset
|
2375 #ifdef GAIM_PLUGINS |
1634
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2376 gaim_new_item_with_pixmap(menu, _("Plugins"), plugins_small_xpm, GTK_SIGNAL_FUNC(show_plugins), 0, 0, 0); |
152
cb0d3ec5a4c8
[gaim-migrate @ 162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
150
diff
changeset
|
2377 #endif |
798
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
784
diff
changeset
|
2378 #ifdef USE_PERL |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
784
diff
changeset
|
2379 perlmenu = gtk_menu_new(); |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
784
diff
changeset
|
2380 gtk_widget_show(perlmenu); |
1634
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2381 menuitem = gaim_new_item_with_pixmap(menu, _("Perl"), plugins_small_xpm, NULL, 0, 0, 0); |
798
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
784
diff
changeset
|
2382 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), perlmenu); |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
784
diff
changeset
|
2383 gtk_widget_show(menuitem); |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
784
diff
changeset
|
2384 menuitem = gtk_menu_item_new_with_label(_("Load Script")); |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
784
diff
changeset
|
2385 gtk_menu_append(GTK_MENU(perlmenu), menuitem); |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
784
diff
changeset
|
2386 gtk_signal_connect(GTK_OBJECT(menuitem), "activate", GTK_SIGNAL_FUNC(load_perl_script), NULL); |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
784
diff
changeset
|
2387 gtk_widget_show(menuitem); |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
784
diff
changeset
|
2388 menuitem = gtk_menu_item_new_with_label(_("Unload All Scripts")); |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
784
diff
changeset
|
2389 gtk_menu_append(GTK_MENU(perlmenu), menuitem); |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
784
diff
changeset
|
2390 gtk_signal_connect(GTK_OBJECT(menuitem), "activate", GTK_SIGNAL_FUNC(unload_perl_scripts), NULL); |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
784
diff
changeset
|
2391 gtk_widget_show(menuitem); |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
784
diff
changeset
|
2392 menuitem = gtk_menu_item_new_with_label(_("List Scripts")); |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
784
diff
changeset
|
2393 gtk_menu_append(GTK_MENU(perlmenu), menuitem); |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
784
diff
changeset
|
2394 gtk_signal_connect(GTK_OBJECT(menuitem), "activate", GTK_SIGNAL_FUNC(list_perl_scripts), NULL); |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
784
diff
changeset
|
2395 gtk_widget_show(menuitem); |
9dc39872e1f9
[gaim-migrate @ 808]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
784
diff
changeset
|
2396 #endif |
90
f5b305c0d974
[gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
87
diff
changeset
|
2397 |
1 | 2398 menu = gtk_menu_new(); |
2399 | |
1634
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2400 menuitem = gaim_new_item(NULL, _("Help")); |
1 | 2401 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), menu); |
2402 gtk_menu_item_right_justify(GTK_MENU_ITEM(menuitem)); | |
2403 gtk_menu_bar_append(GTK_MENU_BAR(menubar), menuitem); | |
2404 | |
1634
d029dc28a61e
[gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1625
diff
changeset
|
2405 gaim_new_item_with_pixmap(menu, _("About Gaim"), about_small_xpm, show_about, GDK_F1, 0, NULL); |
1 | 2406 |
2407 gtk_widget_show(menubar); | |
2408 | |
1625
8c92ea5d854f
[gaim-migrate @ 1635]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1594
diff
changeset
|
2409 vbox = gtk_vbox_new(FALSE, 0); |
1 | 2410 |
2411 notebook = gtk_notebook_new(); | |
2412 | |
2413 | |
2414 | |
2415 | |
2416 /* Do buddy list stuff */ | |
1172 | 2417 /* FIXME: spacing on both panes is ad hoc */ |
2418 buddypane = gtk_vbox_new(FALSE, 1); | |
1 | 2419 |
2420 buddies = gtk_tree_new(); | |
2421 sw = gtk_scrolled_window_new(NULL, NULL); | |
2422 | |
2423 tips = gtk_tooltips_new(); | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
2424 gtk_object_set_data(GTK_OBJECT(blist), _("Buddy List"), tips); |
1 | 2425 |
2426 /* Now the buddy list */ | |
2427 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(sw),buddies); | |
2428 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), | |
2429 GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC); | |
2430 gtk_widget_set_usize(sw,200,200); | |
2431 gtk_widget_show(buddies); | |
2432 gtk_widget_show(sw); | |
2433 | |
2434 gtk_box_pack_start(GTK_BOX(buddypane), sw, TRUE, TRUE, 0); | |
2435 gtk_widget_show(buddypane); | |
2436 | |
696
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
2437 if (!(display_options & OPT_DISP_NO_BUTTONS)) |
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
689
diff
changeset
|
2438 build_imchat_box(TRUE); |
1 | 2439 |
2440 | |
2441 /* Swing the edit buddy */ | |
1172 | 2442 editpane = gtk_vbox_new(FALSE, 1); |
1 | 2443 |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
2444 addbutton = gtk_button_new_with_label(_("Add")); |
577
aa9a8bcddd80
[gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
544
diff
changeset
|
2445 groupbutton = gtk_button_new_with_label(_("Group")); |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
2446 rembutton = gtk_button_new_with_label(_("Remove")); |
535
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
515
diff
changeset
|
2447 |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
515
diff
changeset
|
2448 if (display_options & OPT_DISP_COOL_LOOK) |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
515
diff
changeset
|
2449 { |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
515
diff
changeset
|
2450 gtk_button_set_relief(GTK_BUTTON(addbutton), GTK_RELIEF_NONE); |
577
aa9a8bcddd80
[gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
544
diff
changeset
|
2451 gtk_button_set_relief(GTK_BUTTON(groupbutton), GTK_RELIEF_NONE); |
535
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
515
diff
changeset
|
2452 gtk_button_set_relief(GTK_BUTTON(rembutton), GTK_RELIEF_NONE); |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
515
diff
changeset
|
2453 } |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
515
diff
changeset
|
2454 |
1 | 2455 edittree = gtk_ctree_new(1, 0); |
2456 gtk_ctree_set_line_style (GTK_CTREE(edittree), GTK_CTREE_LINES_SOLID); | |
2457 gtk_ctree_set_expander_style(GTK_CTREE(edittree), GTK_CTREE_EXPANDER_SQUARE); | |
2458 gtk_clist_set_reorderable(GTK_CLIST(edittree), TRUE); | |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
2459 gtk_signal_connect(GTK_OBJECT(edittree), "button_press_event", |
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1376
diff
changeset
|
2460 GTK_SIGNAL_FUNC(click_edit_tree), NULL); |
1 | 2461 |
2462 gtk_ctree_set_drag_compare_func (GTK_CTREE(edittree), | |
2463 (GtkCTreeCompareDragFunc)edit_drag_compare_func); | |
2464 | |
2465 | |
2466 gtk_signal_connect_after (GTK_OBJECT (edittree), "tree_move", | |
2467 GTK_SIGNAL_FUNC (edit_tree_move), NULL); | |
2468 | |
2469 | |
1172 | 2470 bbox = gtk_hbox_new(TRUE, 5); |
2471 gtk_container_set_border_width(GTK_CONTAINER(bbox), 5); | |
1 | 2472 tbox = gtk_scrolled_window_new(NULL, NULL); |
2473 /* Put the buttons in the box */ | |
577
aa9a8bcddd80
[gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
544
diff
changeset
|
2474 gtk_box_pack_start(GTK_BOX(bbox), addbutton, TRUE, TRUE, 0); |
aa9a8bcddd80
[gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
544
diff
changeset
|
2475 gtk_box_pack_start(GTK_BOX(bbox), groupbutton, TRUE, TRUE, 0); |
aa9a8bcddd80
[gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
544
diff
changeset
|
2476 gtk_box_pack_start(GTK_BOX(bbox), rembutton, TRUE, TRUE, 0); |
1 | 2477 |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
2478 gtk_tooltips_set_tip(tips, addbutton, _("Add a new Buddy"), "Penguin"); |
577
aa9a8bcddd80
[gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
544
diff
changeset
|
2479 gtk_tooltips_set_tip(tips, groupbutton, _("Add a new Group"), "Penguin"); |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
2480 gtk_tooltips_set_tip(tips, rembutton, _("Remove selected Buddy"), "Penguin"); |
1 | 2481 |
2482 /* And the boxes in the box */ | |
1172 | 2483 gtk_box_pack_start(GTK_BOX(editpane), tbox, TRUE, TRUE, 0); |
2484 gtk_box_pack_start(GTK_BOX(editpane), bbox, FALSE, FALSE, 0); | |
1 | 2485 |
2486 /* Handle closes right */ | |
2487 | |
2488 | |
2489 | |
2490 /* Finish up */ | |
2491 gtk_widget_show(addbutton); | |
577
aa9a8bcddd80
[gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
544
diff
changeset
|
2492 gtk_widget_show(groupbutton); |
1 | 2493 gtk_widget_show(rembutton); |
2494 gtk_widget_show(edittree); | |
2495 gtk_widget_show(tbox); | |
2496 gtk_widget_show(bbox); | |
2497 gtk_widget_show(editpane); | |
2498 | |
2499 | |
535
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
515
diff
changeset
|
2500 |
703
20553b584ccb
[gaim-migrate @ 713]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
700
diff
changeset
|
2501 update_button_pix(); |
20553b584ccb
[gaim-migrate @ 713]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
700
diff
changeset
|
2502 |
1 | 2503 |
2504 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
2505 label = gtk_label_new(_("Online")); |
1 | 2506 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), buddypane, label); |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
2507 label = gtk_label_new(_("Edit Buddies")); |
1 | 2508 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), editpane, label); |
2509 | |
2510 gtk_widget_show_all(notebook); | |
2511 | |
2512 /* Pack things in the vbox */ | |
2513 gtk_widget_show(vbox); | |
2514 | |
2515 | |
2516 gtk_widget_show(notebook); | |
2517 | |
2518 /* Enable buttons */ | |
2519 | |
2520 gtk_signal_connect(GTK_OBJECT(rembutton), "clicked", GTK_SIGNAL_FUNC(do_del_buddy), edittree); | |
2521 gtk_signal_connect(GTK_OBJECT(addbutton), "clicked", GTK_SIGNAL_FUNC(add_buddy_callback), NULL); | |
577
aa9a8bcddd80
[gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
544
diff
changeset
|
2522 gtk_signal_connect(GTK_OBJECT(groupbutton), "clicked", GTK_SIGNAL_FUNC(add_group_callback), NULL); |
1 | 2523 gtk_box_pack_start(GTK_BOX(vbox), menubar, FALSE, TRUE, 0); |
2524 gtk_box_pack_start(GTK_BOX(vbox), notebook, TRUE, TRUE, 0); | |
2525 | |
2526 gtk_container_add(GTK_CONTAINER(blist), vbox); | |
2527 | |
2528 #ifndef USE_APPLET | |
2529 gtk_signal_connect(GTK_OBJECT(blist), "delete_event", GTK_SIGNAL_FUNC(do_quit), blist); | |
2530 #else | |
2531 gtk_signal_connect(GTK_OBJECT(blist), "delete_event", GTK_SIGNAL_FUNC(applet_destroy_buddy), NULL); | |
2532 #endif | |
2533 | |
2534 gtk_signal_connect(GTK_OBJECT(blist), "configure_event", GTK_SIGNAL_FUNC(move_blist_window), NULL); | |
2535 | |
2536 | |
2537 | |
2538 /* The edit tree */ | |
2539 gtk_container_add(GTK_CONTAINER(tbox), edittree); | |
2540 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(tbox), | |
2541 GTK_POLICY_NEVER,GTK_POLICY_AUTOMATIC); | |
2542 | |
2543 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
2544 gtk_window_set_title(GTK_WINDOW(blist), _("Gaim - Buddy List")); |
1 | 2545 |
2546 if (general_options & OPT_GEN_SAVED_WINDOWS) { | |
2547 if (blist_pos.width != 0) { /* Sanity check! */ | |
1420
9be6790092dc
[gaim-migrate @ 1430]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1413
diff
changeset
|
2548 gtk_widget_set_uposition(blist, blist_pos.x - blist_pos.xoff, |
9be6790092dc
[gaim-migrate @ 1430]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1413
diff
changeset
|
2549 blist_pos.y - blist_pos.yoff); |
1 | 2550 gtk_widget_set_usize(blist, blist_pos.width, blist_pos.height); |
2551 } | |
2552 } | |
2553 } | |
2554 | |
2555 void refresh_buddy_window() | |
2556 { | |
2557 build_edit_tree(); | |
2558 | |
2559 update_button_pix(); | |
2560 gtk_widget_show(blist); | |
2561 } | |
2562 | |
1333
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2563 void parse_toc_buddy_list(struct gaim_connection *gc, char *config, int from_do_import) |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2564 { |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2565 char *c; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2566 char current[256]; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2567 char *name; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2568 GList *bud; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2569 int how_many = 0; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2570 |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2571 bud = NULL; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2572 |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2573 if (config != NULL) { |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2574 |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2575 /* skip "CONFIG:" (if it exists) */ |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2576 c = strncmp(config + 6 /* sizeof(struct sflap_hdr) */, "CONFIG:", strlen("CONFIG:")) ? |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2577 strtok(config, "\n") : |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2578 strtok(config + 6 /* sizeof(struct sflap_hdr) */ + strlen("CONFIG:"), "\n"); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2579 do { |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2580 if (c == NULL) |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2581 break; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2582 if (*c == 'g') { |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2583 strncpy(current, c + 2, sizeof(current)); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2584 add_group(gc, current); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2585 how_many++; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2586 } else if (*c == 'b' && !find_buddy(gc, c + 2)) { |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2587 char nm[80], sw[80], *tmp = c + 2; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2588 int i = 0; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2589 while (*tmp != ':' && *tmp) |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2590 nm[i++] = *tmp++; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2591 if (*tmp == ':') |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2592 *tmp++ = '\0'; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2593 nm[i] = '\0'; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2594 i = 0; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2595 while (*tmp) |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2596 sw[i++] = *tmp++; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2597 sw[i] = '\0'; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2598 if (!find_buddy(gc, nm)) |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2599 add_buddy(gc, current, nm, sw); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2600 how_many++; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2601 |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2602 bud = g_list_append(bud, c + 2); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2603 } else if (*c == 'p') { |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2604 GSList *d = gc->permit; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2605 char *n; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2606 name = g_malloc(strlen(c + 2) + 2); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2607 g_snprintf(name, strlen(c + 2) + 1, "%s", c + 2); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2608 n = g_strdup(normalize(name)); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2609 while (d) { |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2610 if (!strcasecmp(n, normalize(d->data))) |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2611 break; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2612 d = d->next; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2613 } |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2614 g_free(n); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2615 if (!d) |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2616 gc->permit = g_slist_append(gc->permit, name); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2617 } else if (*c == 'd') { |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2618 GSList *d = gc->deny; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2619 char *n; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2620 name = g_malloc(strlen(c + 2) + 2); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2621 g_snprintf(name, strlen(c + 2) + 1, "%s", c + 2); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2622 n = g_strdup(normalize(name)); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2623 while (d) { |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2624 if (!strcasecmp(n, normalize(d->data))) |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2625 break; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2626 d = d->next; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2627 } |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2628 g_free(n); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2629 if (!d) |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2630 gc->deny = g_slist_append(gc->deny, name); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2631 } else if (!strncmp("toc", c, 3)) { |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2632 sscanf(c + strlen(c) - 1, "%d", &gc->permdeny); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2633 debug_printf("permdeny: %d\n", gc->permdeny); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2634 if (gc->permdeny == 0) |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2635 gc->permdeny = 1; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2636 } else if (*c == 'm') { |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2637 sscanf(c + 2, "%d", &gc->permdeny); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2638 debug_printf("permdeny: %d\n", gc->permdeny); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2639 if (gc->permdeny == 0) |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2640 gc->permdeny = 1; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2641 } |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2642 } while ((c = strtok(NULL, "\n"))); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2643 #if 0 |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2644 fprintf(stdout, "Sending message '%s'\n", buf); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2645 #endif |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2646 |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2647 if (bud != NULL) |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2648 serv_add_buddies(gc, bud); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2649 serv_set_permit_deny(gc); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2650 if (blist) { |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2651 build_edit_tree(); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2652 } |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2653 } |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2654 |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2655 /* perhaps the server dropped the buddy list, try importing from |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2656 cache */ |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2657 |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2658 if (how_many == 0 && !from_do_import) { |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2659 do_import((GtkWidget *)NULL, gc); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2660 } else if (gc && (bud_list_cache_exists(gc) == FALSE)) { |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2661 do_export((GtkWidget *)NULL, 0); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2662 } |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2663 } |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2664 |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2665 void toc_build_config(struct gaim_connection *gc, char *s, int len, gboolean show) |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2666 { |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2667 GSList *grp = gc->groups; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2668 GSList *mem; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2669 struct group *g; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2670 struct buddy *b; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2671 GSList *plist = gc->permit; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2672 GSList *dlist = gc->deny; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2673 |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2674 int pos = 0; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2675 |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2676 if (!gc->permdeny) |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2677 gc->permdeny = 1; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2678 |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2679 pos += g_snprintf(&s[pos], len - pos, "m %d\n", gc->permdeny); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2680 while (grp) { |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2681 g = (struct group *)grp->data; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2682 pos += g_snprintf(&s[pos], len - pos, "g %s\n", g->name); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2683 mem = g->members; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2684 while (mem) { |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2685 b = (struct buddy *)mem->data; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2686 pos += g_snprintf(&s[pos], len - pos, "b %s%s%s\n", b->name, |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2687 show ? ":" : "", show ? b->show : ""); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2688 mem = mem->next; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2689 } |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2690 grp = g_slist_next(grp); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2691 } |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2692 |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2693 while (plist) { |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2694 pos += g_snprintf(&s[pos], len - pos, "p %s\n", (char *)plist->data); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2695 plist = plist->next; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2696 } |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2697 |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2698 while (dlist) { |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2699 pos += g_snprintf(&s[pos], len - pos, "d %s\n", (char *)dlist->data); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2700 dlist = dlist->next; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2701 } |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
2702 } |