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