Mercurial > pidgin.yaz
annotate src/buddy.c @ 572:faca21605e1b
[gaim-migrate @ 582]
no no no! :)
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Tue, 01 Aug 2000 22:59:00 +0000 |
parents | 53a85529d670 |
children | aa9a8bcddd80 |
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> | |
84 | 28 #include "gnome_applet_mgr.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> | |
38 | |
39 #include <gtk/gtk.h> | |
40 #include <gdk/gdkx.h> | |
41 #include "gaim.h" | |
513
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
42 #include <aim.h> |
1 | 43 #include "pixmaps/admin_icon.xpm" |
44 #include "pixmaps/aol_icon.xpm" | |
45 #include "pixmaps/free_icon.xpm" | |
46 #include "pixmaps/dt_icon.xpm" | |
47 #include "pixmaps/no_icon.xpm" | |
48 #include "pixmaps/login_icon.xpm" | |
49 #include "pixmaps/logout_icon.xpm" | |
50 | |
51 #include "pixmaps/buddyadd.xpm" | |
52 #include "pixmaps/buddydel.xpm" | |
53 #include "pixmaps/buddychat.xpm" | |
54 #include "pixmaps/im.xpm" | |
55 #include "pixmaps/info.xpm" | |
56 #include "pixmaps/permadd.xpm" | |
57 #include "pixmaps/permdel.xpm" | |
58 #include "pixmaps/away_icon.xpm" | |
59 | |
150
d4e99c17e399
[gaim-migrate @ 160]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
146
diff
changeset
|
60 #include "pixmaps/daemon-buddyadd.xpm" |
d4e99c17e399
[gaim-migrate @ 160]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
146
diff
changeset
|
61 #include "pixmaps/daemon-buddydel.xpm" |
d4e99c17e399
[gaim-migrate @ 160]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
146
diff
changeset
|
62 #include "pixmaps/daemon-buddychat.xpm" |
d4e99c17e399
[gaim-migrate @ 160]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
146
diff
changeset
|
63 #include "pixmaps/daemon-im.xpm" |
d4e99c17e399
[gaim-migrate @ 160]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
146
diff
changeset
|
64 #include "pixmaps/daemon-info.xpm" |
d4e99c17e399
[gaim-migrate @ 160]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
146
diff
changeset
|
65 #include "pixmaps/daemon-permadd.xpm" |
d4e99c17e399
[gaim-migrate @ 160]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
146
diff
changeset
|
66 #include "pixmaps/daemon-permdel.xpm" |
d4e99c17e399
[gaim-migrate @ 160]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
146
diff
changeset
|
67 |
1 | 68 static GtkTooltips *tips; |
69 static GtkWidget *editpane; | |
70 static GtkWidget *buddypane; | |
71 static GtkWidget *permitpane; | |
72 static GtkWidget *edittree; | |
73 static GtkWidget *permtree; | |
74 static GtkWidget *imbutton, *infobutton, *chatbutton; | |
75 static GtkWidget *addbutton, *rembutton; | |
76 static GtkWidget *addpermbutton, *rempermbutton; | |
77 static GtkWidget *lagometer = NULL; | |
78 static GtkWidget *lagometer_box = NULL; | |
79 | |
80 static int last_lag_us; | |
81 | |
436 | 82 extern int ticker_prefs; |
1 | 83 |
84 GtkWidget *blist = NULL; | |
85 GtkWidget *bpmenu; | |
86 GtkWidget *buddies; | |
87 int permdeny; | |
88 | |
430 | 89 void BuddyTickerLogonTimeout( gpointer data ); |
90 void BuddyTickerLogoutTimeout( gpointer data ); | |
1 | 91 |
92 /* Predefine some functions */ | |
93 static void new_bp_callback(GtkWidget *w, char *name); | |
94 static void log_callback(GtkWidget *w, char *name); | |
95 | |
96 | |
97 void destroy_buddy() | |
98 { | |
99 if (blist) | |
100 gtk_widget_destroy(blist); | |
101 blist=NULL; | |
10 | 102 #ifdef USE_APPLET |
103 buddy_created = FALSE; | |
104 #endif | |
1 | 105 } |
106 | |
107 void update_num_groups() | |
108 { | |
109 GList *grp = groups; | |
110 GList *mem; | |
111 struct buddy *b; | |
112 struct group *g; | |
113 int pres, total; | |
114 char buf[BUF_LONG]; | |
115 | |
342
f4fba304b236
[gaim-migrate @ 352]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
116 #ifndef USE_APPLET |
1 | 117 if (!(display_options & OPT_DISP_SHOW_GRPNUM)) |
118 return; | |
342
f4fba304b236
[gaim-migrate @ 352]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
119 #else |
f4fba304b236
[gaim-migrate @ 352]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
120 int onl = 0; |
f4fba304b236
[gaim-migrate @ 352]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
121 int all = 0; |
f4fba304b236
[gaim-migrate @ 352]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
122 #endif |
1 | 123 |
124 while(grp) { | |
125 g = (struct group *)grp->data; | |
126 mem = g->members; | |
127 pres = 0; | |
128 total = 0; | |
129 while(mem) { | |
130 b = (struct buddy *)mem->data; | |
131 if (b->present) | |
132 pres++; | |
133 total++; | |
134 | |
135 | |
136 mem = mem->next; | |
137 } | |
138 | |
139 g_snprintf(buf, sizeof(buf), "%s (%d/%d)", g->name, pres, total); | |
140 | |
342
f4fba304b236
[gaim-migrate @ 352]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
141 #ifdef USE_APPLET |
f4fba304b236
[gaim-migrate @ 352]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
142 onl += pres; |
f4fba304b236
[gaim-migrate @ 352]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
143 all += total; |
f4fba304b236
[gaim-migrate @ 352]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
144 if (display_options & OPT_DISP_SHOW_GRPNUM) |
f4fba304b236
[gaim-migrate @ 352]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
145 #endif |
1 | 146 gtk_label_set(GTK_LABEL(g->label), buf); |
147 grp = grp->next; | |
148 } | |
342
f4fba304b236
[gaim-migrate @ 352]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
149 #ifdef USE_APPLET |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
150 g_snprintf(buf, sizeof(buf), _("%d/%d Buddies Online"), onl, all); |
342
f4fba304b236
[gaim-migrate @ 352]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
151 applet_set_tooltips(buf); |
f4fba304b236
[gaim-migrate @ 352]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
152 #endif |
1 | 153 } |
154 | |
155 void update_show_idlepix() | |
156 { | |
157 GList *grp = groups; | |
158 GList *mem; | |
159 struct group *g; | |
160 struct buddy *b; | |
161 | |
162 while (grp) { | |
163 g = (struct group *)grp->data; | |
164 mem = g->members; | |
165 | |
166 while(mem) { | |
167 b = (struct buddy *)mem->data; | |
168 | |
169 if (display_options & OPT_DISP_SHOW_IDLETIME) | |
170 gtk_widget_show(b->idletime); | |
171 else | |
172 gtk_widget_hide(b->idletime); | |
173 | |
174 if (display_options & OPT_DISP_SHOW_PIXMAPS) | |
175 gtk_widget_show(b->pix); | |
176 else | |
177 gtk_widget_hide(b->pix); | |
178 mem = mem->next; | |
179 } | |
180 grp = grp->next; | |
181 } | |
182 } | |
183 | |
184 void update_all_buddies() | |
185 { | |
186 GList *grp = groups; | |
187 GList *mem; | |
188 struct buddy *b; | |
189 struct group *g; | |
190 | |
191 while(grp) { | |
192 g = (struct group *)grp->data; | |
193 mem = g->members; | |
194 while(mem) { | |
195 b = (struct buddy *)mem->data; | |
196 | |
59 | 197 if (b->present || !GTK_WIDGET_VISIBLE(b->item)) |
198 set_buddy(b); | |
1 | 199 |
200 mem = mem->next; | |
201 } | |
202 grp = grp->next; | |
203 } | |
204 | |
205 | |
206 } | |
207 | |
208 void update_lagometer(int us) | |
209 { | |
210 double pct; | |
211 | |
212 | |
213 | |
214 if (us != -1) | |
215 last_lag_us = us; | |
216 | |
217 | |
218 if (lagometer_box == NULL) | |
219 return; | |
220 | |
221 | |
222 if (!(general_options & OPT_GEN_SHOW_LAGMETER)) | |
223 gtk_widget_hide(lagometer_box); | |
224 else | |
225 gtk_widget_show(lagometer_box); | |
226 | |
227 | |
228 pct = last_lag_us/100000; | |
6 | 229 |
230 if (pct > 0) | |
231 pct = 25 * log(pct); | |
1 | 232 |
233 if (pct < 0) | |
234 pct = 0; | |
235 | |
236 if (pct > 100) | |
237 pct = 100; | |
238 | |
239 | |
240 pct /= 100; | |
241 | |
242 | |
243 gtk_progress_bar_update(GTK_PROGRESS_BAR(lagometer), pct); | |
244 } | |
245 | |
246 static void adjust_pic(GtkWidget *button, const char *c, gchar **xpm) | |
247 { | |
248 GdkPixmap *pm; | |
249 GdkBitmap *bm; | |
250 GtkWidget *pic; | |
251 GtkWidget *label; | |
252 | |
253 /*if the user had opted to put pictures on the buttons*/ | |
254 if (display_options & OPT_DISP_SHOW_BUTTON_XPM) { | |
255 pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm, | |
256 NULL, xpm); | |
257 pic = gtk_pixmap_new(pm, bm); | |
258 gtk_widget_show(pic); | |
259 label = GTK_BIN(button)->child; | |
260 gtk_container_remove(GTK_CONTAINER(button), label); | |
261 gtk_container_add(GTK_CONTAINER(button), pic); | |
262 } else { | |
263 label = gtk_label_new(c); | |
264 gtk_widget_show(label); | |
265 pic = GTK_BIN(button)->child; | |
266 gtk_container_remove(GTK_CONTAINER(button), pic); | |
267 gtk_container_add(GTK_CONTAINER(button), label); | |
268 } | |
269 | |
270 } | |
271 | |
272 | |
273 void update_button_pix() | |
274 { | |
275 | |
150
d4e99c17e399
[gaim-migrate @ 160]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
146
diff
changeset
|
276 if (display_options & OPT_DISP_DEVIL_PIXMAPS) { |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
277 adjust_pic(addbutton, _("Add"), (gchar **)daemon_buddyadd_xpm); |
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
278 adjust_pic(rembutton, _("Remove"), (gchar **)daemon_buddydel_xpm); |
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
279 adjust_pic(chatbutton, _("Chat"), (gchar **)daemon_buddychat_xpm); |
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
280 adjust_pic(imbutton, _("IM"), (gchar **)daemon_im_xpm); |
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
281 adjust_pic(infobutton, _("Info"), (gchar **)daemon_info_xpm); |
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
282 adjust_pic(addpermbutton, _("Add"), (gchar **)daemon_permadd_xpm); |
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
283 adjust_pic(rempermbutton, _("Remove"), (gchar **)daemon_permdel_xpm); |
150
d4e99c17e399
[gaim-migrate @ 160]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
146
diff
changeset
|
284 } else { |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
285 adjust_pic(addbutton, _("Add"), (gchar **)buddyadd_xpm); |
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
286 adjust_pic(rembutton, _("Remove"), (gchar **)buddydel_xpm); |
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
287 adjust_pic(chatbutton, _("Chat"), (gchar **)buddychat_xpm); |
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
288 adjust_pic(imbutton, _("IM"), (gchar **)im_xpm); |
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
289 adjust_pic(infobutton, _("Info"), (gchar **)info_xpm); |
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
290 adjust_pic(addpermbutton, _("Add"), (gchar **)permadd_xpm); |
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
291 adjust_pic(rempermbutton, _("Remove"), (gchar **)permdel_xpm); |
150
d4e99c17e399
[gaim-migrate @ 160]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
146
diff
changeset
|
292 } |
544
53a85529d670
[gaim-migrate @ 554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
535
diff
changeset
|
293 gtk_widget_hide(addbutton->parent); |
53a85529d670
[gaim-migrate @ 554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
535
diff
changeset
|
294 gtk_widget_show(addbutton->parent); |
53a85529d670
[gaim-migrate @ 554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
535
diff
changeset
|
295 gtk_widget_hide(chatbutton->parent); |
53a85529d670
[gaim-migrate @ 554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
535
diff
changeset
|
296 gtk_widget_show(chatbutton->parent); |
53a85529d670
[gaim-migrate @ 554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
535
diff
changeset
|
297 gtk_widget_hide(addpermbutton->parent); |
53a85529d670
[gaim-migrate @ 554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
535
diff
changeset
|
298 gtk_widget_show(addpermbutton->parent); |
1 | 299 } |
300 | |
301 | |
302 | |
303 #ifdef USE_APPLET | |
304 gint applet_destroy_buddy( GtkWidget *widget, GdkEvent *event,gpointer *data ) { | |
305 set_applet_draw_closed(); | |
306 gnome_buddy_hide(); | |
307 return (TRUE); | |
308 } | |
309 | |
310 void gnome_buddy_show(){ | |
311 gtk_widget_show( blist ); | |
312 } | |
313 | |
314 void gnome_buddy_hide(){ | |
315 gtk_widget_hide( blist ); | |
316 } | |
317 | |
318 void gnome_buddy_set_pos( gint x, gint y ){ | |
340
0d9cfc3579a5
[gaim-migrate @ 350]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
319 if (general_options & OPT_GEN_NEAR_APPLET) |
272
6b6cd02de8f9
[gaim-migrate @ 282]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
249
diff
changeset
|
320 gtk_widget_set_uposition ( blist, x, y ); |
340
0d9cfc3579a5
[gaim-migrate @ 350]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
321 else if (general_options & OPT_GEN_SAVED_WINDOWS) |
0d9cfc3579a5
[gaim-migrate @ 350]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
322 gtk_widget_set_uposition(blist, blist_pos.x - blist_pos.xoff, blist_pos.y - blist_pos.yoff); |
1 | 323 } |
324 | |
325 GtkRequisition gnome_buddy_get_dimentions(){ | |
107
55faf2e3a134
[gaim-migrate @ 117]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
326 if (general_options & OPT_GEN_SAVED_WINDOWS) { |
55faf2e3a134
[gaim-migrate @ 117]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
327 GtkRequisition r; |
55faf2e3a134
[gaim-migrate @ 117]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
328 r.width = blist_pos.width; |
55faf2e3a134
[gaim-migrate @ 117]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
329 r.height = blist_pos.height; |
55faf2e3a134
[gaim-migrate @ 117]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
330 return r; |
55faf2e3a134
[gaim-migrate @ 117]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
331 } else { |
55faf2e3a134
[gaim-migrate @ 117]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
332 return blist->requisition; |
55faf2e3a134
[gaim-migrate @ 117]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
333 } |
1 | 334 } |
335 | |
336 #endif | |
337 | |
338 | |
84 | 339 extern enum gaim_user_states MRI_user_status; |
1 | 340 void signoff() |
341 { | |
342 GList *mem; | |
94
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
343 |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
344 #ifdef GAIM_PLUGINS |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
345 GList *c = callbacks; |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
346 struct gaim_callback *g; |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
347 void (*function)(void *); |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
348 while (c) { |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
349 g = (struct gaim_callback *)c->data; |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
350 if (g->event == event_signoff && g->function != NULL) { |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
351 function = g->function; |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
352 (*function)(g->data); |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
353 } |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
354 c = c->next; |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
355 } |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
356 #endif |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
357 |
1 | 358 while(groups) { |
359 mem = ((struct group *)groups->data)->members; | |
360 while(mem) { | |
361 g_free(mem->data); | |
362 mem = g_list_remove(mem, mem->data); | |
363 } | |
364 g_free(groups->data); | |
365 groups = g_list_remove(groups, groups->data); | |
366 } | |
367 | |
368 serv_close(); | |
369 destroy_all_dialogs(); | |
370 destroy_buddy(); | |
371 hide_login_progress(""); | |
372 #ifdef USE_APPLET | |
84 | 373 MRI_user_status = offline; |
1 | 374 set_applet_draw_closed(); |
375 applet_widget_unregister_callback(APPLET_WIDGET(applet),"signoff"); | |
18 | 376 remove_applet_away(); |
1 | 377 applet_widget_register_callback(APPLET_WIDGET(applet), |
378 "signon", | |
379 _("Signon"), | |
342
f4fba304b236
[gaim-migrate @ 352]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
380 applet_do_signon, |
1 | 381 NULL); |
382 #else | |
383 show_login(); | |
384 #endif /* USE_APPLET */ | |
436 | 385 if ( ticker_prefs & OPT_DISP_SHOW_BUDDYTICKER ) |
386 BuddyTickerSignoff(); | |
1 | 387 } |
388 | |
389 void handle_click_group(GtkWidget *widget, GdkEventButton *event, gpointer func_data) | |
390 { | |
391 if (event->type == GDK_2BUTTON_PRESS) { | |
392 if (GTK_TREE_ITEM(widget)->expanded) | |
393 gtk_tree_item_collapse(GTK_TREE_ITEM(widget)); | |
394 else | |
395 gtk_tree_item_expand(GTK_TREE_ITEM(widget)); | |
396 } else { | |
397 } | |
398 } | |
399 | |
400 void pressed_im(GtkWidget *widget, struct buddy *b) | |
401 { | |
402 struct conversation *c; | |
403 | |
404 c = find_conversation(b->name); | |
405 | |
406 if (c != NULL) { | |
87 | 407 gdk_window_show(c->window->window); |
1 | 408 } else { |
409 c = new_conversation(b->name); | |
410 } | |
411 } | |
412 | |
438 | 413 void pressed_ticker(char *buddy) |
414 { | |
415 struct conversation *c; | |
416 | |
417 c = find_conversation(buddy); | |
418 | |
419 if (c != NULL) { | |
420 gdk_window_show(c->window->window); | |
421 } else { | |
422 c = new_conversation(buddy); | |
423 } | |
424 } | |
425 | |
1 | 426 void pressed_info(GtkWidget *widget, struct buddy *b) |
427 { | |
428 serv_get_info(b->name); | |
429 | |
430 } | |
431 | |
432 void pressed_dir_info(GtkWidget *widget, struct buddy *b) | |
433 { | |
434 serv_get_dir(b->name); | |
435 | |
436 } | |
437 | |
249
810c595258c8
[gaim-migrate @ 259]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
228
diff
changeset
|
438 void pressed_away_msg(GtkWidget *widget, struct buddy *b) |
810c595258c8
[gaim-migrate @ 259]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
228
diff
changeset
|
439 { |
810c595258c8
[gaim-migrate @ 259]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
228
diff
changeset
|
440 serv_get_away_msg(b->name); |
810c595258c8
[gaim-migrate @ 259]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
228
diff
changeset
|
441 |
810c595258c8
[gaim-migrate @ 259]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
228
diff
changeset
|
442 } |
810c595258c8
[gaim-migrate @ 259]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
228
diff
changeset
|
443 |
1 | 444 void handle_click_buddy(GtkWidget *widget, GdkEventButton *event, struct buddy *b) |
445 { | |
446 if (event->type == GDK_2BUTTON_PRESS && event->button == 1) { | |
447 struct conversation *c; | |
448 | |
449 c = find_conversation(b->name); | |
450 | |
451 if (c != NULL) { | |
87 | 452 gdk_window_show(c->window->window); |
1 | 453 } else { |
454 c = new_conversation(b->name); | |
455 } | |
456 } else if (event->type == GDK_BUTTON_PRESS && event->button == 3) { | |
457 GtkWidget *menu, *button; | |
458 /* We're gonna make us a menu right here */ | |
459 | |
460 menu = gtk_menu_new(); | |
461 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
462 button = gtk_menu_item_new_with_label(_("IM")); |
1 | 463 gtk_signal_connect(GTK_OBJECT(button), "activate", |
464 GTK_SIGNAL_FUNC(pressed_im), b); | |
465 gtk_menu_append(GTK_MENU(menu), button); | |
466 gtk_widget_show(button); | |
467 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
468 button = gtk_menu_item_new_with_label(_("Info")); |
1 | 469 gtk_signal_connect(GTK_OBJECT(button), "activate", |
470 GTK_SIGNAL_FUNC(pressed_info), b); | |
471 gtk_menu_append(GTK_MENU(menu), button); | |
472 gtk_widget_show(button); | |
473 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
474 button = gtk_menu_item_new_with_label(_("Dir Info")); |
1 | 475 gtk_signal_connect(GTK_OBJECT(button), "activate", |
476 GTK_SIGNAL_FUNC(pressed_dir_info), b); | |
477 gtk_menu_append(GTK_MENU(menu), button); | |
478 gtk_widget_show(button); | |
479 | |
423
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
403
diff
changeset
|
480 if (USE_OSCAR) { |
515
b33ed0a7f49b
[gaim-migrate @ 525]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
514
diff
changeset
|
481 button = gtk_menu_item_new_with_label(_("Direct IM")); |
b33ed0a7f49b
[gaim-migrate @ 525]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
514
diff
changeset
|
482 gtk_signal_connect(GTK_OBJECT(button), "activate", |
b33ed0a7f49b
[gaim-migrate @ 525]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
514
diff
changeset
|
483 GTK_SIGNAL_FUNC(serv_do_imimage), b->name); |
b33ed0a7f49b
[gaim-migrate @ 525]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
514
diff
changeset
|
484 gtk_menu_append(GTK_MENU(menu), button); |
b33ed0a7f49b
[gaim-migrate @ 525]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
514
diff
changeset
|
485 gtk_widget_show(button); |
b33ed0a7f49b
[gaim-migrate @ 525]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
514
diff
changeset
|
486 |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
487 button = gtk_menu_item_new_with_label(_("Away Msg")); |
249
810c595258c8
[gaim-migrate @ 259]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
228
diff
changeset
|
488 gtk_signal_connect(GTK_OBJECT(button), "activate", |
810c595258c8
[gaim-migrate @ 259]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
228
diff
changeset
|
489 GTK_SIGNAL_FUNC(pressed_away_msg), b); |
810c595258c8
[gaim-migrate @ 259]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
228
diff
changeset
|
490 gtk_menu_append(GTK_MENU(menu), button); |
810c595258c8
[gaim-migrate @ 259]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
228
diff
changeset
|
491 gtk_widget_show(button); |
423
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
403
diff
changeset
|
492 } |
249
810c595258c8
[gaim-migrate @ 259]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
228
diff
changeset
|
493 |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
494 button = gtk_menu_item_new_with_label(_("Toggle Logging")); |
1 | 495 gtk_signal_connect(GTK_OBJECT(button), "activate", |
496 GTK_SIGNAL_FUNC(log_callback), b->name); | |
497 gtk_menu_append(GTK_MENU(menu), button); | |
498 gtk_widget_show(button); | |
499 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
500 button = gtk_menu_item_new_with_label(_("Add Buddy Pounce")); |
1 | 501 gtk_signal_connect(GTK_OBJECT(button), "activate", |
502 GTK_SIGNAL_FUNC(new_bp_callback), b->name); | |
503 gtk_menu_append(GTK_MENU(menu), button); | |
504 gtk_widget_show(button); | |
505 | |
506 | |
507 | |
508 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, | |
509 event->button, event->time); | |
510 | |
511 } else if (event->type == GDK_3BUTTON_PRESS && event->button == 2) { | |
512 if (!strcasecmp("zilding", normalize(b->name))) | |
513 show_ee_dialog(0); | |
514 else if (!strcasecmp("robflynn", normalize(b->name))) | |
515 show_ee_dialog(1); | |
516 else if (!strcasecmp("flynorange", normalize(b->name))) | |
517 show_ee_dialog(2); | |
338
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
318
diff
changeset
|
518 else if (!strcasecmp("ewarmenhoven", normalize(b->name))) |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
318
diff
changeset
|
519 show_ee_dialog(3); |
1 | 520 |
521 } else { | |
522 | |
523 /* Anything for other buttons? :) */ | |
524 } | |
525 } | |
526 | |
527 | |
528 | |
529 void remove_buddy(struct group *rem_g, struct buddy *rem_b) | |
530 { | |
531 GList *grp; | |
532 GList *mem; | |
533 | |
534 struct group *delg; | |
535 struct buddy *delb; | |
536 | |
537 grp = g_list_find(groups, rem_g); | |
538 delg = (struct group *)grp->data; | |
539 mem = delg->members; | |
540 | |
541 mem = g_list_find(mem, rem_b); | |
542 delb = (struct buddy *)mem->data; | |
543 | |
544 gtk_tree_remove_items(GTK_TREE(delg->tree), g_list_append(NULL, delb->item)); | |
545 delg->members = g_list_remove(delg->members, delb); | |
546 serv_remove_buddy(delb->name); | |
547 g_free(delb); | |
548 | |
549 serv_save_config(); | |
228 | 550 |
551 // flush buddy list to cache | |
552 | |
553 do_export( (GtkWidget *) NULL, 0 ); | |
1 | 554 |
555 update_num_groups(); | |
556 | |
557 | |
558 } | |
559 | |
560 void remove_group(struct group *rem_g) | |
561 { | |
562 GList *grp; | |
563 GList *mem; | |
564 | |
565 struct group *delg; | |
566 struct buddy *delb; | |
567 | |
568 grp = g_list_find(groups, rem_g); | |
569 delg = (struct group *)grp->data; | |
570 mem = delg->members; | |
571 | |
572 while(delg->members) { | |
573 delb = (struct buddy *)delg->members->data; | |
574 gtk_tree_remove_items(GTK_TREE(delg->tree), g_list_append(NULL, delb->item)); | |
575 delg->members = g_list_remove(delg->members, delb); | |
576 serv_remove_buddy(delb->name); | |
577 g_free(delb); | |
578 } | |
579 | |
580 | |
581 gtk_tree_remove_items(GTK_TREE(buddies), g_list_append(NULL, delg->item)); | |
582 groups = g_list_remove(groups, delg); | |
583 g_free(delg); | |
584 | |
585 serv_save_config(); | |
228 | 586 |
587 // flush buddy list to cache | |
588 | |
589 do_export( (GtkWidget *) NULL, 0 ); | |
1 | 590 } |
591 | |
592 | |
593 | |
594 void build_permit_tree() | |
595 { | |
596 GtkWidget *ti; | |
597 GtkWidget *sub; | |
598 GList *plist = permit; | |
599 GList *dlist = deny; | |
600 | |
601 gtk_tree_clear_items(GTK_TREE(permtree), 0, -1); | |
602 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
603 ti = gtk_tree_item_new_with_label(_("Permit")); |
1 | 604 sub = gtk_tree_new(); |
605 gtk_widget_show(ti); | |
606 gtk_widget_show(sub); | |
607 gtk_tree_prepend(GTK_TREE(permtree), ti); | |
608 gtk_tree_item_set_subtree(GTK_TREE_ITEM(ti), sub); | |
609 gtk_tree_item_expand(GTK_TREE_ITEM(ti)); | |
610 | |
611 while(plist) { | |
612 ti = gtk_tree_item_new_with_label((char *)plist->data); | |
613 gtk_widget_show(ti); | |
614 gtk_tree_prepend(GTK_TREE(sub), ti); | |
615 plist = plist->next; | |
616 } | |
617 | |
618 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
619 ti = gtk_tree_item_new_with_label(_("Deny")); |
1 | 620 sub = gtk_tree_new(); |
621 gtk_widget_show(ti); | |
622 gtk_widget_show(sub); | |
623 gtk_tree_prepend(GTK_TREE(permtree), ti); | |
624 gtk_tree_item_set_subtree(GTK_TREE_ITEM(ti), sub); | |
625 gtk_tree_item_expand(GTK_TREE_ITEM(ti)); | |
626 | |
627 while(dlist) { | |
628 ti = gtk_tree_item_new_with_label((char *)dlist->data); | |
629 gtk_widget_show(ti); | |
630 gtk_tree_prepend(GTK_TREE(sub), ti); | |
631 dlist = dlist->next; | |
632 } | |
633 | |
634 | |
635 } | |
636 | |
637 | |
638 gboolean edit_drag_compare_func (GtkCTree *ctree, GtkCTreeNode *source_node, | |
639 GtkCTreeNode *new_parent, GtkCTreeNode *new_sibling) | |
640 { | |
641 gboolean leaf; | |
642 | |
643 gtk_ctree_get_node_info (ctree, source_node, NULL, | |
644 NULL, NULL, NULL, NULL, NULL, &leaf, NULL); | |
645 | |
646 | |
647 if (leaf) { | |
648 if (!new_parent) | |
649 return FALSE; | |
650 } else { | |
651 | |
652 if (new_parent) | |
653 return FALSE; | |
654 | |
655 } | |
656 | |
657 return TRUE; | |
658 } | |
659 | |
660 | |
661 | |
662 static void edit_tree_move (GtkCTree *ctree, GtkCTreeNode *child, GtkCTreeNode *parent, | |
663 GtkCTreeNode *sibling, gpointer data) | |
664 { | |
665 char *source; | |
666 char *target1; | |
667 char *target2; | |
668 | |
669 gtk_ctree_get_node_info (ctree, child, &source, | |
670 NULL, NULL, NULL, NULL, NULL, NULL, NULL); | |
671 if (parent) | |
672 gtk_ctree_get_node_info (ctree, parent, &target1, | |
673 NULL, NULL, NULL, NULL, NULL, NULL, NULL); | |
674 if (sibling) | |
675 gtk_ctree_get_node_info (ctree, sibling, &target2, | |
676 NULL, NULL, NULL, NULL, NULL, NULL, NULL); | |
677 | |
678 | |
679 if (!parent) { | |
680 GList *grps, *buds; | |
681 struct group *g, *g2; | |
682 GList *tmp; | |
683 int pos; | |
684 struct buddy *b; | |
685 /* Okay we've moved group order... */ | |
686 | |
687 g = find_group(source); | |
688 | |
689 gtk_widget_ref(g->tree); | |
690 | |
691 buds = g->members; | |
692 while(buds) { | |
693 b = (struct buddy *)buds->data; | |
694 gtk_widget_ref(b->item); | |
695 gtk_widget_ref(b->label); | |
696 gtk_widget_ref(b->idletime); | |
697 gtk_widget_ref(b->pix); | |
698 buds = buds->next; | |
699 } | |
700 | |
701 | |
702 | |
703 | |
704 pos = g_list_index(GTK_TREE(buddies)->children, g->item); | |
705 | |
706 tmp = g_list_append(NULL, g->item); | |
707 gtk_tree_remove_items(GTK_TREE(buddies), tmp); | |
708 g_list_free(tmp); | |
709 | |
710 groups = g_list_remove(groups, g); | |
711 | |
712 g->item = gtk_tree_item_new_with_label(g->name); | |
713 gtk_widget_show(g->item); | |
714 | |
715 if (sibling) { | |
716 g2 = find_group(target2); | |
717 pos = g_list_index(groups, g2); | |
718 if (pos == 0) { | |
719 groups = g_list_prepend(groups, g); | |
720 gtk_tree_prepend(GTK_TREE(buddies), g->item); | |
721 } else { | |
722 groups = g_list_insert(groups, g, pos); | |
723 gtk_tree_insert(GTK_TREE(buddies), g->item, pos); | |
724 } | |
725 | |
726 } else { | |
727 groups = g_list_append(groups, g); | |
728 gtk_tree_append(GTK_TREE(buddies), g->item); | |
729 | |
730 } | |
731 | |
732 gtk_tree_item_set_subtree (GTK_TREE_ITEM(g->item), g->tree); | |
733 gtk_tree_item_expand (GTK_TREE_ITEM(g->item)); | |
734 gtk_signal_connect(GTK_OBJECT(g->item), "button_press_event", | |
735 GTK_SIGNAL_FUNC(handle_click_group), | |
736 NULL); | |
737 gtk_object_set_user_data(GTK_OBJECT(g->item), NULL); | |
738 | |
739 gtk_widget_unref(g->tree); | |
740 | |
741 update_num_groups(); | |
742 | |
743 | |
744 buds = g->members; | |
745 | |
746 while(buds) { | |
747 b = (struct buddy *)buds->data; | |
748 set_buddy(b); | |
749 buds = buds->next; | |
750 } | |
751 | |
752 grps = groups; | |
753 while(grps) { | |
754 g = (struct group *)grps->data; | |
755 grps = grps->next; | |
756 } | |
757 | |
758 } else { | |
759 struct group *new_g, *old_g; | |
760 struct buddy *b, *s; | |
761 GtkWidget *gtree; | |
762 GtkWidget *owner; | |
763 GList *temp; | |
764 int pos; | |
765 | |
766 b = find_buddy(source); | |
767 new_g = find_group(target1); | |
768 old_g = find_group_by_buddy(source); | |
769 gtree = old_g->tree; | |
770 if (sibling) | |
771 s = find_buddy(target2); | |
772 else | |
773 s = NULL; | |
774 | |
775 old_g->members = g_list_remove(old_g->members, b); | |
776 | |
777 gtk_widget_ref(b->item); | |
778 gtk_widget_ref(b->label); | |
779 gtk_widget_ref(b->pix); | |
780 gtk_widget_ref(b->idletime); | |
781 gtk_widget_ref(gtree); | |
782 | |
783 owner = GTK_TREE(gtree)->tree_owner; | |
784 | |
785 temp = g_list_append(NULL, b->item); | |
786 gtk_tree_remove_items(GTK_TREE(old_g->tree), temp); | |
787 g_list_free(temp); | |
788 | |
789 if (gtree->parent == NULL){ | |
790 gtk_tree_item_set_subtree (GTK_TREE_ITEM(owner), gtree); | |
791 gtk_tree_item_expand (GTK_TREE_ITEM(owner)); | |
792 } | |
793 | |
794 if (!sibling) { | |
795 gtk_tree_append(GTK_TREE(new_g->tree), b->item); | |
796 new_g->members = g_list_append(new_g->members, b); | |
797 } else { | |
798 pos = g_list_index(new_g->members, s); | |
799 if (pos != 0) { | |
800 new_g->members = g_list_insert(new_g->members, b, pos); | |
801 gtk_tree_insert(GTK_TREE(new_g->tree), b->item, pos); | |
802 } else { | |
803 new_g->members = g_list_prepend(new_g->members, b); | |
804 gtk_tree_prepend(GTK_TREE(new_g->tree), b->item); | |
805 | |
806 } | |
807 } | |
808 | |
809 gtk_widget_unref(b->item); | |
810 gtk_widget_unref(b->label); | |
811 gtk_widget_unref(b->pix); | |
812 gtk_widget_unref(b->idletime); | |
813 gtk_widget_unref(gtree); | |
814 | |
815 gtk_ctree_expand(ctree, parent); | |
816 | |
817 update_num_groups(); | |
818 update_show_idlepix(); | |
819 set_buddy(b); | |
820 | |
821 | |
822 | |
823 | |
824 | |
825 } | |
826 | |
827 serv_save_config(); | |
228 | 828 |
829 // flush buddy list to cache | |
830 | |
831 do_export( (GtkWidget *) NULL, 0 ); | |
1 | 832 } |
833 | |
834 | |
835 | |
836 void build_edit_tree() | |
837 { | |
838 GtkCTreeNode *p = NULL, *n; | |
839 GList *grp = groups; | |
840 GList *mem; | |
841 struct group *g; | |
842 struct buddy *b; | |
843 char *text[1]; | |
844 | |
845 gtk_clist_freeze(GTK_CLIST(edittree)); | |
846 gtk_clist_clear(GTK_CLIST(edittree)); | |
847 | |
848 | |
849 while(grp) { | |
850 g = (struct group *)grp->data; | |
851 | |
852 text[0] = g->name; | |
853 | |
854 p = gtk_ctree_insert_node(GTK_CTREE(edittree), NULL, | |
855 NULL, text, 5, NULL, NULL, | |
856 NULL, NULL, 0, 1); | |
857 | |
858 n = NULL; | |
859 | |
860 mem = g->members; | |
861 | |
862 while(mem) { | |
863 b = (struct buddy *)mem->data; | |
864 | |
865 text[0] = b->name; | |
866 | |
867 n = gtk_ctree_insert_node(GTK_CTREE(edittree), | |
868 p, NULL, text, 5, | |
869 NULL, NULL, | |
870 NULL, NULL, 1, 1); | |
871 | |
872 mem = mem->next; | |
873 | |
874 } | |
875 grp = grp->next; | |
876 } | |
877 | |
878 gtk_clist_thaw(GTK_CLIST(edittree)); | |
879 | |
880 } | |
881 | |
882 struct buddy *add_buddy(char *group, char *buddy) | |
883 { | |
884 struct buddy *b; | |
885 struct group *g; | |
886 GdkPixmap *pm; | |
887 GdkBitmap *bm; | |
888 GtkWidget *box; | |
889 | |
890 | |
891 if ((b = find_buddy(buddy)) != NULL) | |
892 return b; | |
893 | |
894 g = find_group(group); | |
895 | |
896 if (g == NULL) | |
897 g = add_group(group); | |
898 | |
899 b = (struct buddy *)g_new0(struct buddy, 1); | |
900 | |
901 if (!b) | |
902 return NULL; | |
903 | |
904 b->present = 0; | |
905 b->item = gtk_tree_item_new(); | |
906 | |
907 g_snprintf(b->name, sizeof(b->name), "%s", buddy); | |
908 g->members = g_list_append(g->members, b); | |
909 | |
910 | |
911 if (blist == NULL) | |
912 return b; | |
913 | |
914 box = gtk_hbox_new(FALSE, 1); | |
915 pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm, | |
916 NULL, (gchar **)login_icon_xpm); | |
917 b->pix = gtk_pixmap_new(pm, bm); | |
918 | |
919 b->idle = 0; | |
515
b33ed0a7f49b
[gaim-migrate @ 525]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
514
diff
changeset
|
920 b->caps = 0; |
1 | 921 |
922 gtk_widget_show(b->pix); | |
923 | |
924 b->label = gtk_label_new(buddy); | |
925 gtk_misc_set_alignment(GTK_MISC(b->label), 0.0, 0.5); | |
926 | |
927 b->idletime = gtk_label_new(""); | |
928 | |
929 gtk_tree_append(GTK_TREE(g->tree),b->item); | |
930 gtk_container_add(GTK_CONTAINER(b->item), box); | |
931 | |
932 gtk_box_pack_start(GTK_BOX(box), b->pix, FALSE, FALSE, 1); | |
933 gtk_box_pack_start(GTK_BOX(box), b->label, TRUE, TRUE, 1); | |
934 gtk_box_pack_start(GTK_BOX(box), b->idletime, FALSE, FALSE, 1); | |
935 | |
936 gtk_widget_show(b->label); | |
937 gtk_widget_show(box); | |
938 | |
939 gtk_object_set_user_data(GTK_OBJECT(b->item), b); | |
940 | |
941 gtk_signal_connect(GTK_OBJECT(b->item), "button_press_event", | |
942 GTK_SIGNAL_FUNC(handle_click_buddy), b); | |
430 | 943 |
1 | 944 return b; |
945 } | |
946 | |
947 | |
948 struct group *add_group(char *group) | |
949 { | |
318
35796808896a
[gaim-migrate @ 328]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
281
diff
changeset
|
950 struct group *g = find_group(group); |
35796808896a
[gaim-migrate @ 328]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
281
diff
changeset
|
951 if (g) |
35796808896a
[gaim-migrate @ 328]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
281
diff
changeset
|
952 return g; |
1 | 953 g = (struct group *)g_new0(struct group, 1); |
954 if (!g) | |
955 return NULL; | |
956 | |
957 strncpy(g->name, group, sizeof(g->name)); | |
958 groups = g_list_append(groups, g); | |
959 | |
960 if (blist == NULL) | |
961 return g; | |
962 | |
963 g->item = gtk_tree_item_new(); | |
964 g->label = gtk_label_new(g->name); | |
965 gtk_misc_set_alignment(GTK_MISC(g->label), 0.0, 0.5); | |
966 gtk_widget_show(g->label); | |
967 gtk_container_add(GTK_CONTAINER(g->item), g->label); | |
968 g->tree = gtk_tree_new(); | |
969 gtk_widget_show(g->item); | |
970 gtk_widget_show(g->tree); | |
971 gtk_tree_append(GTK_TREE(buddies), g->item); | |
972 gtk_tree_item_set_subtree(GTK_TREE_ITEM(g->item), g->tree); | |
973 gtk_tree_item_expand(GTK_TREE_ITEM(g->item)); | |
974 gtk_signal_connect(GTK_OBJECT(g->item), "button_press_event", | |
975 GTK_SIGNAL_FUNC(handle_click_group), | |
976 NULL); | |
977 gtk_object_set_user_data(GTK_OBJECT(g->item), NULL); | |
978 g->members = NULL; | |
979 | |
980 | |
981 build_edit_tree(); | |
982 | |
983 return g; | |
984 | |
985 } | |
986 | |
987 | |
988 static void do_del_buddy(GtkWidget *w, GtkCTree *ctree) | |
989 { | |
990 GtkCTreeNode *node; | |
991 char *bud, *grp; | |
992 struct buddy *b; | |
993 struct group *g; | |
994 GList *i; | |
995 | |
996 i = GTK_CLIST(edittree)->selection; | |
997 if (i) { | |
998 node = i->data; | |
999 | |
1000 if (GTK_CTREE_ROW(node)->is_leaf) { | |
1001 gtk_ctree_get_node_info (GTK_CTREE(edittree), node, &bud, | |
1002 NULL, NULL, NULL, NULL, NULL, NULL, NULL); | |
1003 | |
1004 b = find_buddy(bud); | |
1005 g = find_group_by_buddy(bud); | |
1006 remove_buddy(g, b); | |
1007 } else { | |
1008 gtk_ctree_get_node_info (ctree, node, &grp, | |
1009 NULL, NULL, NULL, NULL, NULL, NULL, NULL); | |
1010 g = find_group(grp); | |
1011 remove_group(g); | |
1012 } | |
1013 | |
1014 build_edit_tree(); | |
1015 serv_save_config(); | |
228 | 1016 |
1017 // flush buddy list to cache | |
1018 | |
1019 do_export( (GtkWidget *) NULL, 0 ); | |
1020 | |
1 | 1021 } else { |
1022 /* Nothing selected. */ | |
1023 } | |
1024 update_num_groups(); | |
1025 } | |
1026 | |
1027 static void do_del_perm(GtkWidget *w, GtkTree *permtree) | |
1028 { | |
1029 GtkLabel *label, *plabel; | |
1030 GtkWidget *item, *pitem; | |
1031 char *c, *d; | |
1032 GList *i; | |
1033 | |
1034 GList *plist; | |
1035 GList *dlist; | |
1036 int level; | |
1037 | |
1038 plist = permit; | |
1039 dlist = deny; | |
1040 | |
1041 i = GTK_TREE_SELECTION(permtree); | |
1042 if (i) { | |
1043 item = GTK_WIDGET(i->data); | |
1044 gtk_tree_unselect_child(GTK_TREE(permtree), item); | |
1045 label = GTK_LABEL(GTK_BIN(item)->child); | |
1046 gtk_label_get(label, &c); | |
1047 level = GTK_TREE(item->parent)->level; | |
1048 if (level > 0) { | |
1049 pitem = GTK_WIDGET(GTK_TREE(item->parent)->tree_owner); | |
1050 plabel = GTK_LABEL(GTK_BIN(pitem)->child); | |
1051 gtk_label_get(plabel, &d); | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1052 if (!strcasecmp(d, _("Permit"))) { |
1 | 1053 while(plist) { |
1054 if (!strcasecmp((char *)(plist->data), c)) { | |
1055 permit = g_list_remove(permit, plist->data); | |
1056 break; | |
1057 } | |
1058 | |
1059 plist = plist->next; | |
1060 } | |
1061 | |
1062 } else { | |
1063 while(dlist) { | |
1064 if (!strcasecmp((char *)(dlist->data), c)) { | |
1065 deny = g_list_remove(deny, dlist->data); | |
1066 | |
1067 break; | |
1068 } | |
1069 dlist = dlist->next; | |
1070 } | |
1071 | |
1072 } | |
1073 | |
1074 | |
1075 } else { | |
1076 /* Can't delete groups here! :) */ | |
1077 return; | |
1078 } | |
1079 serv_set_permit_deny(); | |
1080 gtk_tree_clear_items(GTK_TREE(permtree), 0, -1); | |
1081 build_permit_tree(); | |
1082 serv_save_config(); | |
1083 } | |
1084 } | |
1085 | |
1086 | |
1087 | |
1088 void gaimreg_callback(GtkWidget *widget) | |
1089 { | |
1090 show_register_dialog(); | |
1091 } | |
1092 | |
1093 void import_callback(GtkWidget *widget, void *null) | |
1094 { | |
1095 show_import_dialog(); | |
1096 } | |
1097 | |
1098 void export_callback(GtkWidget *widget, void *null) | |
1099 { | |
1100 show_export_dialog(); | |
1101 } | |
1102 | |
1103 | |
1104 | |
1105 void do_quit() | |
1106 { | |
391
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
1107 #ifdef GAIM_PLUGINS |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
1108 GList *c; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
1109 struct gaim_callback *g; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
1110 struct gaim_plugin *p; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
1111 void (*function)(void *); |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
1112 void (*gaim_plugin_remove)(); |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
1113 char *error; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
1114 |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
1115 /* first we tell those who have requested it we're quitting */ |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
1116 c = callbacks; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
1117 while (c) { |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
1118 g = (struct gaim_callback *)c->data; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
1119 if (g->event == event_quit && g->function != NULL) { |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
1120 function = g->function; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
1121 (*function)(g->data); |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
1122 } |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
1123 c = c->next; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
1124 } |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
1125 |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
1126 /* then we remove everyone in a mass suicide */ |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
1127 c = plugins; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
1128 while (c) { |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
1129 p = (struct gaim_plugin *)c->data; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
1130 gaim_plugin_remove = dlsym(p->handle, "gaim_plugin_remove"); |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
1131 if ((error = (char *)dlerror()) == NULL) |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
1132 (*gaim_plugin_remove)(); |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
1133 /* we don't need to worry about removing callbacks since |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
1134 * there won't be any more chance to call them back :) */ |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
1135 dlclose(p->handle); |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
1136 g_free(p->filename); /* why do i bother? */ |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
1137 g_free(p); |
403
d6f02d7f78d8
[gaim-migrate @ 413]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
391
diff
changeset
|
1138 c = c->next; |
391
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
1139 } |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
1140 #endif |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
350
diff
changeset
|
1141 |
1 | 1142 exit(0); |
1143 } | |
1144 | |
1145 void add_buddy_callback(GtkWidget *widget, void *dummy) | |
1146 { | |
1147 char *grp = NULL; | |
1148 GtkCTreeNode *node; | |
1149 GList *i; | |
1150 | |
1151 i = GTK_CLIST(edittree)->selection; | |
1152 if (i) { | |
1153 node = i->data; | |
1154 | |
1155 if (GTK_CTREE_ROW(node)->is_leaf) { | |
1156 node = GTK_CTREE_ROW(node)->parent; | |
1157 } | |
1158 | |
1159 gtk_ctree_get_node_info (GTK_CTREE(edittree), node, &grp, | |
1160 NULL, NULL, NULL, NULL, NULL, NULL, NULL); | |
1161 } | |
1162 show_add_buddy(NULL, grp); | |
1163 | |
1164 } | |
1165 | |
1166 void add_perm_callback(GtkWidget *widget, void *dummy) | |
1167 { | |
1168 show_add_perm(NULL); | |
1169 } | |
1170 | |
1171 | |
1172 static void info_callback(GtkWidget *widget, GtkTree *tree) | |
1173 { | |
1174 GList *i; | |
1175 struct buddy *b = NULL; | |
1176 i = GTK_TREE_SELECTION(tree); | |
1177 if (i) { | |
1178 b = gtk_object_get_user_data(GTK_OBJECT(i->data)); | |
1179 } else { | |
1180 return; | |
1181 } | |
1182 if (!b->name) | |
1183 return; | |
1184 serv_get_info(b->name); | |
1185 } | |
1186 | |
1187 | |
1188 void chat_callback(GtkWidget *widget, GtkTree *tree) | |
1189 { | |
1190 join_chat(); | |
1191 } | |
1192 | |
1193 struct group *find_group(char *group) | |
1194 { | |
1195 struct group *g; | |
1196 GList *grp = groups; | |
1197 char *grpname = g_malloc(strlen(group) + 1); | |
1198 | |
1199 strcpy(grpname, normalize(group)); | |
1200 while (grp) { | |
1201 g = (struct group *)grp->data; | |
1202 if (!strcasecmp(normalize(g->name), grpname)) { | |
1203 g_free(grpname); | |
1204 return g; | |
1205 } | |
1206 grp = grp->next; | |
1207 } | |
1208 | |
1209 g_free(grpname); | |
1210 return NULL; | |
1211 | |
1212 } | |
1213 | |
1214 | |
1215 struct group *find_group_by_buddy(char *who) | |
1216 { | |
1217 struct group *g; | |
1218 struct buddy *b; | |
1219 GList *grp = groups; | |
1220 GList *mem; | |
1221 char *whoname = g_malloc(strlen(who) + 1); | |
1222 | |
1223 strcpy(whoname, normalize(who)); | |
1224 | |
1225 while(grp) { | |
1226 g = (struct group *)grp->data; | |
1227 | |
1228 mem = g->members; | |
1229 while(mem) { | |
1230 b = (struct buddy *)mem->data; | |
1231 if (!strcasecmp(normalize(b->name), whoname)) { | |
1232 g_free(whoname); | |
1233 return g; | |
1234 } | |
1235 mem = mem->next; | |
1236 } | |
1237 grp = grp->next; | |
1238 } | |
1239 g_free(whoname); | |
1240 return NULL; | |
1241 } | |
1242 | |
1243 | |
1244 struct buddy *find_buddy(char *who) | |
1245 { | |
1246 struct group *g; | |
1247 struct buddy *b; | |
1248 GList *grp = groups; | |
1249 GList *mem; | |
1250 char *whoname = g_malloc(strlen(who) + 1); | |
1251 | |
1252 strcpy(whoname, normalize(who)); | |
1253 | |
1254 while(grp) { | |
1255 g = (struct group *)grp->data; | |
1256 | |
1257 mem = g->members; | |
1258 while(mem) { | |
1259 b = (struct buddy *)mem->data; | |
1260 if (!strcasecmp(normalize(b->name), whoname)) { | |
1261 g_free(whoname); | |
1262 return b; | |
1263 } | |
1264 mem = mem->next; | |
1265 } | |
1266 grp = grp->next; | |
1267 } | |
1268 g_free(whoname); | |
1269 return NULL; | |
1270 } | |
1271 | |
1272 | |
1273 void rem_bp(GtkWidget *w, struct buddy_pounce *b) | |
1274 { | |
1275 buddy_pounces = g_list_remove(buddy_pounces, b); | |
1276 } | |
1277 | |
1278 void do_pounce(char *name) | |
1279 { | |
26 | 1280 char *who; |
1 | 1281 |
1282 struct buddy_pounce *b; | |
1283 struct conversation *c; | |
1284 | |
1285 GList *bp = buddy_pounces; | |
1286 | |
26 | 1287 who = g_strdup(normalize(name)); |
1 | 1288 |
1289 while(bp) { | |
1290 b = (struct buddy_pounce *)bp->data;; | |
26 | 1291 bp = bp->next; /* increment the list here because rem_bp can make our handle bad */ |
1292 | |
1 | 1293 if (!strcasecmp(who, normalize(b->name))) { |
1294 if (b->popup == 1) | |
1295 { | |
1296 c = find_conversation(name); | |
1297 if (c == NULL) | |
1298 c = new_conversation(name); | |
1299 } | |
1300 if (b->sendim == 1) | |
1301 { | |
1302 c = find_conversation(name); | |
1303 if (c == NULL) | |
1304 c = new_conversation(name); | |
1305 | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
438
diff
changeset
|
1306 write_to_conv(c, b->message, WFLAG_SEND, NULL); |
1 | 1307 |
1308 escape_text(b->message); | |
1309 | |
1310 serv_send_im(name, b->message, 0); | |
1311 } | |
1312 | |
1313 rem_bp(NULL, b); | |
1314 | |
1315 } | |
1316 } | |
1317 g_free(who); | |
1318 } | |
1319 | |
1320 static void new_bp_callback(GtkWidget *w, char *name) | |
1321 { | |
1322 show_new_bp(name); | |
1323 } | |
1324 | |
1325 static void log_callback(GtkWidget *w, char *name) | |
1326 { | |
1327 struct conversation *c = find_conversation(name); | |
1328 | |
1329 if (find_log_info(name)) | |
1330 { | |
1331 if (c) { | |
1332 set_state_lock(1); | |
1333 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(c->log_button), FALSE); | |
1334 set_state_lock(0); | |
1335 } | |
1336 rm_log(find_log_info(name)); | |
1337 } | |
1338 else | |
1339 { | |
1340 show_log_dialog(name); | |
1341 if (c) { | |
1342 set_state_lock(1); | |
1343 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(c->log_button), TRUE); | |
1344 set_state_lock(0); | |
1345 } | |
1346 } | |
1347 } | |
1348 | |
1349 void do_bp_menu() | |
1350 { | |
1351 GtkWidget *menuitem, *mess, *messmenu; | |
1352 static GtkWidget *remmenu; | |
1353 GtkWidget *remitem; | |
1354 GtkWidget *sep; | |
1355 GList *l; | |
1356 struct buddy_pounce *b; | |
1357 GList *bp = buddy_pounces; | |
1358 | |
1359 l = gtk_container_children(GTK_CONTAINER(bpmenu)); | |
1360 | |
1361 while(l) { | |
1362 gtk_widget_destroy(GTK_WIDGET(l->data)); | |
1363 l = l->next; | |
1364 } | |
1365 | |
1366 remmenu = gtk_menu_new(); | |
1367 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1368 menuitem = gtk_menu_item_new_with_label(_("New Buddy Pounce")); |
1 | 1369 gtk_menu_append(GTK_MENU(bpmenu), menuitem); |
1370 gtk_widget_show(menuitem); | |
1371 gtk_signal_connect(GTK_OBJECT(menuitem), "activate", GTK_SIGNAL_FUNC(new_bp_callback), NULL); | |
1372 | |
1373 | |
1374 while(bp) { | |
1375 | |
1376 b = (struct buddy_pounce *)bp->data; | |
1377 remitem = gtk_menu_item_new_with_label(b->name); | |
1378 gtk_menu_append(GTK_MENU(remmenu), remitem); | |
1379 gtk_widget_show(remitem); | |
1380 gtk_signal_connect(GTK_OBJECT(remitem), "activate", GTK_SIGNAL_FUNC(rem_bp), b); | |
1381 | |
1382 bp = bp->next; | |
1383 | |
1384 } | |
1385 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1386 menuitem = gtk_menu_item_new_with_label(_("Remove Buddy Pounce")); |
1 | 1387 gtk_menu_append(GTK_MENU(bpmenu), menuitem); |
1388 gtk_widget_show(menuitem); | |
1389 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), remmenu); | |
1390 gtk_widget_show(remmenu); | |
1391 | |
1392 | |
1393 sep = gtk_hseparator_new(); | |
1394 menuitem = gtk_menu_item_new(); | |
1395 gtk_menu_append(GTK_MENU(bpmenu), menuitem); | |
1396 gtk_container_add(GTK_CONTAINER(menuitem), sep); | |
1397 gtk_widget_set_sensitive(menuitem, FALSE); | |
1398 gtk_widget_show(menuitem); | |
1399 gtk_widget_show(sep); | |
1400 | |
1401 bp = buddy_pounces;; | |
1402 | |
1403 while(bp) { | |
1404 | |
1405 b = (struct buddy_pounce *)bp->data; | |
1406 | |
1407 menuitem = gtk_menu_item_new_with_label(b->name); | |
1408 gtk_menu_append(GTK_MENU(bpmenu), menuitem); | |
1409 messmenu = gtk_menu_new(); | |
1410 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), messmenu); | |
1411 gtk_widget_show(menuitem); | |
1412 | |
1413 | |
1414 | |
1415 mess = gtk_menu_item_new_with_label(b->message); | |
1416 gtk_menu_append(GTK_MENU(messmenu), mess); | |
1417 gtk_widget_show(mess); | |
1418 | |
1419 bp = bp->next; | |
1420 | |
1421 } | |
1422 | |
1423 } | |
1424 | |
1425 | |
1426 gint log_timeout(char *name) | |
1427 { | |
1428 struct buddy *b; | |
119
66ec3865bd46
[gaim-migrate @ 129]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
107
diff
changeset
|
1429 struct group *g; |
1 | 1430 |
1431 b = find_buddy(name); | |
1432 | |
1433 if(!b) | |
1434 return FALSE; | |
1435 | |
1436 b->log_timer = 0; | |
1437 | |
119
66ec3865bd46
[gaim-migrate @ 129]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
107
diff
changeset
|
1438 if (!b->present) { |
1 | 1439 gtk_widget_hide(b->item); |
119
66ec3865bd46
[gaim-migrate @ 129]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
107
diff
changeset
|
1440 g = find_group_by_buddy(name); |
120
991d5f0c6c90
[gaim-migrate @ 130]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
119
diff
changeset
|
1441 if (GTK_TREE_ITEM(g->item)->expanded) { |
991d5f0c6c90
[gaim-migrate @ 130]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
119
diff
changeset
|
1442 gtk_tree_item_collapse(GTK_TREE_ITEM(g->item)); |
991d5f0c6c90
[gaim-migrate @ 130]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
119
diff
changeset
|
1443 gtk_tree_item_expand(GTK_TREE_ITEM(g->item)); |
991d5f0c6c90
[gaim-migrate @ 130]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
119
diff
changeset
|
1444 } |
119
66ec3865bd46
[gaim-migrate @ 129]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
107
diff
changeset
|
1445 } else |
1 | 1446 set_buddy(b); |
1447 | |
1448 return FALSE; | |
1449 } | |
1450 | |
1451 | |
513
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1452 static char *caps_string(u_short caps) |
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1453 { |
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1454 static char buf[BUF_LEN]; |
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1455 int count = 0, i = 0; |
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1456 u_short bit = 1; |
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1457 while (bit <= AIM_CAPS_SENDFILE) { |
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1458 if (bit & caps) { |
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1459 switch (bit) { |
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1460 case AIM_CAPS_BUDDYICON: |
514
44123888a941
[gaim-migrate @ 524]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
513
diff
changeset
|
1461 i += g_snprintf(buf + i, sizeof(buf) - i, _("%sBuddy Icon"), count ? ", " : ""); |
513
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1462 break; |
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1463 case AIM_CAPS_VOICE: |
514
44123888a941
[gaim-migrate @ 524]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
513
diff
changeset
|
1464 i += g_snprintf(buf + i, sizeof(buf) - i, _("%sVoice"), count ? ", " : ""); |
513
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1465 break; |
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1466 case AIM_CAPS_IMIMAGE: |
514
44123888a941
[gaim-migrate @ 524]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
513
diff
changeset
|
1467 i += g_snprintf(buf + i, sizeof(buf) - i, _("%sIM Image"), count ? ", " : ""); |
513
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1468 break; |
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1469 case AIM_CAPS_CHAT: |
514
44123888a941
[gaim-migrate @ 524]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
513
diff
changeset
|
1470 i += g_snprintf(buf + i, sizeof(buf) - i, _("%sChat"), count ? ", " : ""); |
513
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1471 break; |
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1472 case AIM_CAPS_GETFILE: |
514
44123888a941
[gaim-migrate @ 524]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
513
diff
changeset
|
1473 i += g_snprintf(buf + i, sizeof(buf) - i, _("%sGet File"), count ? ", " : ""); |
513
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1474 break; |
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1475 case AIM_CAPS_SENDFILE: |
514
44123888a941
[gaim-migrate @ 524]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
513
diff
changeset
|
1476 i += g_snprintf(buf + i, sizeof(buf) - i, _("%sSend File"), count ? ", " : ""); |
513
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1477 break; |
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1478 } |
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1479 count++; |
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1480 } |
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1481 bit <<= 1; |
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1482 } |
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1483 return buf; |
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1484 } |
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1485 |
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1486 |
1 | 1487 void set_buddy(struct buddy *b) |
1488 { | |
1489 char infotip[256]; | |
1490 char idlet[16]; | |
1491 char warn[256]; | |
513
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1492 char caps[256]; |
70 | 1493 char *who; |
1 | 1494 int i; |
1495 int ihrs, imin; | |
1496 time_t t; | |
1497 GdkPixmap *pm; | |
1498 GdkBitmap *bm; | |
1499 char *itime, *sotime; | |
1500 | |
1501 if (b->present) { | |
1502 time(&t); | |
1503 | |
1504 ihrs = (t - b->idle) / 3600; | |
1505 imin = ((t - b->idle) / 60) % 60; | |
1506 | |
1507 if (ihrs) | |
1508 g_snprintf(idlet, sizeof(idlet), "(%d:%02d)", ihrs, imin); | |
1509 else | |
1510 g_snprintf(idlet, sizeof(idlet), "(%02d)", imin); | |
1511 | |
1512 gtk_widget_hide(b->idletime); | |
1513 | |
1514 if (b->idle) | |
1515 gtk_label_set(GTK_LABEL(b->idletime), idlet); | |
1516 else | |
1517 gtk_label_set(GTK_LABEL(b->idletime), ""); | |
1518 if (display_options & OPT_DISP_SHOW_IDLETIME) | |
1519 gtk_widget_show(b->idletime); | |
1520 | |
1521 | |
1522 sotime = sec_to_text(t - b->signon + correction_time); | |
1523 if (b->idle) { | |
1524 itime = sec_to_text(t - b->idle); | |
1525 } else { | |
1526 itime = g_malloc(1); | |
1527 itime[0] = 0; | |
1528 } | |
1529 | |
1530 if (b->evil) { | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1531 g_snprintf(warn, sizeof(warn), _("Warnings: %d%%\n"), b->evil); |
1 | 1532 |
1533 } else | |
1534 warn[0] = '\0'; | |
1535 | |
513
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1536 if (b->caps) { |
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1537 g_snprintf(caps, sizeof(caps), _("Capabilities: %s\n"), caps_string(b->caps)); |
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1538 } else |
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1539 caps[0] = '\0'; |
1 | 1540 |
514
44123888a941
[gaim-migrate @ 524]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
513
diff
changeset
|
1541 i = g_snprintf(infotip, sizeof(infotip), _("Name: %s \nLogged in: %s\n%s%s%s%s%s"), b->name, sotime, warn, ((b->idle) ? _("Idle: ") : ""), itime, ((b->idle) ? "\n" : ""), caps); |
513
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
1542 |
1 | 1543 gtk_tooltips_set_tip(tips, GTK_WIDGET(b->item), infotip, ""); |
1544 | |
1545 g_free(sotime); | |
1546 g_free(itime); | |
1547 | |
1548 | |
1549 | |
121
3571b593f423
[gaim-migrate @ 131]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
120
diff
changeset
|
1550 /* this check should also depend on whether they left, |
3571b593f423
[gaim-migrate @ 131]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
120
diff
changeset
|
1551 * and signed on again before they got erased */ |
3571b593f423
[gaim-migrate @ 131]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
120
diff
changeset
|
1552 if (!GTK_WIDGET_VISIBLE(b->item) || b->present == 1) { |
94
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
1553 #ifdef GAIM_PLUGINS |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
1554 GList *c = callbacks; |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
1555 struct gaim_callback *g; |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
1556 void (*function)(char *, void *); |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
1557 while (c) { |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
1558 g = (struct gaim_callback *)c->data; |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
1559 if (g->event == event_buddy_signon && |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
1560 g->function != NULL) { |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
1561 function = g->function; |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
1562 (*function)(b->name, g->data); |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
1563 } |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
1564 c = c->next; |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
1565 } |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
1566 #endif |
1 | 1567 |
1568 play_sound(BUDDY_ARRIVE); | |
121
3571b593f423
[gaim-migrate @ 131]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
120
diff
changeset
|
1569 b->present = 2; |
1 | 1570 |
70 | 1571 who = g_malloc(sizeof(b->name) + 10); |
1572 strcpy(who, b->name); | |
1573 gtk_label_set(GTK_LABEL(b->label), who); | |
1574 g_free(who); | |
1575 | |
1 | 1576 pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm, |
1577 NULL, (gchar **)login_icon_xpm); | |
1578 gtk_widget_hide(b->pix); | |
1579 gtk_pixmap_set(GTK_PIXMAP(b->pix), pm, bm); | |
1580 if (display_options & OPT_DISP_SHOW_PIXMAPS) | |
1581 gtk_widget_show(b->pix); | |
1582 | |
430 | 1583 pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm, |
1584 NULL, (gchar **)login_icon_xpm); | |
1585 | |
436 | 1586 if ( ticker_prefs & OPT_DISP_SHOW_BUDDYTICKER ) |
1587 BuddyTickerAddUser( b->name, pm, bm ); | |
430 | 1588 |
1 | 1589 if (display_options & OPT_DISP_SHOW_LOGON) { |
1590 struct conversation *c = find_conversation(b->name); | |
1591 if (c) { | |
1592 char tmp[1024]; | |
1593 | |
1594 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1595 g_snprintf(tmp, sizeof(tmp), _("<HR><B>%s logged in%s%s.</B><BR><HR>"), b->name, |
1 | 1596 ((display_options & OPT_DISP_SHOW_TIME) ? " @ " : ""), |
1597 ((display_options & OPT_DISP_SHOW_TIME) ? date() : "")); | |
1598 | |
1599 | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
438
diff
changeset
|
1600 write_to_conv(c, tmp, WFLAG_SYSTEM, NULL); |
1 | 1601 |
1602 } | |
1603 } | |
1604 | |
1605 | |
1606 gtk_widget_show(b->item); | |
1607 gtk_widget_show(b->label); | |
58 | 1608 b->log_timer = gtk_timeout_add(10000, (GtkFunction) log_timeout, b->name); |
436 | 1609 if ( ticker_prefs & OPT_DISP_SHOW_BUDDYTICKER ) |
1610 gtk_timeout_add(10000, (GtkFunction) BuddyTickerLogonTimeout, b->name); | |
1 | 1611 update_num_groups(); |
1612 update_show_idlepix(); | |
1613 setup_buddy_chats(); | |
1614 return; | |
1615 } | |
1616 | |
1617 | |
1618 | |
1619 if (!b->log_timer) { | |
1620 gtk_widget_hide(b->pix); | |
1621 if (b->uc & UC_UNAVAILABLE) { | |
133
e277d5f0c1dd
[gaim-migrate @ 143]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
121
diff
changeset
|
1622 #ifdef GAIM_PLUGINS |
e277d5f0c1dd
[gaim-migrate @ 143]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
121
diff
changeset
|
1623 GList *c = callbacks; |
e277d5f0c1dd
[gaim-migrate @ 143]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
121
diff
changeset
|
1624 struct gaim_callback *g; |
e277d5f0c1dd
[gaim-migrate @ 143]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
121
diff
changeset
|
1625 void (*function)(char *, void *); |
e277d5f0c1dd
[gaim-migrate @ 143]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
121
diff
changeset
|
1626 while (c) { |
e277d5f0c1dd
[gaim-migrate @ 143]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
121
diff
changeset
|
1627 g = (struct gaim_callback *)c->data; |
e277d5f0c1dd
[gaim-migrate @ 143]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
121
diff
changeset
|
1628 if (g->event == event_buddy_away && |
e277d5f0c1dd
[gaim-migrate @ 143]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
121
diff
changeset
|
1629 g->function != NULL) { |
e277d5f0c1dd
[gaim-migrate @ 143]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
121
diff
changeset
|
1630 function = g->function; |
e277d5f0c1dd
[gaim-migrate @ 143]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
121
diff
changeset
|
1631 (*function)(b->name, g->data); |
e277d5f0c1dd
[gaim-migrate @ 143]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
121
diff
changeset
|
1632 } |
e277d5f0c1dd
[gaim-migrate @ 143]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
121
diff
changeset
|
1633 c = c->next; |
e277d5f0c1dd
[gaim-migrate @ 143]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
121
diff
changeset
|
1634 } |
e277d5f0c1dd
[gaim-migrate @ 143]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
121
diff
changeset
|
1635 #endif |
1 | 1636 pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm, |
1637 NULL, (gchar **)away_icon_xpm); | |
1638 gtk_pixmap_set(GTK_PIXMAP(b->pix), pm, bm); | |
436 | 1639 if ( ticker_prefs & OPT_DISP_SHOW_BUDDYTICKER ) |
1640 { | |
1641 pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm, | |
430 | 1642 NULL, (gchar **)away_icon_xpm); |
436 | 1643 BuddyTickerSetPixmap(b->name, pm, bm); |
1644 } | |
1 | 1645 } else if (b->uc & UC_AOL) { |
1646 pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm, | |
1647 NULL, (gchar **)aol_icon_xpm); | |
1648 gtk_pixmap_set(GTK_PIXMAP(b->pix), pm, bm); | |
436 | 1649 if ( ticker_prefs & OPT_DISP_SHOW_BUDDYTICKER ) |
1650 { | |
1651 pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm, | |
430 | 1652 NULL, (gchar **)aol_icon_xpm); |
436 | 1653 BuddyTickerSetPixmap(b->name, pm, bm); |
1654 } | |
1 | 1655 } else if (b->uc & UC_NORMAL) { |
1656 pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm, | |
1657 NULL, (gchar **)free_icon_xpm); | |
1658 gtk_pixmap_set(GTK_PIXMAP(b->pix), pm, bm); | |
436 | 1659 if ( ticker_prefs & OPT_DISP_SHOW_BUDDYTICKER ) |
1660 { | |
1661 pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm, | |
430 | 1662 NULL, (gchar **)free_icon_xpm); |
436 | 1663 BuddyTickerSetPixmap(b->name, pm, bm); |
1664 } | |
1 | 1665 } else if (b->uc & UC_ADMIN) { |
1666 pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm, | |
1667 NULL, (gchar **)admin_icon_xpm); | |
1668 gtk_pixmap_set(GTK_PIXMAP(b->pix), pm, bm); | |
436 | 1669 if ( ticker_prefs & OPT_DISP_SHOW_BUDDYTICKER ) |
1670 { | |
1671 pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm, | |
430 | 1672 NULL, (gchar **)admin_icon_xpm); |
436 | 1673 BuddyTickerSetPixmap(b->name, pm, bm); |
1674 } | |
1 | 1675 } else if (b->uc & UC_UNCONFIRMED) { |
1676 pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm, | |
1677 NULL, (gchar **)dt_icon_xpm); | |
1678 gtk_pixmap_set(GTK_PIXMAP(b->pix), pm, bm); | |
436 | 1679 if ( ticker_prefs & OPT_DISP_SHOW_BUDDYTICKER ) |
1680 { | |
1681 pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm, | |
430 | 1682 NULL, (gchar **)dt_icon_xpm); |
436 | 1683 BuddyTickerSetPixmap(b->name, pm, bm); |
1684 } | |
1 | 1685 } else { |
1686 pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm, | |
1687 NULL, (gchar **)no_icon_xpm); | |
1688 gtk_pixmap_set(GTK_PIXMAP(b->pix), pm, bm); | |
436 | 1689 if ( ticker_prefs & OPT_DISP_SHOW_BUDDYTICKER ) |
1690 { | |
1691 pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm, | |
430 | 1692 NULL, (gchar **)no_icon_xpm); |
436 | 1693 BuddyTickerSetPixmap(b->name, pm, bm); |
1694 } | |
1 | 1695 } |
1696 if (display_options & OPT_DISP_SHOW_PIXMAPS) | |
1697 gtk_widget_show(b->pix); | |
1698 } | |
1699 | |
1700 | |
1701 | |
1702 } else { | |
59 | 1703 if (GTK_WIDGET_VISIBLE(b->item)) { |
94
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
1704 #ifdef GAIM_PLUGINS |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
1705 GList *c = callbacks; |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
1706 struct gaim_callback *g; |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
1707 void (*function)(char *, void *); |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
1708 while (c) { |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
1709 g = (struct gaim_callback *)c->data; |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
1710 if (g->event == event_buddy_signoff && |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
1711 g->function != NULL) { |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
1712 function = g->function; |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
1713 (*function)(b->name, g->data); |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
1714 } |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
1715 c = c->next; |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
1716 } |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
1717 #endif |
1 | 1718 play_sound(BUDDY_LEAVE); |
1719 pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm, | |
1720 NULL, (gchar **)logout_icon_xpm); | |
1721 gtk_widget_hide(b->pix); | |
1722 gtk_pixmap_set(GTK_PIXMAP(b->pix), pm, bm); | |
430 | 1723 pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm, |
1724 NULL, (gchar **)logout_icon_xpm); | |
436 | 1725 if ( ticker_prefs & OPT_DISP_SHOW_BUDDYTICKER ) |
1726 BuddyTickerSetPixmap( b->name, pm, bm ); | |
1 | 1727 if (display_options & OPT_DISP_SHOW_PIXMAPS) |
1728 gtk_widget_show(b->pix); | |
1729 if (display_options & OPT_DISP_SHOW_LOGON) { | |
1730 struct conversation *c = find_conversation(b->name); | |
1731 if (c) { | |
1732 char tmp[1024]; | |
1733 | |
1734 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1735 g_snprintf(tmp, sizeof(tmp), _("<HR><B>%s logged out%s%s.</B><BR><HR>"), b->name, |
1 | 1736 ((display_options & OPT_DISP_SHOW_TIME) ? " @ " : ""), |
1737 ((display_options & OPT_DISP_SHOW_TIME) ? date() : "")); | |
1738 | |
1739 | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
438
diff
changeset
|
1740 write_to_conv(c, tmp, WFLAG_SYSTEM, NULL); |
1 | 1741 |
1742 } | |
1743 } | |
58 | 1744 b->log_timer = gtk_timeout_add(10000, (GtkFunction)log_timeout, b->name); |
436 | 1745 if ( ticker_prefs & OPT_DISP_SHOW_BUDDYTICKER ) |
1746 gtk_timeout_add(10000, (GtkFunction)BuddyTickerLogoutTimeout, b->name); | |
1 | 1747 update_num_groups(); |
1748 update_show_idlepix(); | |
1749 } | |
1750 } | |
1751 setup_buddy_chats(); | |
1752 } | |
1753 | |
1754 | |
1755 static void set_permit(GtkWidget *w, int *data) | |
1756 { | |
1757 permdeny = (int)data; | |
1758 /* printf("BLAH BLAH %d %d", permdeny, (int) data); */ | |
1759 /* We don't save this 'at home', it's on the server. | |
1760 * So, we gotta resend the config to the server. */ | |
1761 serv_save_config(); | |
281
7b06ba09ffe2
[gaim-migrate @ 291]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
272
diff
changeset
|
1762 /* we do this here because we can :) */ |
7b06ba09ffe2
[gaim-migrate @ 291]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
272
diff
changeset
|
1763 serv_set_permit_deny(); |
1 | 1764 } |
1765 | |
1766 | |
1767 static void move_blist_window(GtkWidget *w, GdkEventConfigure *e, void *dummy) | |
1768 { | |
1769 int x, y, width, height; | |
1770 int save = 0; | |
1771 gdk_window_get_position(blist->window, &x, &y); | |
1772 gdk_window_get_size(blist->window, &width, &height); | |
1773 | |
1774 if(e->send_event) { /* Is a position event */ | |
1775 if (blist_pos.x != x || blist_pos.y != y) | |
1776 save = 1; | |
1777 blist_pos.x = x; | |
1778 blist_pos.y = y; | |
1779 } else { /* Is a size event */ | |
1780 if (blist_pos.xoff != x || blist_pos.yoff != y || | |
1781 blist_pos.width != width || blist_pos.width != width) | |
1782 save = 1; | |
1783 | |
1784 blist_pos.width = width; | |
1785 blist_pos.height = height; | |
1786 blist_pos.xoff = x; | |
1787 blist_pos.yoff = y; | |
1788 } | |
1789 | |
1790 if (save) | |
1791 save_prefs(); | |
1792 | |
1793 } | |
1794 | |
1795 | |
1796 /******************************************************************* | |
1797 * | |
1798 * Helper funs for making the menu | |
1799 * | |
1800 *******************************************************************/ | |
1801 | |
1802 void gaim_seperator(GtkWidget *menu) | |
1803 { | |
1804 GtkWidget *sep, *menuitem; | |
1805 sep = gtk_hseparator_new(); | |
1806 menuitem = gtk_menu_item_new(); | |
1807 gtk_menu_append(GTK_MENU(menu), menuitem); | |
1808 gtk_container_add(GTK_CONTAINER(menuitem), sep); | |
1809 gtk_widget_set_sensitive(menuitem, FALSE); | |
1810 gtk_widget_show(menuitem); | |
1811 gtk_widget_show(sep); | |
1812 } | |
1813 | |
1814 GtkWidget *gaim_new_item(GtkWidget *menu, const char *str, GtkSignalFunc sf) | |
1815 { | |
1816 GtkWidget *menuitem; | |
1817 menuitem = gtk_menu_item_new_with_label(str); | |
1818 if (menu) | |
1819 gtk_menu_append(GTK_MENU(menu), menuitem); | |
1820 gtk_widget_show(menuitem); | |
1821 if (sf) | |
1822 gtk_signal_connect(GTK_OBJECT(menuitem), "activate", sf, NULL); | |
1823 return menuitem; | |
1824 } | |
1825 | |
1826 | |
1827 | |
1828 | |
1829 | |
1830 void show_buddy_list() | |
1831 { | |
1832 | |
1833 /* Build the buddy list, based on *config */ | |
1834 | |
1835 GtkWidget *sw; | |
1836 GtkWidget *menu; | |
1837 GtkWidget *findmenu; | |
1838 GtkWidget *setmenu; | |
1839 GtkWidget *menubar; | |
1840 GtkWidget *vbox; | |
1841 GtkWidget *hbox; | |
1842 GtkWidget *menuitem; | |
1843 GtkWidget *notebook; | |
1844 GtkWidget *label; | |
1845 GtkWidget *bbox; | |
1846 GtkWidget *permopt; | |
1847 GtkWidget *tbox; | |
1848 GtkWidget *xbox; | |
1849 GtkWidget *pbox; | |
1850 | |
1851 | |
1852 #ifdef USE_APPLET | |
1853 blist = gtk_window_new(GTK_WINDOW_DIALOG); | |
1854 #else | |
1855 blist = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |
1856 #endif | |
1857 | |
1858 gtk_widget_realize(blist); | |
1859 aol_icon(blist->window); | |
1860 | |
1861 gtk_window_set_policy(GTK_WINDOW(blist), TRUE, TRUE, TRUE); | |
1862 | |
1863 menubar = gtk_menu_bar_new(); | |
1864 | |
1865 menu = gtk_menu_new(); | |
1866 | |
1867 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1868 menuitem = gaim_new_item(NULL, _("File"), NULL); |
1 | 1869 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), menu); |
1870 gtk_menu_bar_append(GTK_MENU_BAR(menubar), menuitem); | |
1871 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1872 gaim_new_item(menu, _("Add A Buddy"), GTK_SIGNAL_FUNC(add_buddy_callback)); |
1 | 1873 gaim_seperator(menu); |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1874 gaim_new_item(menu, _("Import Buddy List"), GTK_SIGNAL_FUNC(import_callback)); |
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1875 gaim_new_item(menu, _("Export Buddy List"), GTK_SIGNAL_FUNC(export_callback)); |
1 | 1876 if (!(general_options & OPT_GEN_REGISTERED)) |
1877 { | |
1878 gaim_seperator(menu); | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1879 gaim_new_item(menu, _("Register"), GTK_SIGNAL_FUNC(gaimreg_callback)); |
1 | 1880 } |
1881 gaim_seperator(menu); | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1882 gaim_new_item(menu, _("Signoff"), GTK_SIGNAL_FUNC(signoff)); |
1 | 1883 |
1884 #ifndef USE_APPLET | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1885 gaim_new_item(menu, _("Quit"), GTK_SIGNAL_FUNC(do_quit)); |
1 | 1886 #else |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1887 gaim_new_item(menu, _("Close"), GTK_SIGNAL_FUNC(applet_destroy_buddy)); |
1 | 1888 #endif |
1889 | |
1890 menu = gtk_menu_new(); | |
1891 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1892 menuitem = gaim_new_item(NULL, _("Tools"), NULL); |
1 | 1893 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), menu); |
1894 gtk_menu_bar_append(GTK_MENU_BAR(menubar), menuitem); | |
1895 | |
1896 awaymenu = gtk_menu_new(); | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1897 menuitem = gaim_new_item(menu, _("Away"), NULL); |
1 | 1898 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), awaymenu); |
1899 do_away_menu(); | |
1900 | |
1901 bpmenu = gtk_menu_new(); | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1902 menuitem = gaim_new_item(menu, _("Buddy Pounce"), NULL); |
1 | 1903 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), bpmenu); |
1904 do_bp_menu(); | |
1905 | |
1906 gaim_seperator(menu); | |
1907 | |
1908 findmenu = gtk_menu_new(); | |
1909 gtk_widget_show(findmenu); | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1910 menuitem = gaim_new_item(menu, _("Search for Buddy"), NULL); |
1 | 1911 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), findmenu); |
1912 gtk_widget_show(menuitem); | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1913 menuitem = gtk_menu_item_new_with_label(_("by Email")); |
1 | 1914 gtk_menu_append(GTK_MENU(findmenu), menuitem); |
1915 gtk_signal_connect(GTK_OBJECT(menuitem), "activate", GTK_SIGNAL_FUNC(show_find_email), NULL); | |
1916 gtk_widget_show(menuitem); | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1917 menuitem = gtk_menu_item_new_with_label(_("by Dir Info")); |
1 | 1918 gtk_menu_append(GTK_MENU(findmenu), menuitem); |
1919 gtk_signal_connect(GTK_OBJECT(menuitem), "activate", GTK_SIGNAL_FUNC(show_find_info), NULL); | |
1920 gtk_widget_show(menuitem); | |
1921 | |
1922 setmenu = gtk_menu_new(); | |
1923 gtk_widget_show(setmenu); | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1924 menuitem = gaim_new_item(menu, _("Settings"), NULL); |
1 | 1925 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), setmenu); |
1926 gtk_widget_show(menuitem); | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1927 menuitem = gtk_menu_item_new_with_label(_("User Info")); |
1 | 1928 gtk_menu_append(GTK_MENU(setmenu), menuitem); |
1929 gtk_signal_connect(GTK_OBJECT(menuitem), "activate", GTK_SIGNAL_FUNC(show_set_info), NULL); | |
1930 gtk_widget_show(menuitem); | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1931 menuitem = gtk_menu_item_new_with_label(_("Directory Info")); |
1 | 1932 gtk_menu_append(GTK_MENU(setmenu), menuitem); |
1933 gtk_signal_connect(GTK_OBJECT(menuitem), "activate", GTK_SIGNAL_FUNC(show_set_dir), NULL); | |
1934 gtk_widget_show(menuitem); | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1935 menuitem = gtk_menu_item_new_with_label(_("Change Password")); |
146 | 1936 gtk_menu_append(GTK_MENU(setmenu), menuitem); |
1937 gtk_signal_connect(GTK_OBJECT(menuitem), "activate", GTK_SIGNAL_FUNC(show_change_passwd), NULL); | |
1938 gtk_widget_show(menuitem); | |
1 | 1939 gaim_seperator(menu); |
1940 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1941 gaim_new_item(menu, _("Preferences"), GTK_SIGNAL_FUNC(show_prefs)); |
90
f5b305c0d974
[gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
87
diff
changeset
|
1942 |
152
cb0d3ec5a4c8
[gaim-migrate @ 162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
150
diff
changeset
|
1943 #ifdef GAIM_PLUGINS |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1944 gaim_new_item(menu, _("Plugins"), GTK_SIGNAL_FUNC(show_plugins)); |
152
cb0d3ec5a4c8
[gaim-migrate @ 162]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
150
diff
changeset
|
1945 #endif |
90
f5b305c0d974
[gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
87
diff
changeset
|
1946 |
1 | 1947 menu = gtk_menu_new(); |
1948 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1949 menuitem = gaim_new_item(NULL, _("Help"), NULL); |
1 | 1950 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), menu); |
1951 gtk_menu_item_right_justify(GTK_MENU_ITEM(menuitem)); | |
1952 gtk_menu_bar_append(GTK_MENU_BAR(menubar), menuitem); | |
1953 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1954 gaim_new_item(menu, _("About"), show_about); |
1 | 1955 |
1956 gtk_widget_show(menubar); | |
1957 | |
1958 lagometer_box = gtk_hbox_new(FALSE, 0); | |
1959 | |
1960 | |
1961 lagometer = gtk_progress_bar_new(); | |
1962 gtk_widget_show(lagometer); | |
1963 | |
1964 label = gtk_label_new("Lag-O-Meter: "); | |
1965 gtk_widget_show(label); | |
1966 | |
1967 gtk_box_pack_start(GTK_BOX(lagometer_box), label, FALSE, FALSE, 5); | |
1968 gtk_box_pack_start(GTK_BOX(lagometer_box), lagometer, TRUE, TRUE, 5); | |
1969 | |
1970 gtk_widget_set_usize(lagometer, 5, 5); | |
1971 | |
1972 | |
1973 if ((general_options & OPT_GEN_SHOW_LAGMETER)) | |
1974 gtk_widget_show(lagometer_box); | |
1975 | |
1976 | |
1977 vbox = gtk_vbox_new(FALSE, 10); | |
1978 | |
1979 notebook = gtk_notebook_new(); | |
1980 | |
1981 | |
1982 | |
1983 | |
1984 /* Do buddy list stuff */ | |
1985 | |
1986 buddypane = gtk_vbox_new(FALSE, 0); | |
1987 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1988 imbutton = gtk_button_new_with_label(_("IM")); |
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1989 infobutton = gtk_button_new_with_label(_("Info")); |
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1990 chatbutton = gtk_button_new_with_label(_("Chat")); |
1 | 1991 |
1992 hbox = gtk_hbox_new(TRUE, 10); | |
1993 | |
1994 buddies = gtk_tree_new(); | |
1995 sw = gtk_scrolled_window_new(NULL, NULL); | |
1996 | |
535
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
515
diff
changeset
|
1997 if (display_options & OPT_DISP_COOL_LOOK) |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
515
diff
changeset
|
1998 { |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
515
diff
changeset
|
1999 gtk_button_set_relief(GTK_BUTTON(imbutton), GTK_RELIEF_NONE); |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
515
diff
changeset
|
2000 gtk_button_set_relief(GTK_BUTTON(infobutton), GTK_RELIEF_NONE); |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
515
diff
changeset
|
2001 gtk_button_set_relief(GTK_BUTTON(chatbutton), GTK_RELIEF_NONE); |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
515
diff
changeset
|
2002 } |
1 | 2003 |
2004 tips = gtk_tooltips_new(); | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
2005 gtk_object_set_data(GTK_OBJECT(blist), _("Buddy List"), tips); |
1 | 2006 |
2007 | |
2008 | |
2009 /* Now the buddy list */ | |
2010 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(sw),buddies); | |
2011 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), | |
2012 GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC); | |
2013 gtk_widget_set_usize(sw,200,200); | |
2014 gtk_widget_show(buddies); | |
2015 gtk_widget_show(sw); | |
2016 | |
2017 /* Put the buttons in the hbox */ | |
2018 gtk_widget_show(imbutton); | |
2019 gtk_widget_show(chatbutton); | |
2020 gtk_widget_show(infobutton); | |
2021 | |
2022 gtk_box_pack_start(GTK_BOX(hbox), imbutton, TRUE, TRUE, 0); | |
2023 gtk_box_pack_start(GTK_BOX(hbox), infobutton, TRUE, TRUE, 0); | |
2024 gtk_box_pack_start(GTK_BOX(hbox), chatbutton, TRUE, TRUE, 0); | |
2025 gtk_container_border_width(GTK_CONTAINER(hbox), 10); | |
2026 | |
2027 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
2028 gtk_tooltips_set_tip(tips,infobutton, _("Information on selected Buddy"), "Penguin"); |
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
2029 gtk_tooltips_set_tip(tips,imbutton, _("Send Instant Message"), "Penguin"); |
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
2030 gtk_tooltips_set_tip(tips,chatbutton, _("Start/join a Buddy Chat"), "Penguin"); |
1 | 2031 |
2032 gtk_box_pack_start(GTK_BOX(buddypane), sw, TRUE, TRUE, 0); | |
2033 gtk_box_pack_start(GTK_BOX(buddypane), hbox, FALSE, FALSE, 0); | |
2034 | |
2035 gtk_widget_show(hbox); | |
2036 gtk_widget_show(buddypane); | |
2037 | |
2038 | |
2039 | |
2040 /* Swing the edit buddy */ | |
2041 editpane = gtk_vbox_new(FALSE, 0); | |
2042 | |
2043 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
2044 addbutton = gtk_button_new_with_label(_("Add")); |
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
2045 rembutton = gtk_button_new_with_label(_("Remove")); |
535
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
515
diff
changeset
|
2046 |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
515
diff
changeset
|
2047 if (display_options & OPT_DISP_COOL_LOOK) |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
515
diff
changeset
|
2048 { |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
515
diff
changeset
|
2049 gtk_button_set_relief(GTK_BUTTON(addbutton), GTK_RELIEF_NONE); |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
515
diff
changeset
|
2050 gtk_button_set_relief(GTK_BUTTON(rembutton), GTK_RELIEF_NONE); |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
515
diff
changeset
|
2051 } |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
515
diff
changeset
|
2052 |
1 | 2053 edittree = gtk_ctree_new(1, 0); |
2054 gtk_ctree_set_line_style (GTK_CTREE(edittree), GTK_CTREE_LINES_SOLID); | |
2055 gtk_ctree_set_expander_style(GTK_CTREE(edittree), GTK_CTREE_EXPANDER_SQUARE); | |
2056 gtk_clist_set_reorderable(GTK_CLIST(edittree), TRUE); | |
2057 | |
2058 gtk_ctree_set_drag_compare_func (GTK_CTREE(edittree), | |
2059 (GtkCTreeCompareDragFunc)edit_drag_compare_func); | |
2060 | |
2061 | |
2062 gtk_signal_connect_after (GTK_OBJECT (edittree), "tree_move", | |
2063 GTK_SIGNAL_FUNC (edit_tree_move), NULL); | |
2064 | |
2065 | |
2066 bbox = gtk_hbox_new(TRUE, 10); | |
2067 tbox = gtk_scrolled_window_new(NULL, NULL); | |
2068 /* Put the buttons in the box */ | |
2069 gtk_box_pack_start(GTK_BOX(bbox), addbutton, TRUE, TRUE, 10); | |
2070 gtk_box_pack_start(GTK_BOX(bbox), rembutton, TRUE, TRUE, 10); | |
2071 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
2072 gtk_tooltips_set_tip(tips, addbutton, _("Add a new Buddy"), "Penguin"); |
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
2073 gtk_tooltips_set_tip(tips, rembutton, _("Remove selected Buddy"), "Penguin"); |
1 | 2074 |
2075 /* And the boxes in the box */ | |
2076 gtk_box_pack_start(GTK_BOX(editpane), tbox, TRUE, TRUE, 5); | |
2077 gtk_box_pack_start(GTK_BOX(editpane), bbox, FALSE, FALSE, 5); | |
2078 | |
2079 /* Handle closes right */ | |
2080 | |
2081 | |
2082 | |
2083 /* Finish up */ | |
2084 gtk_widget_show(addbutton); | |
2085 gtk_widget_show(rembutton); | |
2086 gtk_widget_show(edittree); | |
2087 gtk_widget_show(tbox); | |
2088 gtk_widget_show(bbox); | |
2089 gtk_widget_show(editpane); | |
2090 | |
2091 | |
2092 /* Permit/Deny */ | |
2093 | |
2094 permitpane = gtk_vbox_new(FALSE, 0); | |
2095 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
2096 permopt = gtk_radio_button_new_with_label(NULL, _("Allow anyone")); |
1 | 2097 gtk_box_pack_start(GTK_BOX(permitpane), permopt, FALSE, FALSE, 0); |
2098 gtk_signal_connect(GTK_OBJECT(permopt), "clicked", GTK_SIGNAL_FUNC(set_permit), (void *)1); | |
2099 gtk_widget_show(permopt); | |
2100 if (permdeny == 1) | |
2101 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(permopt), TRUE); | |
2102 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
2103 permopt = gtk_radio_button_new_with_label(gtk_radio_button_group(GTK_RADIO_BUTTON(permopt)), _("Permit some")); |
1 | 2104 gtk_box_pack_start(GTK_BOX(permitpane), permopt, FALSE, FALSE, 0); |
2105 gtk_signal_connect(GTK_OBJECT(permopt), "clicked", GTK_SIGNAL_FUNC(set_permit), (void *)3); | |
2106 gtk_widget_show(permopt); | |
2107 if (permdeny == 3) | |
2108 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(permopt), TRUE); | |
2109 | |
2110 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
2111 permopt = gtk_radio_button_new_with_label(gtk_radio_button_group(GTK_RADIO_BUTTON(permopt)), _("Deny some")); |
1 | 2112 gtk_box_pack_start(GTK_BOX(permitpane), permopt, FALSE, FALSE, 0); |
2113 gtk_signal_connect(GTK_OBJECT(permopt), "clicked", GTK_SIGNAL_FUNC(set_permit), (void *)4); | |
2114 gtk_widget_show(permopt); | |
2115 if (permdeny == 4) | |
2116 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(permopt), TRUE); | |
2117 | |
2118 | |
2119 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
2120 addpermbutton = gtk_button_new_with_label(_("Add")); |
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
2121 rempermbutton = gtk_button_new_with_label(_("Remove")); |
1 | 2122 |
535
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
515
diff
changeset
|
2123 if (display_options & OPT_DISP_COOL_LOOK) |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
515
diff
changeset
|
2124 { |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
515
diff
changeset
|
2125 gtk_button_set_relief(GTK_BUTTON(addpermbutton), GTK_RELIEF_NONE); |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
515
diff
changeset
|
2126 gtk_button_set_relief(GTK_BUTTON(rempermbutton), GTK_RELIEF_NONE); |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
515
diff
changeset
|
2127 } |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
515
diff
changeset
|
2128 |
1 | 2129 permtree = gtk_tree_new(); |
225
d95f65a22b14
[gaim-migrate @ 235]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
178
diff
changeset
|
2130 build_permit_tree(); |
1 | 2131 pbox = gtk_hbox_new(TRUE, 10); |
2132 xbox = gtk_scrolled_window_new(NULL, NULL); | |
2133 /* Put the buttons in the box */ | |
2134 gtk_box_pack_start(GTK_BOX(pbox), addpermbutton, TRUE, TRUE, 10); | |
2135 gtk_box_pack_start(GTK_BOX(pbox), rempermbutton, TRUE, TRUE, 10); | |
2136 | |
2137 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
2138 gtk_tooltips_set_tip(tips, addpermbutton, _("Add buddy to permit/deny"), "Penguin"); |
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
2139 gtk_tooltips_set_tip(tips, rempermbutton, _("Remove buddy from permit/deny"), "Penguin"); |
1 | 2140 /* And the boxes in the box */ |
2141 gtk_box_pack_start(GTK_BOX(permitpane), xbox, TRUE, TRUE, 5); | |
2142 gtk_box_pack_start(GTK_BOX(permitpane), pbox, FALSE, FALSE, 5); | |
2143 | |
2144 /* Handle closes right */ | |
2145 | |
2146 | |
2147 | |
2148 /* Finish up */ | |
2149 gtk_widget_show(addpermbutton); | |
2150 gtk_widget_show(rempermbutton); | |
2151 gtk_widget_show(permtree); | |
2152 gtk_widget_show(xbox); | |
2153 gtk_widget_show(pbox); | |
2154 gtk_widget_show(permitpane); | |
2155 | |
2156 | |
2157 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
2158 label = gtk_label_new(_("Online")); |
1 | 2159 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), buddypane, label); |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
2160 label = gtk_label_new(_("Edit Buddies")); |
1 | 2161 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), editpane, label); |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
2162 label = gtk_label_new(_("Permit")); |
1 | 2163 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), permitpane, label); |
2164 | |
2165 gtk_widget_show_all(notebook); | |
2166 | |
2167 /* Pack things in the vbox */ | |
2168 gtk_widget_show(vbox); | |
2169 | |
2170 | |
2171 gtk_widget_show(notebook); | |
2172 | |
2173 /* Enable buttons */ | |
2174 | |
2175 gtk_signal_connect(GTK_OBJECT(imbutton), "clicked", GTK_SIGNAL_FUNC(show_im_dialog), buddies); | |
2176 gtk_signal_connect(GTK_OBJECT(infobutton), "clicked", GTK_SIGNAL_FUNC(info_callback), buddies); | |
2177 gtk_signal_connect(GTK_OBJECT(chatbutton), "clicked", GTK_SIGNAL_FUNC(chat_callback), buddies); | |
2178 gtk_signal_connect(GTK_OBJECT(rembutton), "clicked", GTK_SIGNAL_FUNC(do_del_buddy), edittree); | |
2179 gtk_signal_connect(GTK_OBJECT(addbutton), "clicked", GTK_SIGNAL_FUNC(add_buddy_callback), NULL); | |
2180 gtk_signal_connect(GTK_OBJECT(addpermbutton), "clicked", GTK_SIGNAL_FUNC(add_perm_callback), NULL); | |
2181 gtk_signal_connect(GTK_OBJECT(rempermbutton), "clicked", GTK_SIGNAL_FUNC(do_del_perm), permtree); | |
2182 gtk_box_pack_start(GTK_BOX(vbox), menubar, FALSE, TRUE, 0); | |
2183 gtk_box_pack_start(GTK_BOX(vbox), lagometer_box, FALSE, TRUE, 0); | |
2184 gtk_box_pack_start(GTK_BOX(vbox), notebook, TRUE, TRUE, 0); | |
2185 | |
2186 gtk_container_add(GTK_CONTAINER(blist), vbox); | |
2187 | |
2188 #ifndef USE_APPLET | |
2189 gtk_signal_connect(GTK_OBJECT(blist), "delete_event", GTK_SIGNAL_FUNC(do_quit), blist); | |
2190 #else | |
2191 gtk_signal_connect(GTK_OBJECT(blist), "delete_event", GTK_SIGNAL_FUNC(applet_destroy_buddy), NULL); | |
2192 #endif | |
2193 | |
2194 gtk_signal_connect(GTK_OBJECT(blist), "configure_event", GTK_SIGNAL_FUNC(move_blist_window), NULL); | |
2195 | |
2196 | |
2197 | |
2198 /* The edit tree */ | |
2199 gtk_container_add(GTK_CONTAINER(tbox), edittree); | |
2200 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(tbox), | |
2201 GTK_POLICY_NEVER,GTK_POLICY_AUTOMATIC); | |
2202 | |
2203 | |
2204 /* The permit tree */ | |
2205 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(xbox), permtree); | |
2206 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(xbox), | |
2207 GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC); | |
2208 | |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
2209 gtk_window_set_title(GTK_WINDOW(blist), _("Gaim - Buddy List")); |
1 | 2210 |
2211 if (general_options & OPT_GEN_SAVED_WINDOWS) { | |
2212 if (blist_pos.width != 0) { /* Sanity check! */ | |
2213 gtk_widget_set_uposition(blist, blist_pos.x - blist_pos.xoff, blist_pos.y - blist_pos.yoff); | |
2214 gtk_widget_set_usize(blist, blist_pos.width, blist_pos.height); | |
2215 } | |
2216 } | |
2217 } | |
2218 | |
2219 void refresh_buddy_window() | |
2220 { | |
2221 setup_buddy_chats(); | |
2222 | |
2223 build_edit_tree(); | |
2224 build_permit_tree(); | |
2225 | |
2226 update_button_pix(); | |
2227 gtk_widget_show(blist); | |
2228 | |
2229 | |
2230 } | |
2231 |