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