Mercurial > pidgin
annotate src/pounce.c @ 8200:82627be0f420
[gaim-migrate @ 8923]
plug an ugly memory leak
committer: Tailor Script <tailor@pidgin.im>
author | Nathan Walp <nwalp@pidgin.im> |
---|---|
date | Mon, 02 Feb 2004 16:52:50 +0000 |
parents | fa6395637e2c |
children | 63c7a16a2c09 |
rev | line source |
---|---|
5032
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
1 /** |
5864
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
2 * @file pounce.c Buddy Pounce API |
6837
f098765ac919
[gaim-migrate @ 7382]
Christian Hammond <chipx86@chipx86.com>
parents:
6719
diff
changeset
|
3 * @ingroup core |
5032
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
4 * |
4687 | 5 * gaim |
6 * | |
8046 | 7 * Gaim is the legal property of its developers, whose names are too numerous |
8 * to list here. Please refer to the COPYRIGHT file distributed with this | |
9 * source distribution. | |
6837
f098765ac919
[gaim-migrate @ 7382]
Christian Hammond <chipx86@chipx86.com>
parents:
6719
diff
changeset
|
10 * |
4687 | 11 * This program is free software; you can redistribute it and/or modify |
12 * it under the terms of the GNU General Public License as published by | |
13 * the Free Software Foundation; either version 2 of the License, or | |
14 * (at your option) any later version. | |
15 * | |
16 * This program is distributed in the hope that it will be useful, | |
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 * GNU General Public License for more details. | |
20 * | |
21 * You should have received a copy of the GNU General Public License | |
22 * along with this program; if not, write to the Free Software | |
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
24 */ | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5866
diff
changeset
|
25 #include "internal.h" |
6837
f098765ac919
[gaim-migrate @ 7382]
Christian Hammond <chipx86@chipx86.com>
parents:
6719
diff
changeset
|
26 #include "conversation.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5866
diff
changeset
|
27 #include "debug.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5866
diff
changeset
|
28 #include "pounce.h" |
5866
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
29 |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
30 #include "debug.h" |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
31 #include "pounce.h" |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
32 #include "util.h" |
4687 | 33 |
5864
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
34 typedef struct |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
35 { |
5875
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
36 GString *buffer; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
37 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
38 GaimPounce *pounce; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
39 GaimPounceEvent events; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
40 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
41 char *ui_name; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
42 char *pouncee; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
43 char *protocol_id; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
44 char *event_type; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
45 char *action_name; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
46 char *param_name; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
47 char *account_name; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
48 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
49 } PounceParserData; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
50 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
51 typedef struct |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
52 { |
5864
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
53 char *name; |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
54 |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
55 gboolean enabled; |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
56 |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
57 GHashTable *atts; |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
58 |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
59 } GaimPounceActionData; |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
60 |
5875
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
61 typedef struct |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
62 { |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
63 char *ui; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
64 GaimPounceCb cb; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
65 void (*new_pounce)(GaimPounce *); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
66 void (*free_pounce)(GaimPounce *); |
5864
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
67 |
5875
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
68 } GaimPounceHandler; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
69 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
70 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
71 static GHashTable *pounce_handlers = NULL; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
72 static GList *pounces = NULL; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
73 static guint pounces_save_timer = 0; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
74 static gboolean pounces_loaded = FALSE; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
75 |
4687 | 76 |
5864
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
77 static GaimPounceActionData * |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
78 find_action_data(const GaimPounce *pounce, const char *name) |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
79 { |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
80 GaimPounceActionData *action; |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
81 |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
82 g_return_val_if_fail(pounce != NULL, NULL); |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
83 g_return_val_if_fail(name != NULL, NULL); |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
84 |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
85 action = g_hash_table_lookup(pounce->actions, name); |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
86 |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
87 return action; |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
88 } |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
89 |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
90 static void |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
91 free_action_data(gpointer data) |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
92 { |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
93 GaimPounceActionData *action_data = data; |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
94 |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
95 g_free(action_data->name); |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
96 |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
97 g_hash_table_destroy(action_data->atts); |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
98 |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
99 g_free(action_data); |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
100 } |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
101 |
5866
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
102 static gboolean |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
103 pounces_save_cb(gpointer unused) |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
104 { |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
105 gaim_pounces_sync(); |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
106 pounces_save_timer = 0; |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
107 |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
108 return FALSE; |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
109 } |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
110 |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
111 static void |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
112 schedule_pounces_save(void) |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
113 { |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
114 if (!pounces_save_timer) |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
115 pounces_save_timer = g_timeout_add(5000, pounces_save_cb, NULL); |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
116 } |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
117 |
5857
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
118 GaimPounce * |
5864
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
119 gaim_pounce_new(const char *ui_type, GaimAccount *pouncer, |
5875
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
120 const char *pouncee, GaimPounceEvent event) |
5032
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
121 { |
5857
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
122 GaimPounce *pounce; |
5875
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
123 GaimPounceHandler *handler; |
4687 | 124 |
5864
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
125 g_return_val_if_fail(ui_type != NULL, NULL); |
5857
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
126 g_return_val_if_fail(pouncer != NULL, NULL); |
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
127 g_return_val_if_fail(pouncee != NULL, NULL); |
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
128 g_return_val_if_fail(event != 0, NULL); |
4687 | 129 |
5857
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
130 pounce = g_new0(GaimPounce, 1); |
4687 | 131 |
5864
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
132 pounce->ui_type = g_strdup(ui_type); |
5032
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
133 pounce->pouncer = pouncer; |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
134 pounce->pouncee = g_strdup(pouncee); |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
135 pounce->events = event; |
4687 | 136 |
5864
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
137 pounce->actions = g_hash_table_new_full(g_str_hash, g_str_equal, |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
138 g_free, free_action_data); |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
139 |
5875
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
140 handler = g_hash_table_lookup(pounce_handlers, pounce->ui_type); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
141 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
142 if (handler != NULL && handler->new_pounce != NULL) |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
143 handler->new_pounce(pounce); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
144 |
5032
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
145 pounces = g_list_append(pounces, pounce); |
4687 | 146 |
5032
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
147 return pounce; |
4687 | 148 } |
149 | |
5032
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
150 void |
5857
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
151 gaim_pounce_destroy(GaimPounce *pounce) |
4687 | 152 { |
5875
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
153 GaimPounceHandler *handler; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
154 |
5857
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
155 g_return_if_fail(pounce != NULL); |
4687 | 156 |
5875
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
157 handler = g_hash_table_lookup(pounce_handlers, pounce->ui_type); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
158 |
5864
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
159 pounces = g_list_remove(pounces, pounce); |
4687 | 160 |
5864
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
161 if (pounce->ui_type != NULL) g_free(pounce->ui_type); |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
162 if (pounce->pouncee != NULL) g_free(pounce->pouncee); |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
163 |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
164 g_hash_table_destroy(pounce->actions); |
4687 | 165 |
5875
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
166 if (handler != NULL && handler->free_pounce != NULL) |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
167 handler->free_pounce(pounce); |
4687 | 168 |
5032
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
169 g_free(pounce); |
5866
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
170 |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
171 schedule_pounces_save(); |
4687 | 172 } |
4696 | 173 |
5032
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
174 void |
5857
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
175 gaim_pounce_set_events(GaimPounce *pounce, GaimPounceEvent events) |
4687 | 176 { |
5857
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
177 g_return_if_fail(pounce != NULL); |
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
178 g_return_if_fail(pounce != GAIM_POUNCE_NONE); |
4687 | 179 |
5032
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
180 pounce->events = events; |
5866
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
181 |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
182 schedule_pounces_save(); |
4687 | 183 } |
184 | |
5032
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
185 void |
5857
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
186 gaim_pounce_set_pouncer(GaimPounce *pounce, GaimAccount *pouncer) |
4687 | 187 { |
5857
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
188 g_return_if_fail(pounce != NULL); |
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
189 g_return_if_fail(pouncer != NULL); |
5032
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
190 |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
191 pounce->pouncer = pouncer; |
5866
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
192 |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
193 schedule_pounces_save(); |
5032
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
194 } |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
195 |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
196 void |
5857
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
197 gaim_pounce_set_pouncee(GaimPounce *pounce, const char *pouncee) |
5032
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
198 { |
5857
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
199 g_return_if_fail(pounce != NULL); |
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
200 g_return_if_fail(pouncee != NULL); |
5032
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
201 |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
202 if (pounce->pouncee != NULL) |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
203 g_free(pounce->pouncee); |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
204 |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
205 pounce->pouncee = (pouncee == NULL ? NULL : g_strdup(pouncee)); |
5866
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
206 |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
207 schedule_pounces_save(); |
4687 | 208 } |
209 | |
5032
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
210 void |
5864
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
211 gaim_pounce_set_save(GaimPounce *pounce, gboolean save) |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
212 { |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
213 g_return_if_fail(pounce != NULL); |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
214 |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
215 pounce->save = save; |
5866
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
216 |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
217 schedule_pounces_save(); |
5864
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
218 } |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
219 |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
220 void |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
221 gaim_pounce_action_register(GaimPounce *pounce, const char *name) |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
222 { |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
223 GaimPounceActionData *action_data; |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
224 |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
225 g_return_if_fail(pounce != NULL); |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
226 g_return_if_fail(name != NULL); |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
227 |
5943
a4f2aba0848d
[gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents:
5940
diff
changeset
|
228 if (g_hash_table_lookup(pounce->actions, name) != NULL) |
a4f2aba0848d
[gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents:
5940
diff
changeset
|
229 return; |
a4f2aba0848d
[gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents:
5940
diff
changeset
|
230 |
5864
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
231 action_data = g_new0(GaimPounceActionData, 1); |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
232 |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
233 action_data->name = g_strdup(name); |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
234 action_data->enabled = FALSE; |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
235 action_data->atts = g_hash_table_new_full(g_str_hash, g_str_equal, |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
236 g_free, g_free); |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
237 |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
238 g_hash_table_insert(pounce->actions, g_strdup(name), action_data); |
5866
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
239 |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
240 schedule_pounces_save(); |
5864
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
241 } |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
242 |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
243 void |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
244 gaim_pounce_action_set_enabled(GaimPounce *pounce, const char *action, |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
245 gboolean enabled) |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
246 { |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
247 GaimPounceActionData *action_data; |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
248 |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
249 g_return_if_fail(pounce != NULL); |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
250 g_return_if_fail(action != NULL); |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
251 |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
252 action_data = find_action_data(pounce, action); |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
253 |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
254 g_return_if_fail(action_data != NULL); |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
255 |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
256 action_data->enabled = enabled; |
5866
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
257 |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
258 schedule_pounces_save(); |
5864
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
259 } |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
260 |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
261 void |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
262 gaim_pounce_action_set_attribute(GaimPounce *pounce, const char *action, |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
263 const char *attr, const char *value) |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
264 { |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
265 GaimPounceActionData *action_data; |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
266 |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
267 g_return_if_fail(pounce != NULL); |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
268 g_return_if_fail(action != NULL); |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
269 g_return_if_fail(attr != NULL); |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
270 |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
271 action_data = find_action_data(pounce, action); |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
272 |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
273 g_return_if_fail(action_data != NULL); |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
274 |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
275 if (value == NULL) |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
276 g_hash_table_remove(action_data->atts, attr); |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
277 else |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
278 g_hash_table_insert(action_data->atts, g_strdup(attr), |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
279 g_strdup(value)); |
5866
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
280 |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
281 schedule_pounces_save(); |
5864
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
282 } |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
283 |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
284 void |
5857
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
285 gaim_pounce_set_data(GaimPounce *pounce, void *data) |
4687 | 286 { |
5857
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
287 g_return_if_fail(pounce != NULL); |
5032
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
288 |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
289 pounce->data = data; |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
290 } |
4687 | 291 |
5032
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
292 GaimPounceEvent |
5857
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
293 gaim_pounce_get_events(const GaimPounce *pounce) |
5032
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
294 { |
5857
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
295 g_return_val_if_fail(pounce != NULL, GAIM_POUNCE_NONE); |
4687 | 296 |
5032
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
297 return pounce->events; |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
298 } |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
299 |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
300 GaimAccount * |
5857
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
301 gaim_pounce_get_pouncer(const GaimPounce *pounce) |
5032
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
302 { |
5857
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
303 g_return_val_if_fail(pounce != NULL, NULL); |
4687 | 304 |
5032
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
305 return pounce->pouncer; |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
306 } |
4687 | 307 |
5032
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
308 const char * |
5857
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
309 gaim_pounce_get_pouncee(const GaimPounce *pounce) |
5032
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
310 { |
5857
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
311 g_return_val_if_fail(pounce != NULL, NULL); |
4687 | 312 |
5032
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
313 return pounce->pouncee; |
4687 | 314 } |
315 | |
5864
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
316 gboolean |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
317 gaim_pounce_get_save(const GaimPounce *pounce) |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
318 { |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
319 g_return_val_if_fail(pounce != NULL, FALSE); |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
320 |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
321 return pounce->save; |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
322 } |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
323 |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
324 gboolean |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
325 gaim_pounce_action_is_enabled(const GaimPounce *pounce, const char *action) |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
326 { |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
327 GaimPounceActionData *action_data; |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
328 |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
329 g_return_val_if_fail(pounce != NULL, FALSE); |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
330 g_return_val_if_fail(action != NULL, FALSE); |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
331 |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
332 action_data = find_action_data(pounce, action); |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
333 |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
334 g_return_val_if_fail(action_data != NULL, FALSE); |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
335 |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
336 return action_data->enabled; |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
337 } |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
338 |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
339 const char * |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
340 gaim_pounce_action_get_attribute(const GaimPounce *pounce, |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
341 const char *action, const char *attr) |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
342 { |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
343 GaimPounceActionData *action_data; |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
344 |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
345 g_return_val_if_fail(pounce != NULL, NULL); |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
346 g_return_val_if_fail(action != NULL, NULL); |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
347 g_return_val_if_fail(attr != NULL, NULL); |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
348 |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
349 action_data = find_action_data(pounce, action); |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
350 |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
351 g_return_val_if_fail(action_data != NULL, NULL); |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
352 |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
353 return g_hash_table_lookup(action_data->atts, attr); |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
354 } |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
355 |
5032
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
356 void * |
5857
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
357 gaim_pounce_get_data(const GaimPounce *pounce) |
5032
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
358 { |
5857
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
359 g_return_val_if_fail(pounce != NULL, NULL); |
4687 | 360 |
5032
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
361 return pounce->data; |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
362 } |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
363 |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
364 void |
5857
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
365 gaim_pounce_execute(const GaimAccount *pouncer, const char *pouncee, |
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
366 GaimPounceEvent events) |
4687 | 367 { |
5857
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
368 GaimPounce *pounce; |
5875
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
369 GaimPounceHandler *handler; |
5864
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
370 GList *l, *l_next; |
6719
3cc4d5e55a69
[gaim-migrate @ 7246]
Christian Hammond <chipx86@chipx86.com>
parents:
6444
diff
changeset
|
371 char *norm_pouncee; |
5032
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
372 |
5857
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
373 g_return_if_fail(pouncer != NULL); |
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
374 g_return_if_fail(pouncee != NULL); |
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
375 g_return_if_fail(events != GAIM_POUNCE_NONE); |
5032
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
376 |
7261 | 377 norm_pouncee = g_strdup(gaim_normalize(pouncer, pouncee)); |
6719
3cc4d5e55a69
[gaim-migrate @ 7246]
Christian Hammond <chipx86@chipx86.com>
parents:
6444
diff
changeset
|
378 |
3cc4d5e55a69
[gaim-migrate @ 7246]
Christian Hammond <chipx86@chipx86.com>
parents:
6444
diff
changeset
|
379 for (l = gaim_pounces_get_all(); l != NULL; l = l_next) |
3cc4d5e55a69
[gaim-migrate @ 7246]
Christian Hammond <chipx86@chipx86.com>
parents:
6444
diff
changeset
|
380 { |
5857
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
381 pounce = (GaimPounce *)l->data; |
5864
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
382 l_next = l->next; |
5032
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
383 |
5043
494a050318c7
[gaim-migrate @ 5390]
Christian Hammond <chipx86@chipx86.com>
parents:
5032
diff
changeset
|
384 if ((gaim_pounce_get_events(pounce) & events) && |
494a050318c7
[gaim-migrate @ 5390]
Christian Hammond <chipx86@chipx86.com>
parents:
5032
diff
changeset
|
385 (gaim_pounce_get_pouncer(pounce) == pouncer) && |
7261 | 386 !gaim_utf8_strcasecmp(gaim_normalize(pouncer, gaim_pounce_get_pouncee(pounce)), |
6719
3cc4d5e55a69
[gaim-migrate @ 7246]
Christian Hammond <chipx86@chipx86.com>
parents:
6444
diff
changeset
|
387 norm_pouncee)) |
3cc4d5e55a69
[gaim-migrate @ 7246]
Christian Hammond <chipx86@chipx86.com>
parents:
6444
diff
changeset
|
388 { |
5875
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
389 handler = g_hash_table_lookup(pounce_handlers, pounce->ui_type); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
390 |
6719
3cc4d5e55a69
[gaim-migrate @ 7246]
Christian Hammond <chipx86@chipx86.com>
parents:
6444
diff
changeset
|
391 if (handler != NULL && handler->cb != NULL) |
3cc4d5e55a69
[gaim-migrate @ 7246]
Christian Hammond <chipx86@chipx86.com>
parents:
6444
diff
changeset
|
392 { |
5875
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
393 handler->cb(pounce, events, gaim_pounce_get_data(pounce)); |
5864
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
394 |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
395 if (!gaim_pounce_get_save(pounce)) |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
396 gaim_pounce_destroy(pounce); |
417b1001d2b1
[gaim-migrate @ 6295]
Christian Hammond <chipx86@chipx86.com>
parents:
5857
diff
changeset
|
397 } |
5043
494a050318c7
[gaim-migrate @ 5390]
Christian Hammond <chipx86@chipx86.com>
parents:
5032
diff
changeset
|
398 } |
494a050318c7
[gaim-migrate @ 5390]
Christian Hammond <chipx86@chipx86.com>
parents:
5032
diff
changeset
|
399 } |
6719
3cc4d5e55a69
[gaim-migrate @ 7246]
Christian Hammond <chipx86@chipx86.com>
parents:
6444
diff
changeset
|
400 |
3cc4d5e55a69
[gaim-migrate @ 7246]
Christian Hammond <chipx86@chipx86.com>
parents:
6444
diff
changeset
|
401 g_free(norm_pouncee); |
5032
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
402 } |
4687 | 403 |
5857
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
404 GaimPounce * |
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
405 gaim_find_pounce(const GaimAccount *pouncer, const char *pouncee, |
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
406 GaimPounceEvent events) |
5032
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
407 { |
6719
3cc4d5e55a69
[gaim-migrate @ 7246]
Christian Hammond <chipx86@chipx86.com>
parents:
6444
diff
changeset
|
408 GaimPounce *pounce = NULL; |
5032
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
409 GList *l; |
6719
3cc4d5e55a69
[gaim-migrate @ 7246]
Christian Hammond <chipx86@chipx86.com>
parents:
6444
diff
changeset
|
410 char *norm_pouncee; |
5032
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
411 |
5857
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
412 g_return_val_if_fail(pouncer != NULL, NULL); |
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
413 g_return_val_if_fail(pouncee != NULL, NULL); |
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
414 g_return_val_if_fail(events != GAIM_POUNCE_NONE, NULL); |
5032
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
415 |
7261 | 416 norm_pouncee = g_strdup(gaim_normalize(pouncer, pouncee)); |
6719
3cc4d5e55a69
[gaim-migrate @ 7246]
Christian Hammond <chipx86@chipx86.com>
parents:
6444
diff
changeset
|
417 |
3cc4d5e55a69
[gaim-migrate @ 7246]
Christian Hammond <chipx86@chipx86.com>
parents:
6444
diff
changeset
|
418 for (l = gaim_pounces_get_all(); l != NULL; l = l->next) |
3cc4d5e55a69
[gaim-migrate @ 7246]
Christian Hammond <chipx86@chipx86.com>
parents:
6444
diff
changeset
|
419 { |
5857
2fa4aa9c1885
[gaim-migrate @ 6288]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
420 pounce = (GaimPounce *)l->data; |
5032
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
421 |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
422 if ((gaim_pounce_get_events(pounce) & events) && |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
423 (gaim_pounce_get_pouncer(pounce) == pouncer) && |
7261 | 424 !gaim_utf8_strcasecmp(gaim_normalize(pouncer, gaim_pounce_get_pouncee(pounce)), |
6719
3cc4d5e55a69
[gaim-migrate @ 7246]
Christian Hammond <chipx86@chipx86.com>
parents:
6444
diff
changeset
|
425 norm_pouncee)) |
3cc4d5e55a69
[gaim-migrate @ 7246]
Christian Hammond <chipx86@chipx86.com>
parents:
6444
diff
changeset
|
426 { |
3cc4d5e55a69
[gaim-migrate @ 7246]
Christian Hammond <chipx86@chipx86.com>
parents:
6444
diff
changeset
|
427 break; |
3cc4d5e55a69
[gaim-migrate @ 7246]
Christian Hammond <chipx86@chipx86.com>
parents:
6444
diff
changeset
|
428 } |
5032
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
429 |
6719
3cc4d5e55a69
[gaim-migrate @ 7246]
Christian Hammond <chipx86@chipx86.com>
parents:
6444
diff
changeset
|
430 pounce = NULL; |
4687 | 431 } |
432 | |
6719
3cc4d5e55a69
[gaim-migrate @ 7246]
Christian Hammond <chipx86@chipx86.com>
parents:
6444
diff
changeset
|
433 g_free(norm_pouncee); |
3cc4d5e55a69
[gaim-migrate @ 7246]
Christian Hammond <chipx86@chipx86.com>
parents:
6444
diff
changeset
|
434 |
3cc4d5e55a69
[gaim-migrate @ 7246]
Christian Hammond <chipx86@chipx86.com>
parents:
6444
diff
changeset
|
435 return pounce; |
4687 | 436 } |
437 | |
5875
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
438 /* XML Stuff */ |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
439 static void |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
440 free_parser_data(gpointer user_data) |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
441 { |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
442 PounceParserData *data = user_data; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
443 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
444 if (data->buffer != NULL) |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
445 g_string_free(data->buffer, TRUE); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
446 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
447 if (data->ui_name != NULL) g_free(data->ui_name); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
448 if (data->pouncee != NULL) g_free(data->pouncee); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
449 if (data->protocol_id != NULL) g_free(data->protocol_id); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
450 if (data->event_type != NULL) g_free(data->event_type); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
451 if (data->action_name != NULL) g_free(data->action_name); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
452 if (data->param_name != NULL) g_free(data->param_name); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
453 if (data->account_name != NULL) g_free(data->account_name); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
454 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
455 g_free(data); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
456 } |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
457 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
458 static void |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
459 start_element_handler(GMarkupParseContext *context, |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
460 const gchar *element_name, |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
461 const gchar **attribute_names, |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
462 const gchar **attribute_values, |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
463 gpointer user_data, GError **error) |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
464 { |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
465 PounceParserData *data = user_data; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
466 GHashTable *atts; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
467 int i; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
468 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
469 atts = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
470 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
471 for (i = 0; attribute_names[i] != NULL; i++) { |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
472 g_hash_table_insert(atts, g_strdup(attribute_names[i]), |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
473 g_strdup(attribute_values[i])); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
474 } |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
475 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
476 if (data->buffer != NULL) { |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
477 g_string_free(data->buffer, TRUE); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
478 data->buffer = NULL; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
479 } |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
480 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
481 if (!strcmp(element_name, "pounce")) { |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
482 const char *ui = g_hash_table_lookup(atts, "ui"); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
483 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
484 if (ui == NULL) { |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
485 gaim_debug(GAIM_DEBUG_ERROR, "pounce", |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
486 "Unset 'ui' parameter for pounce!\n"); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
487 } |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
488 else |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
489 data->ui_name = g_strdup(ui); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
490 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
491 data->events = 0; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
492 } |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
493 else if (!strcmp(element_name, "account")) { |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
494 const char *protocol_id = g_hash_table_lookup(atts, "protocol"); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
495 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
496 if (protocol_id == NULL) { |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
497 gaim_debug(GAIM_DEBUG_ERROR, "pounce", |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
498 "Unset 'protocol' parameter for account!\n"); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
499 } |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
500 else |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
501 data->protocol_id = g_strdup(protocol_id); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
502 } |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
503 else if (!strcmp(element_name, "event")) { |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
504 const char *type = g_hash_table_lookup(atts, "type"); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
505 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
506 if (type == NULL) { |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
507 gaim_debug(GAIM_DEBUG_ERROR, "pounce", |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
508 "Unset 'type' parameter for event!\n"); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
509 } |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
510 else |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
511 data->event_type = g_strdup(type); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
512 } |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
513 else if (!strcmp(element_name, "action")) { |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
514 const char *type = g_hash_table_lookup(atts, "type"); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
515 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
516 if (type == NULL) { |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
517 gaim_debug(GAIM_DEBUG_ERROR, "pounce", |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
518 "Unset 'type' parameter for action!\n"); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
519 } |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
520 else |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
521 data->action_name = g_strdup(type); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
522 } |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
523 else if (!strcmp(element_name, "param")) { |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
524 const char *param_name = g_hash_table_lookup(atts, "name"); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
525 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
526 if (param_name == NULL) { |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
527 gaim_debug(GAIM_DEBUG_ERROR, "pounce", |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
528 "Unset 'name' parameter for param!\n"); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
529 } |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
530 else |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
531 data->param_name = g_strdup(param_name); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
532 } |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
533 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
534 g_hash_table_destroy(atts); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
535 } |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
536 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
537 static void |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
538 end_element_handler(GMarkupParseContext *context, const gchar *element_name, |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
539 gpointer user_data, GError **error) |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
540 { |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
541 PounceParserData *data = user_data; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
542 gchar *buffer = NULL; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
543 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
544 if (data->buffer != NULL) { |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
545 buffer = g_string_free(data->buffer, FALSE); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
546 data->buffer = NULL; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
547 } |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
548 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
549 if (!strcmp(element_name, "account")) { |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
550 data->account_name = g_strdup(buffer); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
551 } |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
552 else if (!strcmp(element_name, "pouncee")) { |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
553 data->pouncee = g_strdup(buffer); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
554 } |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
555 else if (!strcmp(element_name, "event")) { |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
556 if (!strcmp(data->event_type, "sign-on")) |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
557 data->events |= GAIM_POUNCE_SIGNON; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
558 else if (!strcmp(data->event_type, "sign-off")) |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
559 data->events |= GAIM_POUNCE_SIGNOFF; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
560 else if (!strcmp(data->event_type, "away")) |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
561 data->events |= GAIM_POUNCE_AWAY; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
562 else if (!strcmp(data->event_type, "return-from-away")) |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
563 data->events |= GAIM_POUNCE_AWAY_RETURN; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
564 else if (!strcmp(data->event_type, "idle")) |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
565 data->events |= GAIM_POUNCE_IDLE; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
566 else if (!strcmp(data->event_type, "return-from-idle")) |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
567 data->events |= GAIM_POUNCE_IDLE_RETURN; |
6444
601c2a52d74a
[gaim-migrate @ 6953]
Christian Hammond <chipx86@chipx86.com>
parents:
6271
diff
changeset
|
568 else if (!strcmp(data->event_type, "start-typing")) |
5875
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
569 data->events |= GAIM_POUNCE_TYPING; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
570 else if (!strcmp(data->event_type, "stop-typing")) |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
571 data->events |= GAIM_POUNCE_TYPING_STOPPED; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
572 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
573 g_free(data->event_type); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
574 data->event_type = NULL; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
575 } |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
576 else if (!strcmp(element_name, "action")) { |
5943
a4f2aba0848d
[gaim-migrate @ 6384]
Christian Hammond <chipx86@chipx86.com>
parents:
5940
diff
changeset
|
577 gaim_pounce_action_register(data->pounce, data->action_name); |
5875
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
578 gaim_pounce_action_set_enabled(data->pounce, data->action_name, TRUE); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
579 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
580 g_free(data->action_name); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
581 data->action_name = NULL; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
582 } |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
583 else if (!strcmp(element_name, "param")) { |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
584 gaim_pounce_action_set_attribute(data->pounce, data->action_name, |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
585 data->param_name, buffer); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
586 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
587 g_free(data->param_name); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
588 data->param_name = NULL; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
589 } |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
590 else if (!strcmp(element_name, "events")) { |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
591 GaimAccount *account; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
592 |
7132 | 593 account = gaim_accounts_find(data->account_name, data->protocol_id); |
5875
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
594 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
595 g_free(data->account_name); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
596 g_free(data->protocol_id); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
597 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
598 data->account_name = NULL; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
599 data->protocol_id = NULL; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
600 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
601 if (account == NULL) { |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
602 gaim_debug(GAIM_DEBUG_ERROR, "pounce", |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
603 "Account for pounce not found!\n"); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
604 } |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
605 else { |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
606 gaim_debug(GAIM_DEBUG_INFO, "pounce", |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
607 "Creating pounce: %s, %s\n", data->ui_name, |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
608 data->pouncee); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
609 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
610 data->pounce = gaim_pounce_new(data->ui_name, account, |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
611 data->pouncee, data->events); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
612 } |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
613 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
614 g_free(data->pouncee); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
615 data->pouncee = NULL; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
616 } |
5878
9e54bb2ee3b5
[gaim-migrate @ 6310]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
617 else if (!strcmp(element_name, "save")) { |
9e54bb2ee3b5
[gaim-migrate @ 6310]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
618 gaim_pounce_set_save(data->pounce, TRUE); |
9e54bb2ee3b5
[gaim-migrate @ 6310]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
619 } |
5875
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
620 else if (!strcmp(element_name, "pounce")) { |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
621 data->pounce = NULL; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
622 data->events = 0; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
623 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
624 if (data->ui_name != NULL) g_free(data->ui_name); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
625 if (data->pouncee != NULL) g_free(data->pouncee); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
626 if (data->protocol_id != NULL) g_free(data->protocol_id); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
627 if (data->event_type != NULL) g_free(data->event_type); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
628 if (data->action_name != NULL) g_free(data->action_name); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
629 if (data->param_name != NULL) g_free(data->param_name); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
630 if (data->account_name != NULL) g_free(data->account_name); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
631 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
632 data->ui_name = NULL; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
633 data->pounce = NULL; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
634 data->protocol_id = NULL; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
635 data->event_type = NULL; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
636 data->action_name = NULL; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
637 data->param_name = NULL; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
638 data->account_name = NULL; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
639 } |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
640 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
641 if (buffer != NULL) |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
642 g_free(buffer); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
643 } |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
644 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
645 static void |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
646 text_handler(GMarkupParseContext *context, const gchar *text, |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
647 gsize text_len, gpointer user_data, GError **error) |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
648 { |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
649 PounceParserData *data = user_data; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
650 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
651 if (data->buffer == NULL) |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
652 data->buffer = g_string_new_len(text, text_len); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
653 else |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
654 g_string_append_len(data->buffer, text, text_len); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
655 } |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
656 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
657 static GMarkupParser pounces_parser = |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
658 { |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
659 start_element_handler, |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
660 end_element_handler, |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
661 text_handler, |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
662 NULL, |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
663 NULL |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
664 }; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
665 |
5866
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
666 gboolean |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
667 gaim_pounces_load(void) |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
668 { |
5875
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
669 gchar *filename = g_build_filename(gaim_user_dir(), "pounces.xml", NULL); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
670 gchar *contents = NULL; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
671 gsize length; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
672 GMarkupParseContext *context; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
673 GError *error = NULL; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
674 PounceParserData *parser_data; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
675 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
676 if (filename == NULL) { |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
677 pounces_loaded = TRUE; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
678 return FALSE; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
679 } |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
680 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
681 if (!g_file_get_contents(filename, &contents, &length, &error)) { |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
682 gaim_debug(GAIM_DEBUG_ERROR, "pounces", |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
683 "Error reading pounces: %s\n", error->message); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
684 |
5940 | 685 g_free(filename); |
5875
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
686 g_error_free(error); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
687 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
688 pounces_loaded = TRUE; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
689 return FALSE; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
690 } |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
691 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
692 parser_data = g_new0(PounceParserData, 1); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
693 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
694 context = g_markup_parse_context_new(&pounces_parser, 0, |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
695 parser_data, free_parser_data); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
696 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
697 if (!g_markup_parse_context_parse(context, contents, length, NULL)) { |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
698 g_markup_parse_context_free(context); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
699 g_free(contents); |
5940 | 700 g_free(filename); |
5875
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
701 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
702 pounces_loaded = TRUE; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
703 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
704 return FALSE; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
705 } |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
706 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
707 if (!g_markup_parse_context_end_parse(context, NULL)) { |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
708 gaim_debug(GAIM_DEBUG_ERROR, "pounces", "Error parsing %s\n", |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
709 filename); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
710 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
711 g_markup_parse_context_free(context); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
712 g_free(contents); |
5940 | 713 g_free(filename); |
5875
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
714 pounces_loaded = TRUE; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
715 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
716 return FALSE; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
717 } |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
718 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
719 g_markup_parse_context_free(context); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
720 g_free(contents); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
721 g_free(filename); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
722 |
5866
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
723 pounces_loaded = TRUE; |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
724 |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
725 return TRUE; |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
726 } |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
727 |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
728 static void |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
729 write_action_parameter(gpointer key, gpointer value, gpointer user_data) |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
730 { |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
731 const char *name, *param_value; |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
732 FILE *fp; |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
733 |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
734 param_value = (const char *)value; |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
735 name = (const char *)key; |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
736 fp = (FILE *)user_data; |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
737 |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
738 fprintf(fp, " <param name='%s'>%s</param>\n", name, param_value); |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
739 } |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
740 |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
741 static void |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
742 write_action_parameter_list(gpointer key, gpointer value, gpointer user_data) |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
743 { |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
744 GaimPounceActionData *action_data; |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
745 const char *action; |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
746 FILE *fp; |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
747 |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
748 action_data = (GaimPounceActionData *)value; |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
749 action = (const char *)key; |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
750 fp = (FILE *)user_data; |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
751 |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
752 if (!action_data->enabled) |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
753 return; |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
754 |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
755 fprintf(fp, " <action type='%s'", action); |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
756 |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
757 if (g_hash_table_size(action_data->atts) == 0) { |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
758 fprintf(fp, "/>\n"); |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
759 } |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
760 else { |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
761 fprintf(fp, ">\n"); |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
762 |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
763 g_hash_table_foreach(action_data->atts, write_action_parameter, fp); |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
764 |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
765 fprintf(fp, " </action>\n"); |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
766 } |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
767 } |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
768 |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
769 static void |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
770 gaim_pounces_write(FILE *fp, GaimPounce *pounce) |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
771 { |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
772 GaimAccount *pouncer; |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
773 GaimPounceEvent events; |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
774 char *pouncer_name; |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
775 |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
776 pouncer = gaim_pounce_get_pouncer(pounce); |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
777 events = gaim_pounce_get_events(pounce); |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
778 |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
779 pouncer_name = g_markup_escape_text(gaim_account_get_username(pouncer), -1); |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
780 |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
781 fprintf(fp, " <pounce ui='%s'>\n", pounce->ui_type); |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
782 fprintf(fp, " <account protocol='%s'>%s</account>\n", |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
783 pouncer->protocol_id, pouncer_name); |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
784 fprintf(fp, " <pouncee>%s</pouncee>\n", gaim_pounce_get_pouncee(pounce)); |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
785 fprintf(fp, " <events>\n"); |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
786 |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
787 if (events & GAIM_POUNCE_SIGNON) |
5875
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
788 fprintf(fp, " <event type='sign-on'/>\n"); |
5866
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
789 if (events & GAIM_POUNCE_SIGNOFF) |
5875
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
790 fprintf(fp, " <event type='sign-off'/>\n"); |
5866
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
791 if (events & GAIM_POUNCE_AWAY) |
5875
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
792 fprintf(fp, " <event type='away'/>\n"); |
5866
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
793 if (events & GAIM_POUNCE_AWAY_RETURN) |
5875
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
794 fprintf(fp, " <event type='return-from-away'/>\n"); |
5866
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
795 if (events & GAIM_POUNCE_IDLE) |
5875
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
796 fprintf(fp, " <event type='idle'/>\n"); |
5866
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
797 if (events & GAIM_POUNCE_IDLE_RETURN) |
5875
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
798 fprintf(fp, " <event type='return-from-idle'/>\n"); |
5866
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
799 if (events & GAIM_POUNCE_TYPING) |
5875
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
800 fprintf(fp, " <event type='start-typing'/>\n"); |
5866
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
801 if (events & GAIM_POUNCE_TYPING_STOPPED) |
5875
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
802 fprintf(fp, " <event type='stop-typing'/>\n"); |
5866
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
803 |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
804 fprintf(fp, " </events>\n"); |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
805 fprintf(fp, " <actions>\n"); |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
806 |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
807 g_hash_table_foreach(pounce->actions, write_action_parameter_list, fp); |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
808 |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
809 fprintf(fp, " </actions>\n"); |
5878
9e54bb2ee3b5
[gaim-migrate @ 6310]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
810 |
9e54bb2ee3b5
[gaim-migrate @ 6310]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
811 if (gaim_pounce_get_save(pounce)) |
9e54bb2ee3b5
[gaim-migrate @ 6310]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
812 fprintf(fp, " <save/>\n"); |
9e54bb2ee3b5
[gaim-migrate @ 6310]
Christian Hammond <chipx86@chipx86.com>
parents:
5875
diff
changeset
|
813 |
5866
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
814 fprintf(fp, " </pounce>\n"); |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
815 |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
816 g_free(pouncer_name); |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
817 } |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
818 |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
819 void |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
820 gaim_pounces_sync(void) |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
821 { |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
822 FILE *fp; |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
823 const char *user_dir = gaim_user_dir(); |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
824 char *filename; |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
825 char *filename_real; |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
826 |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
827 if (!pounces_loaded) { |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
828 gaim_debug(GAIM_DEBUG_WARNING, "pounces", |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
829 "Writing pounces to disk.\n"); |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
830 schedule_pounces_save(); |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
831 return; |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
832 } |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
833 |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
834 if (user_dir == NULL) |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
835 return; |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
836 |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
837 gaim_debug(GAIM_DEBUG_INFO, "pounces", "Writing pounces to disk.\n"); |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
838 |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
839 fp = fopen(user_dir, "r"); |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
840 |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
841 if (fp == NULL) |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
842 mkdir(user_dir, S_IRUSR | S_IWUSR | S_IXUSR); |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
843 else |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
844 fclose(fp); |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
845 |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
846 filename = g_build_filename(user_dir, "pounces.xml.save", NULL); |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
847 |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
848 if ((fp = fopen(filename, "w")) != NULL) { |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
849 GList *l; |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
850 |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
851 fprintf(fp, "<?xml version='1.0' encoding='UTF-8' ?>\n\n"); |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
852 fprintf(fp, "<pounces>\n"); |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
853 |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
854 for (l = gaim_pounces_get_all(); l != NULL; l = l->next) |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
855 gaim_pounces_write(fp, l->data); |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
856 |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
857 fprintf(fp, "</pounces>\n"); |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
858 |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
859 fclose(fp); |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
860 chmod(filename, S_IRUSR | S_IWUSR); |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
861 } |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
862 else { |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
863 gaim_debug(GAIM_DEBUG_ERROR, "pounces", "Unable to write %s\n", |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
864 filename); |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
865 } |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
866 |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
867 filename_real = g_build_filename(user_dir, "pounces.xml", NULL); |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
868 |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
869 if (rename(filename, filename_real) < 0) { |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
870 gaim_debug(GAIM_DEBUG_ERROR, "pounces", "Error renaming %s to %s\n", |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
871 filename, filename_real); |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
872 } |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
873 |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
874 g_free(filename); |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
875 g_free(filename_real); |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
876 } |
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
877 |
5875
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
878 void |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
879 gaim_pounces_register_handler(const char *ui, GaimPounceCb cb, |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
880 void (*new_pounce)(GaimPounce *pounce), |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
881 void (*free_pounce)(GaimPounce *pounce)) |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
882 { |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
883 GaimPounceHandler *handler; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
884 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
885 g_return_if_fail(ui != NULL); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
886 g_return_if_fail(cb != NULL); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
887 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
888 handler = g_new0(GaimPounceHandler, 1); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
889 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
890 handler->ui = g_strdup(ui); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
891 handler->cb = cb; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
892 handler->new_pounce = new_pounce; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
893 handler->free_pounce = free_pounce; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
894 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
895 g_hash_table_insert(pounce_handlers, g_strdup(ui), handler); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
896 } |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
897 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
898 void |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
899 gaim_pounces_unregister_handler(const char *ui) |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
900 { |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
901 g_return_if_fail(ui != NULL); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
902 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
903 g_hash_table_remove(pounce_handlers, ui); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
904 } |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
905 |
5032
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
906 GList * |
5866
d6b5cab288bb
[gaim-migrate @ 6297]
Christian Hammond <chipx86@chipx86.com>
parents:
5864
diff
changeset
|
907 gaim_pounces_get_all(void) |
5032
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
908 { |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
909 return pounces; |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4793
diff
changeset
|
910 } |
5875
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
911 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
912 static void |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
913 free_pounce_handler(gpointer user_data) |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
914 { |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
915 GaimPounceHandler *handler = (GaimPounceHandler *)user_data; |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
916 |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
917 g_free(handler->ui); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
918 g_free(handler); |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
919 } |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
920 |
6837
f098765ac919
[gaim-migrate @ 7382]
Christian Hammond <chipx86@chipx86.com>
parents:
6719
diff
changeset
|
921 static void |
f098765ac919
[gaim-migrate @ 7382]
Christian Hammond <chipx86@chipx86.com>
parents:
6719
diff
changeset
|
922 buddy_state_cb(GaimBuddy *buddy, GaimPounceEvent event) |
f098765ac919
[gaim-migrate @ 7382]
Christian Hammond <chipx86@chipx86.com>
parents:
6719
diff
changeset
|
923 { |
f098765ac919
[gaim-migrate @ 7382]
Christian Hammond <chipx86@chipx86.com>
parents:
6719
diff
changeset
|
924 gaim_pounce_execute(buddy->account, buddy->name, event); |
f098765ac919
[gaim-migrate @ 7382]
Christian Hammond <chipx86@chipx86.com>
parents:
6719
diff
changeset
|
925 } |
f098765ac919
[gaim-migrate @ 7382]
Christian Hammond <chipx86@chipx86.com>
parents:
6719
diff
changeset
|
926 |
f098765ac919
[gaim-migrate @ 7382]
Christian Hammond <chipx86@chipx86.com>
parents:
6719
diff
changeset
|
927 static void |
f098765ac919
[gaim-migrate @ 7382]
Christian Hammond <chipx86@chipx86.com>
parents:
6719
diff
changeset
|
928 buddy_typing_cb(GaimConversation *conv, void *data) |
f098765ac919
[gaim-migrate @ 7382]
Christian Hammond <chipx86@chipx86.com>
parents:
6719
diff
changeset
|
929 { |
f098765ac919
[gaim-migrate @ 7382]
Christian Hammond <chipx86@chipx86.com>
parents:
6719
diff
changeset
|
930 GaimAccount *account = gaim_conversation_get_account(conv); |
f098765ac919
[gaim-migrate @ 7382]
Christian Hammond <chipx86@chipx86.com>
parents:
6719
diff
changeset
|
931 const char *name = gaim_conversation_get_name(conv); |
f098765ac919
[gaim-migrate @ 7382]
Christian Hammond <chipx86@chipx86.com>
parents:
6719
diff
changeset
|
932 |
f098765ac919
[gaim-migrate @ 7382]
Christian Hammond <chipx86@chipx86.com>
parents:
6719
diff
changeset
|
933 if (gaim_find_buddy(account, name) != NULL) |
f098765ac919
[gaim-migrate @ 7382]
Christian Hammond <chipx86@chipx86.com>
parents:
6719
diff
changeset
|
934 { |
f098765ac919
[gaim-migrate @ 7382]
Christian Hammond <chipx86@chipx86.com>
parents:
6719
diff
changeset
|
935 GaimPounceEvent event; |
f098765ac919
[gaim-migrate @ 7382]
Christian Hammond <chipx86@chipx86.com>
parents:
6719
diff
changeset
|
936 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
937 event = (gaim_conv_im_get_typing_state(GAIM_CONV_IM(conv)) == GAIM_TYPING |
6837
f098765ac919
[gaim-migrate @ 7382]
Christian Hammond <chipx86@chipx86.com>
parents:
6719
diff
changeset
|
938 ? GAIM_POUNCE_TYPING : GAIM_POUNCE_TYPING_STOPPED); |
f098765ac919
[gaim-migrate @ 7382]
Christian Hammond <chipx86@chipx86.com>
parents:
6719
diff
changeset
|
939 |
f098765ac919
[gaim-migrate @ 7382]
Christian Hammond <chipx86@chipx86.com>
parents:
6719
diff
changeset
|
940 gaim_pounce_execute(account, name, event); |
f098765ac919
[gaim-migrate @ 7382]
Christian Hammond <chipx86@chipx86.com>
parents:
6719
diff
changeset
|
941 } |
f098765ac919
[gaim-migrate @ 7382]
Christian Hammond <chipx86@chipx86.com>
parents:
6719
diff
changeset
|
942 } |
f098765ac919
[gaim-migrate @ 7382]
Christian Hammond <chipx86@chipx86.com>
parents:
6719
diff
changeset
|
943 |
f098765ac919
[gaim-migrate @ 7382]
Christian Hammond <chipx86@chipx86.com>
parents:
6719
diff
changeset
|
944 void * |
f098765ac919
[gaim-migrate @ 7382]
Christian Hammond <chipx86@chipx86.com>
parents:
6719
diff
changeset
|
945 gaim_pounces_get_handle(void) |
f098765ac919
[gaim-migrate @ 7382]
Christian Hammond <chipx86@chipx86.com>
parents:
6719
diff
changeset
|
946 { |
f098765ac919
[gaim-migrate @ 7382]
Christian Hammond <chipx86@chipx86.com>
parents:
6719
diff
changeset
|
947 static int pounce_handle; |
f098765ac919
[gaim-migrate @ 7382]
Christian Hammond <chipx86@chipx86.com>
parents:
6719
diff
changeset
|
948 |
f098765ac919
[gaim-migrate @ 7382]
Christian Hammond <chipx86@chipx86.com>
parents:
6719
diff
changeset
|
949 return &pounce_handle; |
f098765ac919
[gaim-migrate @ 7382]
Christian Hammond <chipx86@chipx86.com>
parents:
6719
diff
changeset
|
950 } |
f098765ac919
[gaim-migrate @ 7382]
Christian Hammond <chipx86@chipx86.com>
parents:
6719
diff
changeset
|
951 |
5875
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
952 void |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
953 gaim_pounces_init(void) |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
954 { |
6837
f098765ac919
[gaim-migrate @ 7382]
Christian Hammond <chipx86@chipx86.com>
parents:
6719
diff
changeset
|
955 void *blist_handle = gaim_blist_get_handle(); |
f098765ac919
[gaim-migrate @ 7382]
Christian Hammond <chipx86@chipx86.com>
parents:
6719
diff
changeset
|
956 void *conv_handle = gaim_conversations_get_handle(); |
f098765ac919
[gaim-migrate @ 7382]
Christian Hammond <chipx86@chipx86.com>
parents:
6719
diff
changeset
|
957 void *handle = gaim_pounces_get_handle(); |
f098765ac919
[gaim-migrate @ 7382]
Christian Hammond <chipx86@chipx86.com>
parents:
6719
diff
changeset
|
958 |
5875
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
959 pounce_handlers = g_hash_table_new_full(g_str_hash, g_str_equal, |
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
960 g_free, free_pounce_handler); |
6837
f098765ac919
[gaim-migrate @ 7382]
Christian Hammond <chipx86@chipx86.com>
parents:
6719
diff
changeset
|
961 |
f098765ac919
[gaim-migrate @ 7382]
Christian Hammond <chipx86@chipx86.com>
parents:
6719
diff
changeset
|
962 gaim_signal_connect(blist_handle, "buddy-idle", |
f098765ac919
[gaim-migrate @ 7382]
Christian Hammond <chipx86@chipx86.com>
parents:
6719
diff
changeset
|
963 handle, GAIM_CALLBACK(buddy_state_cb), |
f098765ac919
[gaim-migrate @ 7382]
Christian Hammond <chipx86@chipx86.com>
parents:
6719
diff
changeset
|
964 GINT_TO_POINTER(GAIM_POUNCE_IDLE)); |
f098765ac919
[gaim-migrate @ 7382]
Christian Hammond <chipx86@chipx86.com>
parents:
6719
diff
changeset
|
965 gaim_signal_connect(blist_handle, "buddy-unidle", |
f098765ac919
[gaim-migrate @ 7382]
Christian Hammond <chipx86@chipx86.com>
parents:
6719
diff
changeset
|
966 handle, GAIM_CALLBACK(buddy_state_cb), |
7627 | 967 GINT_TO_POINTER(GAIM_POUNCE_IDLE_RETURN)); |
6837
f098765ac919
[gaim-migrate @ 7382]
Christian Hammond <chipx86@chipx86.com>
parents:
6719
diff
changeset
|
968 gaim_signal_connect(blist_handle, "buddy-away", |
f098765ac919
[gaim-migrate @ 7382]
Christian Hammond <chipx86@chipx86.com>
parents:
6719
diff
changeset
|
969 handle, GAIM_CALLBACK(buddy_state_cb), |
f098765ac919
[gaim-migrate @ 7382]
Christian Hammond <chipx86@chipx86.com>
parents:
6719
diff
changeset
|
970 GINT_TO_POINTER(GAIM_POUNCE_AWAY)); |
f098765ac919
[gaim-migrate @ 7382]
Christian Hammond <chipx86@chipx86.com>
parents:
6719
diff
changeset
|
971 gaim_signal_connect(blist_handle, "buddy-back", |
f098765ac919
[gaim-migrate @ 7382]
Christian Hammond <chipx86@chipx86.com>
parents:
6719
diff
changeset
|
972 handle, GAIM_CALLBACK(buddy_state_cb), |
f098765ac919
[gaim-migrate @ 7382]
Christian Hammond <chipx86@chipx86.com>
parents:
6719
diff
changeset
|
973 GINT_TO_POINTER(GAIM_POUNCE_AWAY_RETURN)); |
f098765ac919
[gaim-migrate @ 7382]
Christian Hammond <chipx86@chipx86.com>
parents:
6719
diff
changeset
|
974 gaim_signal_connect(blist_handle, "buddy-signed-on", |
f098765ac919
[gaim-migrate @ 7382]
Christian Hammond <chipx86@chipx86.com>
parents:
6719
diff
changeset
|
975 handle, GAIM_CALLBACK(buddy_state_cb), |
f098765ac919
[gaim-migrate @ 7382]
Christian Hammond <chipx86@chipx86.com>
parents:
6719
diff
changeset
|
976 GINT_TO_POINTER(GAIM_POUNCE_SIGNON)); |
f098765ac919
[gaim-migrate @ 7382]
Christian Hammond <chipx86@chipx86.com>
parents:
6719
diff
changeset
|
977 gaim_signal_connect(blist_handle, "buddy-signed-off", |
f098765ac919
[gaim-migrate @ 7382]
Christian Hammond <chipx86@chipx86.com>
parents:
6719
diff
changeset
|
978 handle, GAIM_CALLBACK(buddy_state_cb), |
f098765ac919
[gaim-migrate @ 7382]
Christian Hammond <chipx86@chipx86.com>
parents:
6719
diff
changeset
|
979 GINT_TO_POINTER(GAIM_POUNCE_SIGNOFF)); |
f098765ac919
[gaim-migrate @ 7382]
Christian Hammond <chipx86@chipx86.com>
parents:
6719
diff
changeset
|
980 |
f098765ac919
[gaim-migrate @ 7382]
Christian Hammond <chipx86@chipx86.com>
parents:
6719
diff
changeset
|
981 gaim_signal_connect(conv_handle, "buddy-typing", |
f098765ac919
[gaim-migrate @ 7382]
Christian Hammond <chipx86@chipx86.com>
parents:
6719
diff
changeset
|
982 handle, GAIM_CALLBACK(buddy_typing_cb), NULL); |
f098765ac919
[gaim-migrate @ 7382]
Christian Hammond <chipx86@chipx86.com>
parents:
6719
diff
changeset
|
983 gaim_signal_connect(conv_handle, "buddy-typing-stopped", |
f098765ac919
[gaim-migrate @ 7382]
Christian Hammond <chipx86@chipx86.com>
parents:
6719
diff
changeset
|
984 handle, GAIM_CALLBACK(buddy_typing_cb), NULL); |
5875
448f2f4ca3ec
[gaim-migrate @ 6307]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
985 } |
6837
f098765ac919
[gaim-migrate @ 7382]
Christian Hammond <chipx86@chipx86.com>
parents:
6719
diff
changeset
|
986 |
f098765ac919
[gaim-migrate @ 7382]
Christian Hammond <chipx86@chipx86.com>
parents:
6719
diff
changeset
|
987 void |
f098765ac919
[gaim-migrate @ 7382]
Christian Hammond <chipx86@chipx86.com>
parents:
6719
diff
changeset
|
988 gaim_pounces_uninit() |
f098765ac919
[gaim-migrate @ 7382]
Christian Hammond <chipx86@chipx86.com>
parents:
6719
diff
changeset
|
989 { |
f098765ac919
[gaim-migrate @ 7382]
Christian Hammond <chipx86@chipx86.com>
parents:
6719
diff
changeset
|
990 gaim_signals_disconnect_by_handle(gaim_pounces_get_handle()); |
f098765ac919
[gaim-migrate @ 7382]
Christian Hammond <chipx86@chipx86.com>
parents:
6719
diff
changeset
|
991 } |