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