Mercurial > pidgin
annotate src/protocols/zephyr/zephyr.c @ 2856:b1e300a85678
[gaim-migrate @ 2869]
rewrote the html parser in gtkimhtml. yes, that's really all i did. the reason for the massive change is because i added a length argument, which then needed to be propogated down to everything that would ever receive anything that would get drawn to the window.
the new parser isn't any faster. that wasn't my goal. it's much more understandable now (hopefully, anyway).
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Sat, 08 Dec 2001 09:48:52 +0000 |
parents | 1648c703ddc2 |
children | 1143524a2eaf |
rev | line source |
---|---|
2086 | 1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ |
2 /* | |
3 * gaim | |
4 * | |
5 * Copyright (C) 1998-2001, Mark Spencer <markster@marko.net> | |
6 * Some code borrowed from GtkZephyr, by | |
7 * Jag/Sean Dilda <agrajag@linuxpower.org>/<smdilda@unity.ncsu.edu> | |
8 * http://gtkzephyr.linuxpower.org/ | |
9 * | |
10 * This program is free software; you can redistribute it and/or modify | |
11 * it under the terms of the GNU General Public License as published by | |
12 * the Free Software Foundation; either version 2 of the License, or | |
13 * (at your option) any later version. | |
14 * | |
15 * This program is distributed in the hope that it will be useful, | |
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 * GNU General Public License for more details. | |
19 * | |
20 * You should have received a copy of the GNU General Public License | |
21 * along with this program; if not, write to the Free Software | |
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
23 * | |
24 */ | |
25 | |
26 #ifdef HAVE_CONFIG_H | |
27 #include "config.h" | |
28 #endif | |
29 | |
30 #include <string.h> | |
31 #include <stdlib.h> | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
32 #include <errno.h> |
2086 | 33 #include "gaim.h" |
34 #include "prpl.h" | |
35 #include "zephyr/zephyr.h" | |
36 | |
37 extern Code_t ZGetLocations(ZLocations_t *, int *); | |
38 extern Code_t ZSetLocation(char *); | |
39 extern Code_t ZUnsetLocation(); | |
40 | |
41 typedef struct _zframe zframe; | |
42 typedef struct _zephyr_triple zephyr_triple; | |
43 | |
44 /* struct I need for zephyr_to_html */ | |
45 struct _zframe { | |
46 /* true for everything but @color, since inside the parens of that one is | |
47 * the color. */ | |
48 gboolean has_closer; | |
49 /* </i>, </font>, </b>, etc. */ | |
50 char *closing; | |
51 /* text including the opening html thingie. */ | |
52 GString *text; | |
53 struct _zframe *enclosing; | |
54 }; | |
55 | |
56 struct _zephyr_triple { | |
57 char *class; | |
58 char *instance; | |
59 char *recipient; | |
60 char *name; | |
61 gboolean open; | |
62 int id; | |
63 }; | |
64 | |
65 static char *zephyr_name() | |
66 { | |
67 return "Zephyr"; | |
68 } | |
69 | |
70 #define z_call(func) if (func != ZERR_NONE)\ | |
71 return; | |
72 #define z_call_r(func) if (func != ZERR_NONE)\ | |
73 return TRUE; | |
74 #define z_call_s(func, err) if (func != ZERR_NONE) {\ | |
75 hide_login_progress(zgc, err);\ | |
76 signoff(zgc);\ | |
77 return;\ | |
78 } | |
79 | |
80 static char *zephyr_normalize(const char *); | |
81 | |
82 /* this is so bad, and if Zephyr weren't so fucked up to begin with I | |
83 * wouldn't do this. but it is so i will. */ | |
84 static guint32 nottimer = 0; | |
85 static guint32 loctimer = 0; | |
86 struct gaim_connection *zgc = NULL; | |
87 static GList *pending_zloc_names = NULL; | |
88 static GSList *subscrips = NULL; | |
89 static int last_id = 0; | |
90 | |
91 /* just for debugging | |
92 static void handle_unknown(ZNotice_t notice) | |
93 { | |
94 g_print("z_packet: %s\n", notice.z_packet); | |
95 g_print("z_version: %s\n", notice.z_version); | |
96 g_print("z_kind: %d\n", notice.z_kind); | |
97 g_print("z_class: %s\n", notice.z_class); | |
98 g_print("z_class_inst: %s\n", notice.z_class_inst); | |
99 g_print("z_opcode: %s\n", notice.z_opcode); | |
100 g_print("z_sender: %s\n", notice.z_sender); | |
101 g_print("z_recipient: %s\n", notice.z_recipient); | |
102 g_print("z_message: %s\n", notice.z_message); | |
103 g_print("z_message_len: %d\n", notice.z_message_len); | |
104 g_print("\n"); | |
105 } | |
106 */ | |
107 | |
108 static zephyr_triple *new_triple(const char *c, const char *i, const char *r) | |
109 { | |
110 zephyr_triple *zt; | |
111 zt = g_new0(zephyr_triple, 1); | |
112 zt->class = g_strdup(c); | |
113 zt->instance = g_strdup(i); | |
114 zt->recipient = g_strdup(r); | |
115 zt->name = g_strdup_printf("%s,%s,%s", c, i, r); | |
116 zt->id = ++last_id; | |
117 zt->open = FALSE; | |
118 return zt; | |
119 } | |
120 | |
121 static void free_triple(zephyr_triple *zt) | |
122 { | |
123 g_free(zt->class); | |
124 g_free(zt->instance); | |
125 g_free(zt->recipient); | |
126 g_free(zt->name); | |
127 g_free(zt); | |
128 } | |
129 | |
130 /* returns true if zt1 is a subset of zt2, i.e. zt2 has the same thing or | |
131 * wildcards in each field of zt1. */ | |
132 static gboolean triple_subset(zephyr_triple *zt1, zephyr_triple *zt2) | |
133 { | |
134 if (g_strcasecmp(zt2->class, zt1->class) && | |
135 g_strcasecmp(zt2->class, "*")) { | |
136 return FALSE; | |
137 } | |
138 if (g_strcasecmp(zt2->instance, zt1->instance) && | |
139 g_strcasecmp(zt2->instance, "*")) { | |
140 return FALSE; | |
141 } | |
142 if (g_strcasecmp(zt2->recipient, zt1->recipient) && | |
143 g_strcasecmp(zt2->recipient, "*")) { | |
144 return FALSE; | |
145 } | |
146 return TRUE; | |
147 } | |
148 | |
149 static zephyr_triple *find_sub_by_triple(zephyr_triple *zt) | |
150 { | |
151 zephyr_triple *curr_t; | |
152 GSList *curr = subscrips; | |
153 while (curr) { | |
154 curr_t = curr->data; | |
155 if (triple_subset(zt, curr_t)) | |
156 return curr_t; | |
157 curr = curr->next; | |
158 } | |
159 return NULL; | |
160 } | |
161 | |
162 static zephyr_triple *find_sub_by_id(int id) | |
163 { | |
164 zephyr_triple *zt; | |
165 GSList *curr = subscrips; | |
166 while (curr) { | |
167 zt = curr->data; | |
168 if (zt->id == id) | |
169 return zt; | |
170 curr = curr->next; | |
171 } | |
172 return NULL; | |
173 } | |
174 | |
175 /* utility macros that are useful for zephyr_to_html */ | |
176 | |
177 #define IS_OPENER(c) ((c == '{') || (c == '[') || (c == '(') || (c == '<')) | |
178 #define IS_CLOSER(c) ((c == '}') || (c == ']') || (c == ')') || (c == '>')) | |
179 | |
180 /* this parses zephyr formatting and converts it to html. For example, if | |
181 * you pass in "@{@color(blue)@i(hello)}" you should get out | |
182 * "<font color=blue><i>hello</i></font>". */ | |
183 static char *zephyr_to_html(char *message) | |
184 { | |
185 int len, cnt; | |
186 zframe *frames, *curr; | |
187 char *ret; | |
188 | |
189 frames = g_new(zframe, 1); | |
190 frames->text = g_string_new(""); | |
191 frames->enclosing = NULL; | |
192 frames->closing = ""; | |
193 frames->has_closer = FALSE; | |
194 | |
195 len = strlen(message); | |
196 cnt = 0; | |
197 while (cnt <= len) { | |
198 if (message[cnt] == '@') { | |
199 zframe *new_f; | |
200 char *buf; | |
201 int end; | |
202 for (end=1; (cnt+end) <= len && | |
203 !IS_OPENER(message[cnt+end]); end++); | |
204 buf = g_new0(char, end); | |
205 if (end) { | |
206 g_snprintf(buf, end, "%s", message+cnt+1); | |
207 } | |
208 if (!g_strcasecmp(buf, "italic") || | |
209 !g_strcasecmp(buf, "i")) { | |
210 new_f = g_new(zframe, 1); | |
211 new_f->enclosing = frames; | |
212 new_f->text = g_string_new("<i>"); | |
213 new_f->closing = "</i>"; | |
214 new_f->has_closer = TRUE; | |
215 frames = new_f; | |
216 cnt += end+1; /* cnt points to char after opener */ | |
217 } else if (!g_strcasecmp(buf, "bold") | |
218 || !g_strcasecmp(buf, "b")) { | |
219 new_f = g_new(zframe, 1); | |
220 new_f->enclosing = frames; | |
221 new_f->text = g_string_new("<b>"); | |
222 new_f->closing = "</b>"; | |
223 new_f->has_closer = TRUE; | |
224 frames = new_f; | |
225 cnt += end+1; | |
226 } else if (!g_strcasecmp(buf, "color")) { | |
227 cnt += end+1; | |
228 new_f = g_new(zframe, 1); | |
229 new_f->enclosing = frames; | |
230 new_f->text = g_string_new("<font color="); | |
231 for (; (cnt <= len) && !IS_CLOSER(message[cnt]); cnt++) { | |
232 g_string_append_c(new_f->text, message[cnt]); | |
233 } | |
234 cnt++; /* point to char after closer */ | |
235 g_string_append_c(new_f->text, '>'); | |
236 new_f->closing = "</font>"; | |
237 new_f->has_closer = FALSE; | |
238 frames = new_f; | |
239 } else if (!g_strcasecmp(buf, "")) { | |
240 new_f = g_new(zframe, 1); | |
241 new_f->enclosing = frames; | |
242 new_f->text = g_string_new(""); | |
243 new_f->closing = ""; | |
244 new_f->has_closer = TRUE; | |
245 frames = new_f; | |
246 cnt += end+1; /* cnt points to char after opener */ | |
247 } else { | |
248 if ((cnt+end) > len) { | |
249 g_string_append_c(frames->text, '@'); | |
250 cnt++; | |
251 } else { | |
252 /* unrecognized thingie. act like it's not there, but we | |
253 * still need to take care of the corresponding closer, | |
254 * make a frame that does nothing. */ | |
255 new_f = g_new(zframe, 1); | |
256 new_f->enclosing = frames; | |
257 new_f->text = g_string_new(""); | |
258 new_f->closing = ""; | |
259 new_f->has_closer = TRUE; | |
260 frames = new_f; | |
261 cnt += end+1; /* cnt points to char after opener */ | |
262 } | |
263 } | |
264 } else if (IS_CLOSER(message[cnt])) { | |
265 zframe *popped; | |
266 gboolean last_had_closer; | |
267 if (frames->enclosing) { | |
268 do { | |
269 popped = frames; | |
270 frames = frames->enclosing; | |
271 g_string_append(frames->text, popped->text->str); | |
272 g_string_append(frames->text, popped->closing); | |
273 g_string_free(popped->text, TRUE); | |
274 last_had_closer = popped->has_closer; | |
275 g_free(popped); | |
276 } while (frames && frames->enclosing && !last_had_closer); | |
277 } else { | |
278 g_string_append_c(frames->text, message[cnt]); | |
279 } | |
280 cnt++; | |
281 } else if (message[cnt] == '\n') { | |
282 g_string_append(frames->text, "<br>"); | |
283 cnt++; | |
284 } else { | |
285 g_string_append_c(frames->text, message[cnt++]); | |
286 } | |
287 } | |
288 /* go through all the stuff that they didn't close */ | |
289 while (frames->enclosing) { | |
290 curr = frames; | |
291 g_string_append(frames->enclosing->text, frames->text->str); | |
292 g_string_append(frames->enclosing->text, frames->closing); | |
293 g_string_free(frames->text, TRUE); | |
294 frames = frames->enclosing; | |
295 g_free(curr); | |
296 } | |
297 ret = frames->text->str; | |
298 g_string_free(frames->text, FALSE); | |
299 g_free(frames); | |
300 return ret; | |
301 } | |
302 | |
303 static gboolean pending_zloc(char *who) | |
304 { | |
305 GList *curr; | |
306 for (curr = pending_zloc_names; curr != NULL; curr = curr->next) { | |
307 if (!g_strcasecmp(who, (char*)curr->data)) { | |
308 g_free((char*)curr->data); | |
309 pending_zloc_names = g_list_remove(pending_zloc_names, curr->data); | |
310 return TRUE; | |
311 } | |
312 } | |
313 return FALSE; | |
314 } | |
315 | |
316 static void handle_message(ZNotice_t notice, struct sockaddr_in from) | |
317 { | |
318 if (!g_strcasecmp(notice.z_class, LOGIN_CLASS)) { | |
319 /* well, we'll be updating in 2 seconds anyway, might as well ignore this. */ | |
320 } else if (!g_strcasecmp(notice.z_class, LOCATE_CLASS)) { | |
321 if (!g_strcasecmp(notice.z_opcode, LOCATE_LOCATE)) { | |
322 int nlocs; | |
323 char *user; | |
324 struct buddy *b; | |
325 | |
326 if (ZParseLocations(¬ice, NULL, &nlocs, &user) != ZERR_NONE) | |
327 return; | |
328 if ((b = find_buddy(zgc, user)) == NULL) { | |
329 char *e = strchr(user, '@'); | |
330 if (e) *e = '\0'; | |
331 b = find_buddy(zgc, user); | |
332 } | |
333 if (!b) { | |
334 free(user); | |
335 return; | |
336 } | |
337 if (pending_zloc(b->name)) { | |
338 ZLocations_t locs; | |
339 int one = 1; | |
340 GString *str = g_string_new(""); | |
341 g_string_sprintfa(str, "<b>User:</b> %s<br>" | |
342 "<b>Alias:</b> %s<br>", | |
343 b->name, b->show); | |
344 if (!nlocs) { | |
345 g_string_sprintfa(str, "<br>Hidden or not logged-in"); | |
346 } | |
347 for (; nlocs > 0; nlocs--) { | |
348 ZGetLocations(&locs, &one); | |
349 g_string_sprintfa(str, "<br>At %s since %s", locs.host, | |
350 locs.time); | |
351 } | |
2791
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2773
diff
changeset
|
352 g_show_info_text(NULL, NULL, 2, str->str, NULL); |
2086 | 353 g_string_free(str, TRUE); |
354 } else | |
355 serv_got_update(zgc, b->name, nlocs, 0, 0, 0, 0, 0); | |
356 | |
357 free(user); | |
358 } | |
359 } else { | |
360 char *buf, *buf2; | |
2804
1648c703ddc2
[gaim-migrate @ 2817]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
361 char *send_inst; |
2086 | 362 char *ptr = notice.z_message + strlen(notice.z_message) + 1; |
363 int len = notice.z_message_len - (ptr - notice.z_message); | |
364 int away; | |
365 if (len > 0) { | |
366 buf = g_malloc(len + 1); | |
367 g_snprintf(buf, len + 1, "%s", ptr); | |
368 g_strchomp(buf); | |
369 buf2 = zephyr_to_html(buf); | |
370 g_free(buf); | |
371 if (!g_strcasecmp(notice.z_class, "MESSAGE") && | |
372 !g_strcasecmp(notice.z_class_inst, "PERSONAL")) { | |
373 if (!g_strcasecmp(notice.z_message, "Automated reply:")) | |
374 away = TRUE; | |
375 else | |
376 away = FALSE; | |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2804
diff
changeset
|
377 serv_got_im(zgc, notice.z_sender, buf2, 0, time(NULL), -1); |
2086 | 378 } else { |
379 zephyr_triple *zt1, *zt2; | |
380 zt1 = new_triple(notice.z_class, notice.z_class_inst, | |
381 notice.z_recipient); | |
382 zt2 = find_sub_by_triple(zt1); | |
383 if (!zt2) { | |
384 /* we shouldn't be subscribed to this message. ignore. */ | |
385 } else { | |
386 if (!zt2->open) { | |
387 zt2->open = TRUE; | |
388 serv_got_joined_chat(zgc, zt2->id, zt2->name); | |
389 } | |
2804
1648c703ddc2
[gaim-migrate @ 2817]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
390 send_inst = g_strdup_printf("%s %s", notice.z_sender, |
1648c703ddc2
[gaim-migrate @ 2817]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
391 notice.z_class_inst); |
1648c703ddc2
[gaim-migrate @ 2817]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
392 serv_got_chat_in(zgc, zt2->id, send_inst, FALSE, |
1648c703ddc2
[gaim-migrate @ 2817]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
393 buf2, time(NULL)); |
1648c703ddc2
[gaim-migrate @ 2817]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
394 g_free(send_inst); |
2086 | 395 } |
396 free_triple(zt1); | |
397 } | |
398 g_free(buf2); | |
399 } | |
400 } | |
401 } | |
402 | |
403 static gint check_notify(gpointer data) | |
404 { | |
405 while (ZPending()) { | |
406 ZNotice_t notice; | |
407 struct sockaddr_in from; | |
408 z_call_r(ZReceiveNotice(¬ice, &from)); | |
409 | |
410 switch (notice.z_kind) { | |
411 case UNSAFE: | |
412 case UNACKED: | |
413 case ACKED: | |
414 handle_message(notice, from); | |
415 break; | |
416 default: | |
417 /* we'll just ignore things for now */ | |
418 debug_printf("ZEPHYR: Unhandled Notice\n"); | |
419 break; | |
420 } | |
421 | |
422 ZFreeNotice(¬ice); | |
423 } | |
424 | |
425 return TRUE; | |
426 } | |
427 | |
428 static gint check_loc(gpointer data) | |
429 { | |
430 GSList *gr, *m; | |
431 ZAsyncLocateData_t ald; | |
432 | |
433 ald.user = NULL; | |
434 memset(&(ald.uid), 0, sizeof(ZUnique_Id_t)); | |
435 ald.version = NULL; | |
436 | |
437 gr = zgc->groups; | |
438 while (gr) { | |
439 struct group *g = gr->data; | |
440 m = g->members; | |
441 while (m) { | |
442 struct buddy *b = m->data; | |
443 char *chk; | |
444 chk = zephyr_normalize(b->name); | |
445 /* doesn't matter if this fails or not; we'll just move on to the next one */ | |
446 ZRequestLocations(chk, &ald, UNACKED, ZAUTH); | |
447 free(ald.user); | |
448 free(ald.version); | |
449 m = m->next; | |
450 } | |
451 gr = gr->next; | |
452 } | |
453 | |
454 return TRUE; | |
455 } | |
456 | |
457 static char *get_exposure_level() | |
458 { | |
459 char *exposure = ZGetVariable("exposure"); | |
460 | |
461 if (!exposure) | |
462 return EXPOSE_REALMVIS; | |
463 if (!g_strcasecmp(exposure, EXPOSE_NONE)) | |
464 return EXPOSE_NONE; | |
465 if (!g_strcasecmp(exposure, EXPOSE_OPSTAFF)) | |
466 return EXPOSE_OPSTAFF; | |
467 if (!g_strcasecmp(exposure, EXPOSE_REALMANN)) | |
468 return EXPOSE_REALMANN; | |
469 if (!g_strcasecmp(exposure, EXPOSE_NETVIS)) | |
470 return EXPOSE_NETVIS; | |
471 if (!g_strcasecmp(exposure, EXPOSE_NETANN)) | |
472 return EXPOSE_NETANN; | |
473 return EXPOSE_REALMVIS; | |
474 } | |
475 | |
476 static void strip_comments(char *str) | |
477 { | |
478 char *tmp = strchr(str, '#'); | |
479 if (tmp) | |
480 *tmp = '\0'; | |
481 g_strchug(str); | |
482 g_strchomp(str); | |
483 } | |
484 | |
485 static void process_zsubs() | |
486 { | |
487 FILE *f; | |
488 gchar *fname; | |
489 gchar buff[BUFSIZ]; | |
490 | |
491 fname = g_strdup_printf("%s/.zephyr.subs", g_getenv("HOME")); | |
492 f = fopen(fname, "r"); | |
493 if (f) { | |
494 char **triple; | |
495 ZSubscription_t sub; | |
496 char *recip; | |
497 while (fgets(buff, BUFSIZ, f)) { | |
498 strip_comments(buff); | |
499 if (buff[0]) { | |
500 triple = g_strsplit(buff, ",", 3); | |
501 if (triple[0] && triple[1] && triple[2]) { | |
2804
1648c703ddc2
[gaim-migrate @ 2817]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
502 char *tmp = g_strdup_printf("%s@%s", g_getenv("USER"), |
1648c703ddc2
[gaim-migrate @ 2817]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
503 ZGetRealm()); |
1648c703ddc2
[gaim-migrate @ 2817]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
504 char *atptr; |
2086 | 505 sub.zsub_class = triple[0]; |
506 sub.zsub_classinst = triple[1]; | |
507 if (!g_strcasecmp(triple[2], "%me%")) { | |
508 recip = g_strdup_printf("%s@%s", g_getenv("USER"), | |
509 ZGetRealm()); | |
510 } else if (!g_strcasecmp(triple[2], "*")) { | |
2804
1648c703ddc2
[gaim-migrate @ 2817]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
511 /* wildcard |
1648c703ddc2
[gaim-migrate @ 2817]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
512 * form of class,instance,* */ |
1648c703ddc2
[gaim-migrate @ 2817]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
513 recip = g_malloc0(1); |
1648c703ddc2
[gaim-migrate @ 2817]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
514 } else if (!g_strcasecmp(triple[2], tmp)) { |
1648c703ddc2
[gaim-migrate @ 2817]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
515 /* form of class,instance,aatharuv@ATHENA.MIT.EDU */ |
1648c703ddc2
[gaim-migrate @ 2817]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
516 recip = g_strdup(triple[2]); |
1648c703ddc2
[gaim-migrate @ 2817]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
517 } else if ((atptr = strchr(triple[2], '@')) != NULL) { |
1648c703ddc2
[gaim-migrate @ 2817]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
518 /* form of class,instance,*@ANDREW.CMU.EDU |
1648c703ddc2
[gaim-migrate @ 2817]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
519 * class,instance,@ANDREW.CMU.EDU |
1648c703ddc2
[gaim-migrate @ 2817]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
520 * If realm is local realm, blank recipient, else |
1648c703ddc2
[gaim-migrate @ 2817]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
521 * @REALM-NAME |
1648c703ddc2
[gaim-migrate @ 2817]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
522 */ |
1648c703ddc2
[gaim-migrate @ 2817]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
523 char *realmat = g_strdup_printf("@%s", ZGetRealm()); |
1648c703ddc2
[gaim-migrate @ 2817]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
524 if (!g_strcasecmp(atptr, realmat)) |
1648c703ddc2
[gaim-migrate @ 2817]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
525 recip = g_malloc0(1); |
1648c703ddc2
[gaim-migrate @ 2817]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
526 else |
1648c703ddc2
[gaim-migrate @ 2817]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
527 recip = g_strdup(atptr); |
1648c703ddc2
[gaim-migrate @ 2817]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
528 g_free(realmat); |
2086 | 529 } else { |
530 recip = g_strdup(triple[2]); | |
531 } | |
2804
1648c703ddc2
[gaim-migrate @ 2817]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
532 g_free(tmp); |
2086 | 533 sub.zsub_recipient = recip; |
534 if (ZSubscribeTo(&sub, 1, 0) != ZERR_NONE) { | |
535 debug_printf("Zephyr: Couldn't subscribe to %s, %s, " | |
536 "%s\n", | |
537 sub.zsub_class, | |
538 sub.zsub_classinst, | |
539 sub.zsub_recipient); | |
540 } | |
541 subscrips = g_slist_append(subscrips, | |
542 new_triple(triple[0], triple[1], recip)); | |
543 g_free(recip); | |
544 } | |
545 g_strfreev(triple); | |
546 } | |
547 } | |
548 } | |
549 } | |
550 | |
551 static void process_anyone() | |
552 { | |
553 FILE *fd; | |
554 gchar buff[BUFSIZ], *filename; | |
555 | |
556 filename = g_strconcat(g_get_home_dir(), "/.anyone", NULL); | |
557 if ((fd = fopen(filename, "r")) != NULL) { | |
558 while (fgets(buff, BUFSIZ, fd)) { | |
559 strip_comments(buff); | |
560 if (buff[0]) | |
561 add_buddy(zgc, "Anyone", buff, buff); | |
562 } | |
563 fclose(fd); | |
564 } | |
565 g_free(filename); | |
566 } | |
567 | |
568 static void zephyr_login(struct aim_user *user) | |
569 { | |
570 ZSubscription_t sub; | |
571 | |
572 if (zgc) { | |
573 do_error_dialog("Already logged in with Zephyr", "Zephyr"); | |
574 return; | |
575 } | |
576 | |
577 zgc = new_gaim_conn(user); | |
578 | |
579 z_call_s(ZInitialize(), "Couldn't initialize zephyr"); | |
580 z_call_s(ZOpenPort(NULL), "Couldn't open port"); | |
581 z_call_s(ZSetLocation(get_exposure_level()), "Couldn't set location"); | |
582 | |
583 sub.zsub_class = "MESSAGE"; | |
584 sub.zsub_classinst = "PERSONAL"; | |
585 sub.zsub_recipient = ZGetSender(); | |
586 | |
587 /* we don't care if this fails. i'm lying right now. */ | |
588 if (ZSubscribeTo(&sub, 1, 0) != ZERR_NONE) { | |
589 debug_printf("Zephyr: Couldn't subscribe to messages!\n"); | |
590 } | |
591 | |
592 account_online(zgc); | |
593 serv_finish_login(zgc); | |
594 | |
595 if (bud_list_cache_exists(zgc)) | |
2382
569ae9f2bb89
[gaim-migrate @ 2395]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
596 do_import(zgc, NULL); |
2086 | 597 process_anyone(); |
598 process_zsubs(); | |
599 | |
2131
acc11216ec5d
[gaim-migrate @ 2141]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2123
diff
changeset
|
600 nottimer = g_timeout_add(100, check_notify, NULL); |
2804
1648c703ddc2
[gaim-migrate @ 2817]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
601 loctimer = g_timeout_add(20000, check_loc, NULL); |
2086 | 602 } |
603 | |
604 static void write_zsubs() | |
605 { | |
606 GSList *s = subscrips; | |
607 zephyr_triple *zt; | |
608 FILE *fd; | |
609 char *fname; | |
610 | |
611 fname = g_strdup_printf("%s/.zephyr.subs", g_get_home_dir()); | |
612 fd = fopen(fname, "w"); | |
613 | |
614 if (!fd) { | |
615 g_free(fname); | |
616 return; | |
617 } | |
618 | |
619 while (s) { | |
620 zt = s->data; | |
621 fprintf(fd, "%s\n", zt->name); | |
622 s = s->next; | |
623 } | |
624 g_free(fname); | |
625 fclose(fd); | |
626 } | |
627 | |
628 static void write_anyone() | |
629 { | |
630 GSList *gr, *m; | |
631 struct group *g; | |
632 struct buddy *b; | |
633 char *ptr, *fname; | |
634 FILE *fd; | |
635 | |
636 fname = g_strdup_printf("%s/.anyone", g_get_home_dir()); | |
637 fd = fopen(fname, "w"); | |
638 if (!fd) { | |
639 g_free(fname); | |
640 return; | |
641 } | |
642 | |
643 gr = zgc->groups; | |
644 while (gr) { | |
645 g = gr->data; | |
646 m = g->members; | |
647 while (m) { | |
648 b = m->data; | |
649 if ((ptr = strchr(b->name, '@')) != NULL) | |
650 *ptr = '\0'; | |
651 fprintf(fd, "%s\n", b->name); | |
652 if (ptr) | |
653 *ptr = '@'; | |
654 m = m->next; | |
655 } | |
656 gr = gr->next; | |
657 } | |
658 | |
659 fclose(fd); | |
660 g_free(fname); | |
661 } | |
662 | |
663 static void zephyr_close(struct gaim_connection *gc) | |
664 { | |
665 GList *l; | |
666 GSList *s; | |
667 l = pending_zloc_names; | |
668 while (l) { | |
669 g_free((char*)l->data); | |
670 l = l->next; | |
671 } | |
672 g_list_free(pending_zloc_names); | |
673 | |
674 write_anyone(); | |
675 write_zsubs(); | |
676 | |
677 s = subscrips; | |
678 while (s) { | |
679 free_triple((zephyr_triple*)s->data); | |
680 s = s->next; | |
681 } | |
682 g_slist_free(subscrips); | |
683 | |
684 if (nottimer) | |
2131
acc11216ec5d
[gaim-migrate @ 2141]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2123
diff
changeset
|
685 g_source_remove(nottimer); |
2086 | 686 nottimer = 0; |
687 if (loctimer) | |
2131
acc11216ec5d
[gaim-migrate @ 2141]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2123
diff
changeset
|
688 g_source_remove(loctimer); |
2086 | 689 loctimer = 0; |
690 zgc = NULL; | |
691 z_call(ZCancelSubscriptions(0)); | |
692 z_call(ZUnsetLocation()); | |
693 z_call(ZClosePort()); | |
694 } | |
695 | |
696 static void zephyr_add_buddy(struct gaim_connection *gc, char *buddy) { } | |
2681
37d80035e77f
[gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
697 static void zephyr_remove_buddy(struct gaim_connection *gc, char *buddy, char *group) { } |
2086 | 698 |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
699 static int zephyr_chat_send(struct gaim_connection *gc, int id, char *im) |
2086 | 700 { |
701 ZNotice_t notice; | |
702 zephyr_triple *zt; | |
703 char *buf; | |
704 const char *sig; | |
705 | |
706 zt = find_sub_by_id(id); | |
707 if (!zt) | |
708 /* this should never happen. */ | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
709 return -EINVAL; |
2086 | 710 |
711 sig = ZGetVariable("zwrite-signature"); | |
712 if (!sig) { | |
713 sig = g_get_real_name(); | |
714 } | |
715 buf = g_strdup_printf("%s%c%s", sig, '\0', im); | |
716 | |
717 bzero((char *)¬ice, sizeof(notice)); | |
718 notice.z_kind = ACKED; | |
719 notice.z_port = 0; | |
720 notice.z_opcode = ""; | |
721 notice.z_class = zt->class; | |
722 notice.z_class_inst = zt->instance; | |
723 if (!g_strcasecmp(zt->recipient, "*")) | |
724 notice.z_recipient = zephyr_normalize(""); | |
725 else | |
726 notice.z_recipient = zephyr_normalize(zt->recipient); | |
727 notice.z_sender = 0; | |
728 notice.z_default_format = | |
729 "Class $class, Instance $instance:\n" | |
730 "To: @bold($recipient) at $time $date\n" | |
731 "From: @bold($1) <$sender>\n\n$2"; | |
732 notice.z_message_len = strlen(im) + strlen(sig) + 4; | |
733 notice.z_message = buf; | |
734 ZSendNotice(¬ice, ZAUTH); | |
735 g_free(buf); | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
736 return 0; |
2086 | 737 } |
738 | |
2231
8c4ff1a368bd
[gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2205
diff
changeset
|
739 static int zephyr_send_im(struct gaim_connection *gc, char *who, char *im, int flags) { |
2086 | 740 ZNotice_t notice; |
741 char *buf; | |
742 const char *sig; | |
743 | |
2231
8c4ff1a368bd
[gaim-migrate @ 2241]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2205
diff
changeset
|
744 if (flags & IM_FLAG_AWAY) |
2086 | 745 sig = "Automated reply:"; |
746 else { | |
747 sig = ZGetVariable("zwrite-signature"); | |
748 if (!sig) { | |
749 sig = g_get_real_name(); | |
750 } | |
751 } | |
752 buf = g_strdup_printf("%s%c%s", sig, '\0', im); | |
753 | |
754 bzero((char *)¬ice, sizeof(notice)); | |
755 notice.z_kind = ACKED; | |
756 notice.z_port = 0; | |
757 notice.z_opcode = ""; | |
758 notice.z_class = "MESSAGE"; | |
759 notice.z_class_inst = "PERSONAL"; | |
760 notice.z_sender = 0; | |
761 notice.z_recipient = who; | |
762 notice.z_default_format = | |
763 "Class $class, Instance $instance:\n" | |
764 "To: @bold($recipient) at $time $date\n" | |
765 "From: @bold($1) <$sender>\n\n$2"; | |
766 notice.z_message_len = strlen(im) + strlen(sig) + 4; | |
767 notice.z_message = buf; | |
768 ZSendNotice(¬ice, ZAUTH); | |
769 g_free(buf); | |
2303
f5bf315e6104
[gaim-migrate @ 2313]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2231
diff
changeset
|
770 return 1; |
2086 | 771 } |
772 | |
773 static char *zephyr_normalize(const char *orig) | |
774 { | |
775 static char buf[80]; | |
776 if (strchr(orig, '@')) { | |
777 g_snprintf(buf, 80, "%s", orig); | |
778 } else { | |
779 g_snprintf(buf, 80, "%s@%s", orig, ZGetRealm()); | |
780 } | |
781 return buf; | |
782 } | |
783 | |
784 static void zephyr_zloc(struct gaim_connection *gc, char *who) | |
785 { | |
786 ZAsyncLocateData_t ald; | |
787 | |
788 if (ZRequestLocations(zephyr_normalize(who), &ald, UNACKED, ZAUTH) | |
789 != ZERR_NONE) { | |
790 return; | |
791 } | |
792 pending_zloc_names = g_list_append(pending_zloc_names, | |
793 g_strdup(zephyr_normalize(who))); | |
794 } | |
795 | |
2170
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
796 static GList *zephyr_buddy_menu(struct gaim_connection *gc, char *who) |
2086 | 797 { |
2170
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
798 GList *m = NULL; |
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
799 struct proto_buddy_menu *pbm; |
2086 | 800 |
2170
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
801 pbm = g_new0(struct proto_buddy_menu, 1); |
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
802 pbm->label = _("ZLocate"); |
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
803 pbm->callback = zephyr_zloc; |
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
804 pbm->gc = gc; |
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
805 m = g_list_append(m, pbm); |
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
806 |
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
807 return m; |
2086 | 808 } |
809 | |
810 static void zephyr_set_away(struct gaim_connection *gc, char *state, char *msg) | |
811 { | |
812 if (gc->away) | |
813 g_free(gc->away); | |
814 gc->away = NULL; | |
815 if (!g_strcasecmp(state, "Hidden")) | |
816 ZSetLocation(EXPOSE_OPSTAFF); | |
817 else if (!g_strcasecmp(state, "Online")) | |
818 ZSetLocation(get_exposure_level()); | |
819 else /* state is GAIM_AWAY_CUSTOM */ if (msg) | |
820 gc->away = g_strdup(msg); | |
821 } | |
822 | |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2417
diff
changeset
|
823 static GList *zephyr_away_states(struct gaim_connection *gc) |
2086 | 824 { |
825 GList *m = NULL; | |
826 | |
827 m = g_list_append(m, "Online"); | |
828 m = g_list_append(m, GAIM_AWAY_CUSTOM); | |
829 m = g_list_append(m, "Hidden"); | |
830 | |
831 return m; | |
832 } | |
833 | |
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2170
diff
changeset
|
834 static GList *zephyr_chat_info(struct gaim_connection *gc) { |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2170
diff
changeset
|
835 GList *m = NULL; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2170
diff
changeset
|
836 struct proto_chat_entry *pce; |
2086 | 837 |
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2170
diff
changeset
|
838 pce = g_new0(struct proto_chat_entry, 1); |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2170
diff
changeset
|
839 pce->label = _("Class:"); |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2170
diff
changeset
|
840 m = g_list_append(m, NULL); |
2086 | 841 |
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2170
diff
changeset
|
842 pce = g_new0(struct proto_chat_entry, 1); |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2170
diff
changeset
|
843 pce->label = _("Instance:"); |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2170
diff
changeset
|
844 m = g_list_append(m, NULL); |
2086 | 845 |
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2170
diff
changeset
|
846 pce = g_new0(struct proto_chat_entry, 1); |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2170
diff
changeset
|
847 pce->label = _("Recipient:"); |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2170
diff
changeset
|
848 m = g_list_append(m, NULL); |
2086 | 849 |
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2170
diff
changeset
|
850 return m; |
2086 | 851 } |
852 | |
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2170
diff
changeset
|
853 static void zephyr_join_chat(struct gaim_connection *gc, GList *data) |
2086 | 854 { |
855 ZSubscription_t sub; | |
856 zephyr_triple *zt1, *zt2; | |
857 const char *classname; | |
858 const char *instname; | |
859 const char *recip; | |
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2170
diff
changeset
|
860 |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2170
diff
changeset
|
861 if (!data || !data->next || !data->next->next) |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2170
diff
changeset
|
862 return; |
2086 | 863 |
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2170
diff
changeset
|
864 classname = data->data; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2170
diff
changeset
|
865 instname = data->next->data; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2170
diff
changeset
|
866 recip = data->next->next->data; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2170
diff
changeset
|
867 if (!g_strcasecmp(recip, "%me%")) |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2170
diff
changeset
|
868 recip = g_getenv("USER"); |
2086 | 869 |
870 zt1 = new_triple(classname, instname, recip); | |
871 zt2 = find_sub_by_triple(zt1); | |
872 if (zt2) { | |
873 free_triple(zt1); | |
874 if (!zt2->open) | |
875 serv_got_joined_chat(gc, zt2->id, zt2->name); | |
876 return; | |
877 } | |
878 | |
879 sub.zsub_class = zt1->class; | |
880 sub.zsub_classinst = zt1->instance; | |
881 sub.zsub_recipient = zt1->recipient; | |
882 | |
883 if (ZSubscribeTo(&sub, 1, 0) != ZERR_NONE) { | |
884 free_triple(zt1); | |
885 return; | |
886 } | |
887 | |
888 subscrips = g_slist_append(subscrips, zt1); | |
889 zt1->open = TRUE; | |
890 serv_got_joined_chat(gc, zt1->id, zt1->name); | |
891 } | |
892 | |
893 static void zephyr_chat_leave(struct gaim_connection *gc, int id) | |
894 { | |
895 zephyr_triple *zt; | |
896 zt = find_sub_by_id(id); | |
897 if (zt) { | |
898 zt->open = FALSE; | |
899 zt->id = ++last_id; | |
900 } | |
901 } | |
902 | |
903 static struct prpl *my_protocol = NULL; | |
904 | |
905 void zephyr_init(struct prpl *ret) | |
906 { | |
907 ret->protocol = PROTO_ZEPHYR; | |
2100
a93aeb6f813d
[gaim-migrate @ 2110]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
908 ret->options = OPT_PROTO_NO_PASSWORD; |
2086 | 909 ret->name = zephyr_name; |
910 ret->login = zephyr_login; | |
911 ret->close = zephyr_close; | |
912 ret->add_buddy = zephyr_add_buddy; | |
913 ret->remove_buddy = zephyr_remove_buddy; | |
914 ret->send_im = zephyr_send_im; | |
915 ret->get_info = zephyr_zloc; | |
916 ret->normalize = zephyr_normalize; | |
917 ret->buddy_menu = zephyr_buddy_menu; | |
918 ret->away_states = zephyr_away_states; | |
919 ret->set_away = zephyr_set_away; | |
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2170
diff
changeset
|
920 ret->chat_info = zephyr_chat_info; |
2086 | 921 ret->join_chat = zephyr_join_chat; |
922 ret->chat_send = zephyr_chat_send; | |
923 ret->chat_leave = zephyr_chat_leave; | |
924 | |
925 my_protocol = ret; | |
926 } | |
927 | |
928 #ifndef STATIC | |
929 | |
930 char *gaim_plugin_init(GModule *handle) | |
931 { | |
932 load_protocol(zephyr_init, sizeof(struct prpl)); | |
933 return NULL; | |
934 } | |
935 | |
936 void gaim_plugin_remove() | |
937 { | |
938 struct prpl *p = find_prpl(PROTO_ZEPHYR); | |
939 if (p == my_protocol) | |
940 unload_protocol(p); | |
941 } | |
942 | |
943 char *name() | |
944 { | |
945 return "Zephyr"; | |
946 } | |
947 | |
948 char *description() | |
949 { | |
2162
a464da684307
[gaim-migrate @ 2172]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2137
diff
changeset
|
950 return PRPL_DESC("Zephyr"); |
2086 | 951 } |
952 | |
953 #endif |