annotate src/pounce.c @ 5496:b7c0be69c749

[gaim-migrate @ 5892] do_ask_dialog() will soon go the way of the something that goes away a lot. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Fri, 23 May 2003 00:48:20 +0000
parents abc8489b2e8f
children 9eb5b13fd412
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
1 /**
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
2 * @file pounce.h Buddy pounce API
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
3 *
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4 * gaim
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5 *
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
6 * Copyright (C) 2003, Christian Hammond <chipx86@gnupdate.org>
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
7 *
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8 * This program is free software; you can redistribute it and/or modify
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9 * it under the terms of the GNU General Public License as published by
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
11 * (at your option) any later version.
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
12 *
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
16 * GNU General Public License for more details.
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
17 *
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
19 * along with this program; if not, write to the Free Software
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
21 *
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
22 */
5054
abc8489b2e8f [gaim-migrate @ 5404]
Nathan Walp <nwalp@pidgin.im>
parents: 5043
diff changeset
23 #include <string.h>
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
24 #include "gaim.h"
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
25
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
26 static GList *pounces = NULL;
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
27
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
28 struct gaim_pounce *
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
29 gaim_pounce_new(struct gaim_account *pouncer, const char *pouncee,
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
30 GaimPounceEvent event, gaim_pounce_cb cb,
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
31 void *data, void (*free)(void *))
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
32 {
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
33 struct gaim_pounce *pounce;
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
34
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
35 if (pouncer == NULL || pouncee == NULL || event == 0 || cb == NULL)
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
36 return NULL;
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
37
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
38 pounce = g_new0(struct gaim_pounce, 1);
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
39
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
40 pounce->pouncer = pouncer;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
41 pounce->pouncee = g_strdup(pouncee);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
42 pounce->events = event;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
43 pounce->callback = cb;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
44 pounce->data = data;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
45 pounce->free = free;
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
46
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
47 pounces = g_list_append(pounces, pounce);
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
48
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
49 return pounce;
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
50 }
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
51
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
52 void
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
53 gaim_pounce_destroy(struct gaim_pounce *pounce)
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
54 {
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
55 if (pounce == NULL)
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
56 return;
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
57
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
58 if (pounce->pouncee != NULL)
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
59 g_free(pounce->pouncee);
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
60
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
61 pounces = g_list_remove(pounces, pounce);
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
62
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
63 if (pounce->free != NULL && pounce->data != NULL)
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
64 pounce->free(pounce->data);
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
65
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
66 g_free(pounce);
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
67 }
4696
abec345c8c92 [gaim-migrate @ 5007]
Nathan Walp <nwalp@pidgin.im>
parents: 4690
diff changeset
68
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
69 void
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
70 gaim_pounce_set_events(struct gaim_pounce *pounce, GaimPounceEvent events)
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
71 {
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
72 if (pounce == NULL || events == GAIM_POUNCE_NONE)
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
73 return;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
74
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
75 pounce->events = events;
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
76 }
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
77
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
78 void
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
79 gaim_pounce_set_pouncer(struct gaim_pounce *pounce,
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
80 struct gaim_account *pouncer)
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
81 {
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
82 if (pounce == NULL || pouncer == NULL)
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
83 return;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
84
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
85 pounce->pouncer = pouncer;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
86 }
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
87
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
88 void
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
89 gaim_pounce_set_pouncee(struct gaim_pounce *pounce, const char *pouncee)
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
90 {
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
91 if (pounce == NULL || pouncee == NULL)
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
92 return;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
93
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
94 if (pounce->pouncee != NULL)
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
95 g_free(pounce->pouncee);
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
96
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
97 pounce->pouncee = (pouncee == NULL ? NULL : g_strdup(pouncee));
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
98 }
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
99
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
100 void
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
101 gaim_pounce_set_data(struct gaim_pounce *pounce, void *data)
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
102 {
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
103 if (pounce == NULL)
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
104 return;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
105
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
106 pounce->data = data;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
107 }
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
108
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
109 GaimPounceEvent
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
110 gaim_pounce_get_events(const struct gaim_pounce *pounce)
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
111 {
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
112 if (pounce == NULL)
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
113 return GAIM_POUNCE_NONE;
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
114
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
115 return pounce->events;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
116 }
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
117
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
118 struct gaim_account *
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
119 gaim_pounce_get_pouncer(const struct gaim_pounce *pounce)
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
120 {
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
121 if (pounce == NULL)
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
122 return NULL;
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
123
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
124 return pounce->pouncer;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
125 }
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
126
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
127 const char *
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
128 gaim_pounce_get_pouncee(const struct gaim_pounce *pounce)
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
129 {
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
130 if (pounce == NULL)
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
131 return NULL;
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
132
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
133 return pounce->pouncee;
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
134 }
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
135
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
136 void *
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
137 gaim_pounce_get_data(const struct gaim_pounce *pounce)
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
138 {
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
139 if (pounce == NULL)
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
140 return NULL;
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
141
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
142 return pounce->data;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
143 }
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
144
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
145 void
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
146 gaim_pounce_execute(const struct gaim_account *pouncer,
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
147 const char *pouncee, GaimPounceEvent events)
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
148 {
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
149 struct gaim_pounce *pounce;
5043
494a050318c7 [gaim-migrate @ 5390]
Christian Hammond <chipx86@chipx86.com>
parents: 5032
diff changeset
150 GList *l;
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
151
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
152 if (events == GAIM_POUNCE_NONE || pouncer == NULL || pouncee == NULL)
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
153 return;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
154
5043
494a050318c7 [gaim-migrate @ 5390]
Christian Hammond <chipx86@chipx86.com>
parents: 5032
diff changeset
155 for (l = gaim_get_pounces(); l != NULL; l = l->next) {
494a050318c7 [gaim-migrate @ 5390]
Christian Hammond <chipx86@chipx86.com>
parents: 5032
diff changeset
156 pounce = (struct gaim_pounce *)l->data;
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
157
5043
494a050318c7 [gaim-migrate @ 5390]
Christian Hammond <chipx86@chipx86.com>
parents: 5032
diff changeset
158 if ((gaim_pounce_get_events(pounce) & events) &&
494a050318c7 [gaim-migrate @ 5390]
Christian Hammond <chipx86@chipx86.com>
parents: 5032
diff changeset
159 (gaim_pounce_get_pouncer(pounce) == pouncer) &&
494a050318c7 [gaim-migrate @ 5390]
Christian Hammond <chipx86@chipx86.com>
parents: 5032
diff changeset
160 !strcmp(gaim_pounce_get_pouncee(pounce), pouncee)) {
494a050318c7 [gaim-migrate @ 5390]
Christian Hammond <chipx86@chipx86.com>
parents: 5032
diff changeset
161
494a050318c7 [gaim-migrate @ 5390]
Christian Hammond <chipx86@chipx86.com>
parents: 5032
diff changeset
162 if (pounce->callback != NULL)
494a050318c7 [gaim-migrate @ 5390]
Christian Hammond <chipx86@chipx86.com>
parents: 5032
diff changeset
163 pounce->callback(pounce, events, gaim_pounce_get_data(pounce));
494a050318c7 [gaim-migrate @ 5390]
Christian Hammond <chipx86@chipx86.com>
parents: 5032
diff changeset
164 }
494a050318c7 [gaim-migrate @ 5390]
Christian Hammond <chipx86@chipx86.com>
parents: 5032
diff changeset
165 }
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
166 }
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
167
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
168 struct gaim_pounce *
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
169 gaim_find_pounce(const struct gaim_account *pouncer,
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
170 const char *pouncee, GaimPounceEvent events)
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
171 {
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
172 struct gaim_pounce *pounce;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
173 GList *l;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
174
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
175 if (events == GAIM_POUNCE_NONE || pouncer == NULL || pouncee == NULL)
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
176 return NULL;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
177
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
178 for (l = gaim_get_pounces(); l != NULL; l = l->next) {
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
179 pounce = (struct gaim_pounce *)l->data;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
180
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
181 if ((gaim_pounce_get_events(pounce) & events) &&
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
182 (gaim_pounce_get_pouncer(pounce) == pouncer) &&
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
183 !strcmp(gaim_pounce_get_pouncee(pounce), pouncee)) {
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
184
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
185 return pounce;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
186 }
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
187 }
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
188
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
189 return NULL;
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
190 }
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
191
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
192 GList *
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
193 gaim_get_pounces(void)
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 return pounces;
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 4793
diff changeset
196 }