Mercurial > pidgin
annotate src/protocols/zephyr/zephyr.c @ 7326:00a9ab26d607
[gaim-migrate @ 7912]
Added an option to remove the formatting toolbar, both globally and on a
per-window basis. Patch by Nathan Fredrickson.
committer: Tailor Script <tailor@pidgin.im>
| author | Christian Hammond <chipx86@chipx86.com> |
|---|---|
| date | Sat, 25 Oct 2003 00:03:13 +0000 |
| parents | ab828b8c3f22 |
| children | 08ce2a94d9c7 |
| 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 | |
|
7084
0909ebf6fb28
[gaim-migrate @ 7649]
Christian Hammond <chipx86@chipx86.com>
parents:
7070
diff
changeset
|
7 * Jag/Sean Dilda <agrajag@linuxpower.org>/<smdilda@unity.ncsu.edu> |
|
0909ebf6fb28
[gaim-migrate @ 7649]
Christian Hammond <chipx86@chipx86.com>
parents:
7070
diff
changeset
|
8 * http://gtkzephyr.linuxpower.org/ |
| 2086 | 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 */ | |
|
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5717
diff
changeset
|
25 /* XXX eww */ |
|
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5717
diff
changeset
|
26 #include "src/internal.h" |
| 2086 | 27 |
|
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5717
diff
changeset
|
28 #include "debug.h" |
|
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5717
diff
changeset
|
29 #include "multi.h" |
|
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5717
diff
changeset
|
30 #include "notify.h" |
|
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5717
diff
changeset
|
31 #include "prpl.h" |
|
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5717
diff
changeset
|
32 #include "server.h" |
|
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5717
diff
changeset
|
33 #include "util.h" |
|
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5717
diff
changeset
|
34 |
|
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5717
diff
changeset
|
35 #include "zephyr/zephyr.h" |
|
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5717
diff
changeset
|
36 |
| 2086 | 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 #define z_call(func) if (func != ZERR_NONE)\ | |
| 66 return; | |
| 67 #define z_call_r(func) if (func != ZERR_NONE)\ | |
| 68 return TRUE; | |
| 69 #define z_call_s(func, err) if (func != ZERR_NONE) {\ | |
| 5606 | 70 gaim_connection_error(zgc, err);\ |
| 2086 | 71 return;\ |
| 72 } | |
| 73 | |
| 7322 | 74 static const char *zephyr_normalize(const GaimAccount *, const char *); |
| 2086 | 75 |
| 76 /* this is so bad, and if Zephyr weren't so fucked up to begin with I | |
| 77 * wouldn't do this. but it is so i will. */ | |
| 78 static guint32 nottimer = 0; | |
| 79 static guint32 loctimer = 0; | |
| 5606 | 80 GaimConnection *zgc = NULL; |
| 2086 | 81 static GList *pending_zloc_names = NULL; |
| 82 static GSList *subscrips = NULL; | |
| 83 static int last_id = 0; | |
| 84 | |
| 85 /* just for debugging | |
| 86 static void handle_unknown(ZNotice_t notice) | |
| 87 { | |
|
6484
5ced8e111473
[gaim-migrate @ 6998]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
88 gaim_debug(GAIM_DEBUG_MISC, "z_packet: %s\n", notice.z_packet); |
|
5ced8e111473
[gaim-migrate @ 6998]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
89 gaim_debug(GAIM_DEBUG_MISC, "z_version: %s\n", notice.z_version); |
|
5ced8e111473
[gaim-migrate @ 6998]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
90 gaim_debug(GAIM_DEBUG_MISC, "z_kind: %d\n", notice.z_kind); |
|
5ced8e111473
[gaim-migrate @ 6998]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
91 gaim_debug(GAIM_DEBUG_MISC, "z_class: %s\n", notice.z_class); |
|
5ced8e111473
[gaim-migrate @ 6998]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
92 gaim_debug(GAIM_DEBUG_MISC, "z_class_inst: %s\n", notice.z_class_inst); |
|
5ced8e111473
[gaim-migrate @ 6998]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
93 gaim_debug(GAIM_DEBUG_MISC, "z_opcode: %s\n", notice.z_opcode); |
|
5ced8e111473
[gaim-migrate @ 6998]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
94 gaim_debug(GAIM_DEBUG_MISC, "z_sender: %s\n", notice.z_sender); |
|
5ced8e111473
[gaim-migrate @ 6998]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
95 gaim_debug(GAIM_DEBUG_MISC, "z_recipient: %s\n", notice.z_recipient); |
|
5ced8e111473
[gaim-migrate @ 6998]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
96 gaim_debug(GAIM_DEBUG_MISC, "z_message: %s\n", notice.z_message); |
|
5ced8e111473
[gaim-migrate @ 6998]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
97 gaim_debug(GAIM_DEBUG_MISC, "z_message_len: %d\n", notice.z_message_len); |
| 2086 | 98 } |
| 99 */ | |
| 100 | |
| 101 static zephyr_triple *new_triple(const char *c, const char *i, const char *r) | |
| 102 { | |
| 103 zephyr_triple *zt; | |
| 104 zt = g_new0(zephyr_triple, 1); | |
| 105 zt->class = g_strdup(c); | |
| 106 zt->instance = g_strdup(i); | |
| 107 zt->recipient = g_strdup(r); | |
| 108 zt->name = g_strdup_printf("%s,%s,%s", c, i, r); | |
| 109 zt->id = ++last_id; | |
| 110 zt->open = FALSE; | |
| 111 return zt; | |
| 112 } | |
| 113 | |
| 114 static void free_triple(zephyr_triple *zt) | |
| 115 { | |
| 116 g_free(zt->class); | |
| 117 g_free(zt->instance); | |
| 118 g_free(zt->recipient); | |
| 119 g_free(zt->name); | |
| 120 g_free(zt); | |
| 121 } | |
| 122 | |
| 123 /* returns true if zt1 is a subset of zt2, i.e. zt2 has the same thing or | |
| 124 * wildcards in each field of zt1. */ | |
| 125 static gboolean triple_subset(zephyr_triple *zt1, zephyr_triple *zt2) | |
| 126 { | |
| 4793 | 127 if (g_ascii_strcasecmp(zt2->class, zt1->class) && |
| 128 g_ascii_strcasecmp(zt2->class, "*")) { | |
| 2086 | 129 return FALSE; |
| 130 } | |
| 4793 | 131 if (g_ascii_strcasecmp(zt2->instance, zt1->instance) && |
| 132 g_ascii_strcasecmp(zt2->instance, "*")) { | |
| 2086 | 133 return FALSE; |
| 134 } | |
| 4793 | 135 if (g_ascii_strcasecmp(zt2->recipient, zt1->recipient) && |
| 136 g_ascii_strcasecmp(zt2->recipient, "*")) { | |
| 2086 | 137 return FALSE; |
| 138 } | |
| 139 return TRUE; | |
| 140 } | |
| 141 | |
| 142 static zephyr_triple *find_sub_by_triple(zephyr_triple *zt) | |
| 143 { | |
| 144 zephyr_triple *curr_t; | |
| 145 GSList *curr = subscrips; | |
| 146 while (curr) { | |
| 147 curr_t = curr->data; | |
| 148 if (triple_subset(zt, curr_t)) | |
| 149 return curr_t; | |
| 150 curr = curr->next; | |
| 151 } | |
| 152 return NULL; | |
| 153 } | |
| 154 | |
| 155 static zephyr_triple *find_sub_by_id(int id) | |
| 156 { | |
| 157 zephyr_triple *zt; | |
| 158 GSList *curr = subscrips; | |
| 159 while (curr) { | |
| 160 zt = curr->data; | |
| 161 if (zt->id == id) | |
| 162 return zt; | |
| 163 curr = curr->next; | |
| 164 } | |
| 165 return NULL; | |
| 166 } | |
| 167 | |
| 168 /* utility macros that are useful for zephyr_to_html */ | |
| 169 | |
| 170 #define IS_OPENER(c) ((c == '{') || (c == '[') || (c == '(') || (c == '<')) | |
| 171 #define IS_CLOSER(c) ((c == '}') || (c == ']') || (c == ')') || (c == '>')) | |
| 172 | |
| 173 /* this parses zephyr formatting and converts it to html. For example, if | |
| 174 * you pass in "@{@color(blue)@i(hello)}" you should get out | |
| 175 * "<font color=blue><i>hello</i></font>". */ | |
| 176 static char *zephyr_to_html(char *message) | |
| 177 { | |
| 178 int len, cnt; | |
| 179 zframe *frames, *curr; | |
| 180 char *ret; | |
| 181 | |
| 182 frames = g_new(zframe, 1); | |
| 183 frames->text = g_string_new(""); | |
| 184 frames->enclosing = NULL; | |
| 185 frames->closing = ""; | |
| 186 frames->has_closer = FALSE; | |
| 187 | |
| 188 len = strlen(message); | |
| 189 cnt = 0; | |
| 190 while (cnt <= len) { | |
| 191 if (message[cnt] == '@') { | |
| 192 zframe *new_f; | |
| 193 char *buf; | |
| 194 int end; | |
| 195 for (end=1; (cnt+end) <= len && | |
| 7070 | 196 !IS_OPENER(message[cnt+end]) && !IS_CLOSER(message[cnt+end]); end++); |
| 2086 | 197 buf = g_new0(char, end); |
| 198 if (end) { | |
| 199 g_snprintf(buf, end, "%s", message+cnt+1); | |
| 200 } | |
| 4793 | 201 if (!g_ascii_strcasecmp(buf, "italic") || |
| 202 !g_ascii_strcasecmp(buf, "i")) { | |
| 2086 | 203 new_f = g_new(zframe, 1); |
| 204 new_f->enclosing = frames; | |
| 205 new_f->text = g_string_new("<i>"); | |
| 206 new_f->closing = "</i>"; | |
| 207 new_f->has_closer = TRUE; | |
| 208 frames = new_f; | |
| 209 cnt += end+1; /* cnt points to char after opener */ | |
| 4793 | 210 } else if (!g_ascii_strcasecmp(buf, "bold") |
| 211 || !g_ascii_strcasecmp(buf, "b")) { | |
| 2086 | 212 new_f = g_new(zframe, 1); |
| 213 new_f->enclosing = frames; | |
| 214 new_f->text = g_string_new("<b>"); | |
| 215 new_f->closing = "</b>"; | |
| 216 new_f->has_closer = TRUE; | |
| 217 frames = new_f; | |
| 218 cnt += end+1; | |
| 4793 | 219 } else if (!g_ascii_strcasecmp(buf, "color")) { |
| 2086 | 220 cnt += end+1; |
| 221 new_f = g_new(zframe, 1); | |
| 222 new_f->enclosing = frames; | |
| 223 new_f->text = g_string_new("<font color="); | |
| 224 for (; (cnt <= len) && !IS_CLOSER(message[cnt]); cnt++) { | |
| 225 g_string_append_c(new_f->text, message[cnt]); | |
| 226 } | |
| 227 cnt++; /* point to char after closer */ | |
| 228 g_string_append_c(new_f->text, '>'); | |
| 229 new_f->closing = "</font>"; | |
| 230 new_f->has_closer = FALSE; | |
| 231 frames = new_f; | |
| 4793 | 232 } else if (!g_ascii_strcasecmp(buf, "")) { |
| 2086 | 233 new_f = g_new(zframe, 1); |
| 234 new_f->enclosing = frames; | |
| 235 new_f->text = g_string_new(""); | |
| 236 new_f->closing = ""; | |
| 237 new_f->has_closer = TRUE; | |
| 238 frames = new_f; | |
| 239 cnt += end+1; /* cnt points to char after opener */ | |
| 240 } else { | |
| 241 if ((cnt+end) > len) { | |
| 242 g_string_append_c(frames->text, '@'); | |
| 243 cnt++; | |
| 7070 | 244 } else if (IS_CLOSER(message[cnt+end])) { |
| 245 /* We have @chars..closer . This is | |
| 246 merely a sequence of chars that isn't a formatting tag | |
| 247 */ | |
| 248 int tmp=cnt; | |
| 249 while (tmp<=cnt+end) { | |
| 250 g_string_append_c(frames->text,message[tmp]); | |
| 251 tmp++; | |
| 252 } | |
| 253 cnt+=end+1; | |
| 254 } else { | |
| 2086 | 255 /* unrecognized thingie. act like it's not there, but we |
| 256 * still need to take care of the corresponding closer, | |
| 257 * make a frame that does nothing. */ | |
| 258 new_f = g_new(zframe, 1); | |
| 259 new_f->enclosing = frames; | |
| 260 new_f->text = g_string_new(""); | |
| 261 new_f->closing = ""; | |
| 262 new_f->has_closer = TRUE; | |
| 263 frames = new_f; | |
| 264 cnt += end+1; /* cnt points to char after opener */ | |
| 265 } | |
| 266 } | |
| 267 } else if (IS_CLOSER(message[cnt])) { | |
| 268 zframe *popped; | |
| 269 gboolean last_had_closer; | |
| 270 if (frames->enclosing) { | |
| 271 do { | |
| 272 popped = frames; | |
| 273 frames = frames->enclosing; | |
| 274 g_string_append(frames->text, popped->text->str); | |
| 275 g_string_append(frames->text, popped->closing); | |
| 276 g_string_free(popped->text, TRUE); | |
| 277 last_had_closer = popped->has_closer; | |
| 278 g_free(popped); | |
| 279 } while (frames && frames->enclosing && !last_had_closer); | |
| 280 } else { | |
| 281 g_string_append_c(frames->text, message[cnt]); | |
| 282 } | |
| 283 cnt++; | |
| 284 } else if (message[cnt] == '\n') { | |
| 285 g_string_append(frames->text, "<br>"); | |
| 286 cnt++; | |
| 287 } else { | |
| 288 g_string_append_c(frames->text, message[cnt++]); | |
| 289 } | |
| 290 } | |
| 291 /* go through all the stuff that they didn't close */ | |
| 292 while (frames->enclosing) { | |
| 293 curr = frames; | |
| 294 g_string_append(frames->enclosing->text, frames->text->str); | |
| 295 g_string_append(frames->enclosing->text, frames->closing); | |
| 296 g_string_free(frames->text, TRUE); | |
| 297 frames = frames->enclosing; | |
| 298 g_free(curr); | |
| 299 } | |
| 300 ret = frames->text->str; | |
| 301 g_string_free(frames->text, FALSE); | |
| 302 g_free(frames); | |
| 303 return ret; | |
| 304 } | |
| 305 | |
| 306 static gboolean pending_zloc(char *who) | |
| 307 { | |
| 308 GList *curr; | |
| 309 for (curr = pending_zloc_names; curr != NULL; curr = curr->next) { | |
| 7322 | 310 if (!g_ascii_strcasecmp(zephyr_normalize(NULL, who), (char*)curr->data)) { |
| 2086 | 311 g_free((char*)curr->data); |
| 312 pending_zloc_names = g_list_remove(pending_zloc_names, curr->data); | |
| 313 return TRUE; | |
| 314 } | |
| 315 } | |
| 316 return FALSE; | |
| 317 } | |
| 318 | |
| 319 static void handle_message(ZNotice_t notice, struct sockaddr_in from) | |
| 320 { | |
| 4793 | 321 if (!g_ascii_strcasecmp(notice.z_class, LOGIN_CLASS)) { |
| 3277 | 322 /* well, we'll be updating in 20 seconds anyway, might as well ignore this. */ |
| 4793 | 323 } else if (!g_ascii_strcasecmp(notice.z_class, LOCATE_CLASS)) { |
| 324 if (!g_ascii_strcasecmp(notice.z_opcode, LOCATE_LOCATE)) { | |
| 2086 | 325 int nlocs; |
| 326 char *user; | |
| 6695 | 327 GaimBuddy *b; |
| 2086 | 328 |
| 329 if (ZParseLocations(¬ice, NULL, &nlocs, &user) != ZERR_NONE) | |
| 330 return; | |
| 4687 | 331 if ((b = gaim_find_buddy(zgc->account, user)) == NULL) { |
| 2086 | 332 char *e = strchr(user, '@'); |
| 333 if (e) *e = '\0'; | |
| 4687 | 334 b = gaim_find_buddy(zgc->account, user); |
| 2086 | 335 } |
| 336 if (!b) { | |
| 337 free(user); | |
| 338 return; | |
| 339 } | |
| 340 if (pending_zloc(b->name)) { | |
| 341 ZLocations_t locs; | |
| 342 int one = 1; | |
| 343 GString *str = g_string_new(""); | |
| 5132 | 344 g_string_append_printf(str, _("<b>User:</b> %s<br>"), b->name); |
| 345 if (b->alias) | |
| 346 g_string_append_printf(str, _("<b>Alias:</b> %s<br>"), b->alias); | |
| 2086 | 347 if (!nlocs) { |
| 5132 | 348 g_string_append_printf(str, _("<br>Hidden or not logged-in")); |
| 2086 | 349 } |
| 350 for (; nlocs > 0; nlocs--) { | |
| 351 ZGetLocations(&locs, &one); | |
| 5132 | 352 g_string_append_printf(str, _("<br>At %s since %s"), locs.host, |
| 2086 | 353 locs.time); |
| 354 } | |
|
7062
86ed8b2aa665
[gaim-migrate @ 7626]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
355 gaim_notify_formatted(zgc, NULL, _("Buddy Information"), |
|
86ed8b2aa665
[gaim-migrate @ 7626]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
356 NULL, str->str, NULL, NULL); |
| 2086 | 357 g_string_free(str, TRUE); |
| 358 } else | |
| 4732 | 359 serv_got_update(zgc, b->name, nlocs, 0, 0, 0, 0); |
| 2086 | 360 |
| 361 free(user); | |
| 362 } | |
| 363 } else { | |
| 364 char *buf, *buf2; | |
|
2804
1648c703ddc2
[gaim-migrate @ 2817]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
365 char *send_inst; |
| 3277 | 366 char *realmptr; |
| 367 char *sendertmp; | |
| 2086 | 368 char *ptr = notice.z_message + strlen(notice.z_message) + 1; |
| 369 int len = notice.z_message_len - (ptr - notice.z_message); | |
|
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7084
diff
changeset
|
370 GaimConvImFlags flags = 0; |
| 2086 | 371 if (len > 0) { |
| 372 buf = g_malloc(len + 1); | |
| 373 g_snprintf(buf, len + 1, "%s", ptr); | |
| 374 g_strchomp(buf); | |
| 375 buf2 = zephyr_to_html(buf); | |
| 376 g_free(buf); | |
| 4793 | 377 if (!g_ascii_strcasecmp(notice.z_class, "MESSAGE") && |
| 378 !g_ascii_strcasecmp(notice.z_class_inst, "PERSONAL")) { | |
| 379 if (!g_ascii_strcasecmp(notice.z_message, "Automated reply:")) | |
|
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7084
diff
changeset
|
380 flags |= GAIM_CONV_IM_AUTO_RESP; |
| 6982 | 381 serv_got_im(zgc, notice.z_sender, buf2, flags, time(NULL)); |
| 2086 | 382 } else { |
| 383 zephyr_triple *zt1, *zt2; | |
| 384 zt1 = new_triple(notice.z_class, notice.z_class_inst, | |
| 4687 | 385 notice.z_recipient); |
| 2086 | 386 zt2 = find_sub_by_triple(zt1); |
| 387 if (!zt2) { | |
| 388 /* we shouldn't be subscribed to this message. ignore. */ | |
| 389 } else { | |
| 390 if (!zt2->open) { | |
| 391 zt2->open = TRUE; | |
| 392 serv_got_joined_chat(zgc, zt2->id, zt2->name); | |
| 393 } | |
| 3277 | 394 /* If the person is in the default Realm, then strip the |
| 395 Realm from the sender field */ | |
| 396 sendertmp = g_strdup_printf("%s",notice.z_sender); | |
| 4682 | 397 if ((realmptr = strchr(sendertmp,'@')) != NULL) { |
| 4588 | 398 realmptr++; |
| 4793 | 399 if (!g_ascii_strcasecmp(realmptr,ZGetRealm())) { |
| 4588 | 400 realmptr--; |
| 401 sprintf(realmptr,"%c",'\0'); | |
| 402 send_inst = g_strdup_printf("%s %s",sendertmp, | |
| 403 notice.z_class_inst); | |
| 404 } else { | |
| 405 send_inst = g_strdup_printf("%s %s",notice.z_sender, | |
| 406 notice.z_class_inst); | |
| 407 } | |
| 3277 | 408 } else { |
| 4588 | 409 send_inst = g_strdup_printf("%s %s",sendertmp,notice.z_class_inst); |
| 3277 | 410 } |
|
2804
1648c703ddc2
[gaim-migrate @ 2817]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
411 serv_got_chat_in(zgc, zt2->id, send_inst, FALSE, |
| 4687 | 412 buf2, time(NULL)); |
| 3277 | 413 g_free(sendertmp); |
|
2804
1648c703ddc2
[gaim-migrate @ 2817]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
414 g_free(send_inst); |
| 2086 | 415 } |
| 416 free_triple(zt1); | |
| 417 } | |
| 418 g_free(buf2); | |
| 419 } | |
| 420 } | |
| 421 } | |
| 422 | |
| 423 static gint check_notify(gpointer data) | |
| 424 { | |
| 425 while (ZPending()) { | |
| 426 ZNotice_t notice; | |
| 427 struct sockaddr_in from; | |
| 428 z_call_r(ZReceiveNotice(¬ice, &from)); | |
| 429 | |
| 430 switch (notice.z_kind) { | |
| 431 case UNSAFE: | |
| 432 case UNACKED: | |
| 433 case ACKED: | |
| 434 handle_message(notice, from); | |
| 435 break; | |
| 436 default: | |
| 437 /* we'll just ignore things for now */ | |
|
6484
5ced8e111473
[gaim-migrate @ 6998]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
438 gaim_debug(GAIM_DEBUG_WARNING, "zephyr", "Unhandled notice.\n"); |
| 2086 | 439 break; |
| 440 } | |
| 441 | |
| 442 ZFreeNotice(¬ice); | |
| 443 } | |
| 444 | |
| 445 return TRUE; | |
| 446 } | |
| 447 | |
| 448 static gint check_loc(gpointer data) | |
| 449 { | |
| 6695 | 450 GaimBlistNode *gnode, *cnode, *bnode; |
| 2086 | 451 ZAsyncLocateData_t ald; |
| 452 | |
| 453 ald.user = NULL; | |
| 454 memset(&(ald.uid), 0, sizeof(ZUnique_Id_t)); | |
| 455 ald.version = NULL; | |
| 456 | |
| 4785 | 457 for(gnode = gaim_get_blist()->root; gnode; gnode = gnode->next) { |
| 458 if(!GAIM_BLIST_NODE_IS_GROUP(gnode)) | |
| 459 continue; | |
| 6695 | 460 for(cnode = gnode->child; cnode; cnode = cnode->next) { |
| 461 if(!GAIM_BLIST_NODE_IS_CONTACT(cnode)) | |
| 4785 | 462 continue; |
| 6935 | 463 for(bnode = cnode->child; bnode; bnode = bnode->next) { |
| 6695 | 464 GaimBuddy *b = (GaimBuddy *)bnode; |
| 465 if(!GAIM_BLIST_NODE_IS_BUDDY(bnode)) | |
| 466 continue; | |
| 467 if(b->account->gc == zgc) { | |
| 7261 | 468 const char *chk; |
| 7322 | 469 chk = zephyr_normalize(b->account, b->name); |
| 6695 | 470 /* doesn't matter if this fails or not; we'll just move on to the next one */ |
| 471 ZRequestLocations(chk, &ald, UNACKED, ZAUTH); | |
| 472 free(ald.user); | |
| 473 free(ald.version); | |
| 474 } | |
| 4349 | 475 } |
| 2086 | 476 } |
| 477 } | |
| 478 | |
| 479 return TRUE; | |
| 480 } | |
| 481 | |
| 482 static char *get_exposure_level() | |
| 483 { | |
| 484 char *exposure = ZGetVariable("exposure"); | |
| 485 | |
| 486 if (!exposure) | |
| 487 return EXPOSE_REALMVIS; | |
| 4793 | 488 if (!g_ascii_strcasecmp(exposure, EXPOSE_NONE)) |
| 2086 | 489 return EXPOSE_NONE; |
| 4793 | 490 if (!g_ascii_strcasecmp(exposure, EXPOSE_OPSTAFF)) |
| 2086 | 491 return EXPOSE_OPSTAFF; |
| 4793 | 492 if (!g_ascii_strcasecmp(exposure, EXPOSE_REALMANN)) |
| 2086 | 493 return EXPOSE_REALMANN; |
| 4793 | 494 if (!g_ascii_strcasecmp(exposure, EXPOSE_NETVIS)) |
| 2086 | 495 return EXPOSE_NETVIS; |
| 4793 | 496 if (!g_ascii_strcasecmp(exposure, EXPOSE_NETANN)) |
| 2086 | 497 return EXPOSE_NETANN; |
| 498 return EXPOSE_REALMVIS; | |
| 499 } | |
| 500 | |
| 501 static void strip_comments(char *str) | |
| 502 { | |
| 503 char *tmp = strchr(str, '#'); | |
| 504 if (tmp) | |
| 505 *tmp = '\0'; | |
| 506 g_strchug(str); | |
| 507 g_strchomp(str); | |
| 508 } | |
| 509 | |
| 510 static void process_zsubs() | |
| 511 { | |
| 512 FILE *f; | |
| 513 gchar *fname; | |
| 514 gchar buff[BUFSIZ]; | |
| 515 | |
| 3630 | 516 fname = g_strdup_printf("%s/.zephyr.subs", gaim_home_dir()); |
| 2086 | 517 f = fopen(fname, "r"); |
| 518 if (f) { | |
| 519 char **triple; | |
| 520 ZSubscription_t sub; | |
| 521 char *recip; | |
| 522 while (fgets(buff, BUFSIZ, f)) { | |
| 523 strip_comments(buff); | |
| 524 if (buff[0]) { | |
| 525 triple = g_strsplit(buff, ",", 3); | |
| 3277 | 526 if (triple[0] && triple[1] ) { |
| 5132 | 527 /* char *tmp = g_strdup_printf("%s@%s", g_getenv("USER"), ZGetRealm()); */ |
| 4588 | 528 char *tmp = g_strdup_printf("%s",ZGetSender()); |
|
2804
1648c703ddc2
[gaim-migrate @ 2817]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
529 char *atptr; |
| 2086 | 530 sub.zsub_class = triple[0]; |
| 531 sub.zsub_classinst = triple[1]; | |
| 3277 | 532 if(triple[2] == NULL) { |
| 533 recip = g_malloc0(1); | |
| 4793 | 534 } else if (!g_ascii_strcasecmp(triple[2], "%me%")) { |
| 4588 | 535 recip = g_strdup_printf("%s",ZGetSender()); |
| 4793 | 536 } else if (!g_ascii_strcasecmp(triple[2], "*")) { |
|
2804
1648c703ddc2
[gaim-migrate @ 2817]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
537 /* wildcard |
|
1648c703ddc2
[gaim-migrate @ 2817]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
538 * form of class,instance,* */ |
|
1648c703ddc2
[gaim-migrate @ 2817]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
539 recip = g_malloc0(1); |
| 4793 | 540 } else if (!g_ascii_strcasecmp(triple[2], tmp)) { |
|
2804
1648c703ddc2
[gaim-migrate @ 2817]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
541 /* form of class,instance,aatharuv@ATHENA.MIT.EDU */ |
|
1648c703ddc2
[gaim-migrate @ 2817]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
542 recip = g_strdup(triple[2]); |
|
1648c703ddc2
[gaim-migrate @ 2817]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
543 } else if ((atptr = strchr(triple[2], '@')) != NULL) { |
|
1648c703ddc2
[gaim-migrate @ 2817]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
544 /* form of class,instance,*@ANDREW.CMU.EDU |
|
1648c703ddc2
[gaim-migrate @ 2817]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
545 * class,instance,@ANDREW.CMU.EDU |
|
1648c703ddc2
[gaim-migrate @ 2817]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
546 * If realm is local realm, blank recipient, else |
|
1648c703ddc2
[gaim-migrate @ 2817]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
547 * @REALM-NAME |
|
1648c703ddc2
[gaim-migrate @ 2817]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
548 */ |
|
1648c703ddc2
[gaim-migrate @ 2817]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
549 char *realmat = g_strdup_printf("@%s", ZGetRealm()); |
| 4793 | 550 if (!g_ascii_strcasecmp(atptr, realmat)) |
|
2804
1648c703ddc2
[gaim-migrate @ 2817]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
551 recip = g_malloc0(1); |
|
1648c703ddc2
[gaim-migrate @ 2817]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
552 else |
|
1648c703ddc2
[gaim-migrate @ 2817]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
553 recip = g_strdup(atptr); |
|
1648c703ddc2
[gaim-migrate @ 2817]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
554 g_free(realmat); |
| 2086 | 555 } else { |
| 556 recip = g_strdup(triple[2]); | |
| 557 } | |
|
2804
1648c703ddc2
[gaim-migrate @ 2817]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
558 g_free(tmp); |
| 2086 | 559 sub.zsub_recipient = recip; |
| 560 if (ZSubscribeTo(&sub, 1, 0) != ZERR_NONE) { | |
|
6484
5ced8e111473
[gaim-migrate @ 6998]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
561 gaim_debug(GAIM_DEBUG_ERROR, "zephyr", |
|
5ced8e111473
[gaim-migrate @ 6998]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
562 "Couldn't subscribe to %s, %s, %s\n", |
|
5ced8e111473
[gaim-migrate @ 6998]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
563 sub.zsub_class, |
|
5ced8e111473
[gaim-migrate @ 6998]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
564 sub.zsub_classinst, |
|
5ced8e111473
[gaim-migrate @ 6998]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
565 sub.zsub_recipient); |
| 2086 | 566 } |
| 567 subscrips = g_slist_append(subscrips, | |
| 568 new_triple(triple[0], triple[1], recip)); | |
| 569 g_free(recip); | |
| 570 } | |
| 571 g_strfreev(triple); | |
| 572 } | |
| 573 } | |
| 574 } | |
| 575 } | |
| 576 | |
| 577 static void process_anyone() | |
| 578 { | |
| 579 FILE *fd; | |
| 580 gchar buff[BUFSIZ], *filename; | |
| 6695 | 581 GaimGroup *g; |
| 582 GaimBuddy *b; | |
| 4775 | 583 |
| 584 if (!(g = gaim_find_group(_("Anyone")))) { | |
| 585 g = gaim_group_new(_("Anyone")); | |
| 586 gaim_blist_add_group(g, NULL); | |
| 587 } | |
| 6695 | 588 |
| 3630 | 589 filename = g_strconcat(gaim_home_dir(), "/.anyone", NULL); |
| 2086 | 590 if ((fd = fopen(filename, "r")) != NULL) { |
| 591 while (fgets(buff, BUFSIZ, fd)) { | |
| 592 strip_comments(buff); | |
| 4687 | 593 if (buff[0]) { |
| 594 b = gaim_buddy_new(zgc->account, buff, NULL); | |
| 6695 | 595 gaim_blist_add_buddy(b, NULL, g, NULL); |
| 4687 | 596 } |
| 2086 | 597 } |
| 598 fclose(fd); | |
| 599 } | |
| 600 g_free(filename); | |
| 601 } | |
| 602 | |
| 5606 | 603 static void zephyr_login(GaimAccount *account) |
| 2086 | 604 { |
| 605 ZSubscription_t sub; | |
| 606 | |
| 607 if (zgc) { | |
|
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5234
diff
changeset
|
608 gaim_notify_error(account->gc, NULL, |
|
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5234
diff
changeset
|
609 _("Already logged in with Zephyr"), |
|
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5234
diff
changeset
|
610 _("Because Zephyr uses your system username, you " |
|
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5234
diff
changeset
|
611 "are unable to have multiple accounts on it " |
|
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5234
diff
changeset
|
612 "when logged in as the same user.")); |
| 2086 | 613 return; |
| 614 } | |
| 615 | |
| 5606 | 616 zgc = gaim_account_get_connection(account); |
| 2086 | 617 |
| 618 z_call_s(ZInitialize(), "Couldn't initialize zephyr"); | |
| 619 z_call_s(ZOpenPort(NULL), "Couldn't open port"); | |
| 620 z_call_s(ZSetLocation(get_exposure_level()), "Couldn't set location"); | |
| 621 | |
| 622 sub.zsub_class = "MESSAGE"; | |
| 623 sub.zsub_classinst = "PERSONAL"; | |
| 624 sub.zsub_recipient = ZGetSender(); | |
| 625 | |
| 626 /* we don't care if this fails. i'm lying right now. */ | |
| 627 if (ZSubscribeTo(&sub, 1, 0) != ZERR_NONE) { | |
|
6484
5ced8e111473
[gaim-migrate @ 6998]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
628 gaim_debug(GAIM_DEBUG_ERROR, "zephyr", |
|
5ced8e111473
[gaim-migrate @ 6998]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
629 "Couldn't subscribe to messages!\n"); |
| 2086 | 630 } |
| 631 | |
| 5606 | 632 gaim_connection_set_state(zgc, GAIM_CONNECTED); |
| 2086 | 633 serv_finish_login(zgc); |
| 634 | |
| 635 process_anyone(); | |
| 636 process_zsubs(); | |
| 637 | |
|
2131
acc11216ec5d
[gaim-migrate @ 2141]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2123
diff
changeset
|
638 nottimer = g_timeout_add(100, check_notify, NULL); |
|
2804
1648c703ddc2
[gaim-migrate @ 2817]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
639 loctimer = g_timeout_add(20000, check_loc, NULL); |
| 2086 | 640 } |
| 641 | |
| 642 static void write_zsubs() | |
| 643 { | |
| 644 GSList *s = subscrips; | |
| 645 zephyr_triple *zt; | |
| 646 FILE *fd; | |
| 647 char *fname; | |
| 648 | |
| 3277 | 649 char** triple; |
| 3630 | 650 fname = g_strdup_printf("%s/.zephyr.subs", gaim_home_dir()); |
| 2086 | 651 fd = fopen(fname, "w"); |
| 652 | |
| 653 if (!fd) { | |
| 654 g_free(fname); | |
| 655 return; | |
| 656 } | |
| 657 | |
| 658 while (s) { | |
| 659 zt = s->data; | |
| 3277 | 660 triple = g_strsplit(zt->name,",",3); |
| 661 if (triple[2] != NULL) { | |
| 4793 | 662 if (!g_ascii_strcasecmp(triple[2], "")) { |
| 3277 | 663 fprintf(fd, "%s,%s,*\n", triple[0], triple[1]); |
| 4793 | 664 } else if (!g_ascii_strcasecmp(triple[2], ZGetSender())) { |
| 3277 | 665 fprintf(fd, "%s,%s,%%me%%\n",triple[0],triple[1]); |
| 666 } else { | |
| 667 fprintf(fd, "%s\n", zt->name); | |
| 668 } | |
| 669 } else { | |
| 670 fprintf(fd, "%s,%s,*\n",triple[0], triple[1]); | |
| 671 } | |
| 672 g_free(triple); | |
| 2086 | 673 s = s->next; |
| 674 } | |
| 675 g_free(fname); | |
| 676 fclose(fd); | |
| 677 } | |
| 678 | |
| 679 static void write_anyone() | |
| 680 { | |
| 6695 | 681 GaimBlistNode *gnode, *cnode, *bnode; |
| 682 GaimBuddy *b; | |
| 3277 | 683 char *ptr, *fname, *ptr2; |
| 2086 | 684 FILE *fd; |
| 685 | |
| 3630 | 686 fname = g_strdup_printf("%s/.anyone", gaim_home_dir()); |
| 2086 | 687 fd = fopen(fname, "w"); |
| 688 if (!fd) { | |
| 689 g_free(fname); | |
| 690 return; | |
| 691 } | |
| 692 | |
| 4785 | 693 for(gnode = gaim_get_blist()->root; gnode; gnode = gnode->next) { |
| 694 if(!GAIM_BLIST_NODE_IS_GROUP(gnode)) | |
| 695 continue; | |
| 6695 | 696 for(cnode = gnode->child; cnode; cnode = cnode->next) { |
| 697 if(!GAIM_BLIST_NODE_IS_CONTACT(cnode)) | |
| 4785 | 698 continue; |
| 6695 | 699 for(bnode = gnode->child; bnode; bnode = bnode->next) { |
| 700 if(!GAIM_BLIST_NODE_IS_BUDDY(bnode)) | |
| 701 continue; | |
| 702 b = (GaimBuddy *)bnode; | |
| 703 if(b->account->gc == zgc) { | |
| 704 if ((ptr = strchr(b->name, '@')) != NULL) { | |
| 705 ptr2 = ptr + 1; | |
| 706 /* We should only strip the realm name if the principal | |
| 707 is in the user's realm | |
| 708 */ | |
| 709 if (!g_ascii_strcasecmp(ptr2,ZGetRealm())) { | |
| 710 *ptr = '\0'; | |
| 711 } | |
| 4349 | 712 } |
| 6695 | 713 fprintf(fd, "%s\n", b->name); |
| 714 if (ptr) | |
| 715 *ptr = '@'; | |
| 3277 | 716 } |
| 717 } | |
| 2086 | 718 } |
| 719 } | |
| 720 | |
| 721 fclose(fd); | |
| 722 g_free(fname); | |
| 723 } | |
| 724 | |
| 5606 | 725 static void zephyr_close(GaimConnection *gc) |
| 2086 | 726 { |
| 727 GList *l; | |
| 728 GSList *s; | |
| 729 l = pending_zloc_names; | |
| 730 while (l) { | |
| 731 g_free((char*)l->data); | |
| 732 l = l->next; | |
| 733 } | |
| 734 g_list_free(pending_zloc_names); | |
| 735 | |
| 736 write_anyone(); | |
| 737 write_zsubs(); | |
| 738 | |
| 739 s = subscrips; | |
| 740 while (s) { | |
| 741 free_triple((zephyr_triple*)s->data); | |
| 742 s = s->next; | |
| 743 } | |
| 744 g_slist_free(subscrips); | |
| 745 | |
| 746 if (nottimer) | |
|
2131
acc11216ec5d
[gaim-migrate @ 2141]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2123
diff
changeset
|
747 g_source_remove(nottimer); |
| 2086 | 748 nottimer = 0; |
| 749 if (loctimer) | |
|
2131
acc11216ec5d
[gaim-migrate @ 2141]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2123
diff
changeset
|
750 g_source_remove(loctimer); |
| 2086 | 751 loctimer = 0; |
| 752 zgc = NULL; | |
| 753 z_call(ZCancelSubscriptions(0)); | |
| 754 z_call(ZUnsetLocation()); | |
| 755 z_call(ZClosePort()); | |
| 756 } | |
| 757 | |
|
6787
faa491042c66
[gaim-migrate @ 7326]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
758 static void zephyr_add_buddy(GaimConnection *gc, const char *buddy, GaimGroup *group) { } |
| 6059 | 759 static void zephyr_remove_buddy(GaimConnection *gc, const char *buddy, const char *group) { } |
| 2086 | 760 |
| 6059 | 761 static int zephyr_chat_send(GaimConnection *gc, int id, const char *im) |
| 2086 | 762 { |
| 763 ZNotice_t notice; | |
| 764 zephyr_triple *zt; | |
| 765 char *buf; | |
| 766 const char *sig; | |
| 767 | |
| 768 zt = find_sub_by_id(id); | |
| 769 if (!zt) | |
| 770 /* this should never happen. */ | |
|
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
771 return -EINVAL; |
| 2086 | 772 |
| 773 sig = ZGetVariable("zwrite-signature"); | |
| 774 if (!sig) { | |
| 775 sig = g_get_real_name(); | |
| 776 } | |
| 777 buf = g_strdup_printf("%s%c%s", sig, '\0', im); | |
| 778 | |
| 779 bzero((char *)¬ice, sizeof(notice)); | |
| 780 notice.z_kind = ACKED; | |
| 781 notice.z_port = 0; | |
| 782 notice.z_opcode = ""; | |
| 783 notice.z_class = zt->class; | |
| 784 notice.z_class_inst = zt->instance; | |
| 4793 | 785 if (!g_ascii_strcasecmp(zt->recipient, "*")) |
| 7322 | 786 notice.z_recipient = zephyr_normalize(gc->account, ""); |
| 2086 | 787 else |
| 7322 | 788 notice.z_recipient = zephyr_normalize(gc->account, zt->recipient); |
| 2086 | 789 notice.z_sender = 0; |
| 790 notice.z_default_format = | |
| 791 "Class $class, Instance $instance:\n" | |
| 792 "To: @bold($recipient) at $time $date\n" | |
| 793 "From: @bold($1) <$sender>\n\n$2"; | |
| 794 notice.z_message_len = strlen(im) + strlen(sig) + 4; | |
| 795 notice.z_message = buf; | |
| 796 ZSendNotice(¬ice, ZAUTH); | |
| 797 g_free(buf); | |
|
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
798 return 0; |
| 2086 | 799 } |
| 800 | |
|
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7084
diff
changeset
|
801 static int zephyr_send_im(GaimConnection *gc, const char *who, const char *im, GaimConvImFlags flags) { |
| 2086 | 802 ZNotice_t notice; |
| 803 char *buf; | |
| 804 const char *sig; | |
| 805 | |
|
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7084
diff
changeset
|
806 if (flags & GAIM_CONV_IM_AUTO_RESP) |
| 2086 | 807 sig = "Automated reply:"; |
| 808 else { | |
| 809 sig = ZGetVariable("zwrite-signature"); | |
| 810 if (!sig) { | |
| 811 sig = g_get_real_name(); | |
| 812 } | |
| 813 } | |
| 814 buf = g_strdup_printf("%s%c%s", sig, '\0', im); | |
| 815 | |
| 816 bzero((char *)¬ice, sizeof(notice)); | |
| 817 notice.z_kind = ACKED; | |
| 818 notice.z_port = 0; | |
| 819 notice.z_opcode = ""; | |
| 820 notice.z_class = "MESSAGE"; | |
| 821 notice.z_class_inst = "PERSONAL"; | |
| 822 notice.z_sender = 0; | |
| 823 notice.z_recipient = who; | |
| 824 notice.z_default_format = | |
| 825 "Class $class, Instance $instance:\n" | |
| 826 "To: @bold($recipient) at $time $date\n" | |
| 827 "From: @bold($1) <$sender>\n\n$2"; | |
| 828 notice.z_message_len = strlen(im) + strlen(sig) + 4; | |
| 829 notice.z_message = buf; | |
| 6904 | 830 ZSendNotice(¬ice, ZAUTH); |
| 2086 | 831 g_free(buf); |
|
2303
f5bf315e6104
[gaim-migrate @ 2313]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2231
diff
changeset
|
832 return 1; |
| 2086 | 833 } |
| 834 | |
| 7322 | 835 static const char *zephyr_normalize(const GaimAccount *account,const char *orig) |
| 2086 | 836 { |
| 837 static char buf[80]; | |
| 7126 | 838 if (!g_ascii_strcasecmp(orig, "")) { |
| 839 buf[0] = '\0'; | |
| 840 return buf; | |
| 841 } | |
| 2086 | 842 if (strchr(orig, '@')) { |
| 843 g_snprintf(buf, 80, "%s", orig); | |
| 844 } else { | |
| 845 g_snprintf(buf, 80, "%s@%s", orig, ZGetRealm()); | |
| 846 } | |
| 847 return buf; | |
| 848 } | |
| 849 | |
| 5606 | 850 static void zephyr_zloc(GaimConnection *gc, const char *who) |
| 2086 | 851 { |
| 852 ZAsyncLocateData_t ald; | |
| 7261 | 853 |
| 7322 | 854 if (ZRequestLocations(zephyr_normalize(gc->account, who), &ald, UNACKED, ZAUTH) |
| 2086 | 855 != ZERR_NONE) { |
| 856 return; | |
| 857 } | |
| 858 pending_zloc_names = g_list_append(pending_zloc_names, | |
| 7322 | 859 g_strdup(zephyr_normalize(gc->account, who))); |
| 2086 | 860 } |
| 861 | |
| 5606 | 862 static GList *zephyr_buddy_menu(GaimConnection *gc, const char *who) |
| 2086 | 863 { |
|
2170
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
864 GList *m = NULL; |
|
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
865 struct proto_buddy_menu *pbm; |
| 2086 | 866 |
|
2170
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
867 pbm = g_new0(struct proto_buddy_menu, 1); |
|
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
868 pbm->label = _("ZLocate"); |
|
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
869 pbm->callback = zephyr_zloc; |
|
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
870 pbm->gc = gc; |
|
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
871 m = g_list_append(m, pbm); |
|
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
872 |
|
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
873 return m; |
| 2086 | 874 } |
| 875 | |
| 6059 | 876 static void zephyr_set_away(GaimConnection *gc, const char *state, const char *msg) |
| 2086 | 877 { |
|
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
3867
diff
changeset
|
878 if (gc->away) { |
| 2086 | 879 g_free(gc->away); |
|
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
3867
diff
changeset
|
880 gc->away = NULL; |
|
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
3867
diff
changeset
|
881 } |
|
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
3867
diff
changeset
|
882 |
| 5132 | 883 if (!g_ascii_strcasecmp(state, _("Hidden"))) { |
| 2086 | 884 ZSetLocation(EXPOSE_OPSTAFF); |
|
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
3867
diff
changeset
|
885 gc->away = g_strdup(""); |
| 5132 | 886 } else if (!g_ascii_strcasecmp(state, _("Online"))) |
| 2086 | 887 ZSetLocation(get_exposure_level()); |
| 888 else /* state is GAIM_AWAY_CUSTOM */ if (msg) | |
| 889 gc->away = g_strdup(msg); | |
| 890 } | |
| 891 | |
| 5606 | 892 static GList *zephyr_away_states(GaimConnection *gc) |
| 2086 | 893 { |
| 894 GList *m = NULL; | |
| 895 | |
| 5132 | 896 m = g_list_append(m, _("Online")); |
| 2086 | 897 m = g_list_append(m, GAIM_AWAY_CUSTOM); |
| 5132 | 898 m = g_list_append(m, _("Hidden")); |
| 2086 | 899 |
| 900 return m; | |
| 901 } | |
| 902 | |
| 5606 | 903 static GList *zephyr_chat_info(GaimConnection *gc) { |
|
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2170
diff
changeset
|
904 GList *m = NULL; |
|
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2170
diff
changeset
|
905 struct proto_chat_entry *pce; |
| 2086 | 906 |
|
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2170
diff
changeset
|
907 pce = g_new0(struct proto_chat_entry, 1); |
|
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2170
diff
changeset
|
908 pce->label = _("Class:"); |
| 5234 | 909 pce->identifier = "class"; |
| 3158 | 910 m = g_list_append(m, pce); |
| 2086 | 911 |
|
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2170
diff
changeset
|
912 pce = g_new0(struct proto_chat_entry, 1); |
|
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2170
diff
changeset
|
913 pce->label = _("Instance:"); |
| 5234 | 914 pce->identifier = "instance"; |
| 3158 | 915 m = g_list_append(m, pce); |
| 2086 | 916 |
|
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2170
diff
changeset
|
917 pce = g_new0(struct proto_chat_entry, 1); |
|
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2170
diff
changeset
|
918 pce->label = _("Recipient:"); |
| 5234 | 919 pce->identifier = "recipient"; |
| 3158 | 920 m = g_list_append(m, pce); |
| 2086 | 921 |
|
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2170
diff
changeset
|
922 return m; |
| 2086 | 923 } |
| 924 | |
| 5606 | 925 static void zephyr_join_chat(GaimConnection *gc, GHashTable *data) |
| 2086 | 926 { |
| 927 ZSubscription_t sub; | |
| 928 zephyr_triple *zt1, *zt2; | |
| 929 const char *classname; | |
| 930 const char *instname; | |
| 931 const char *recip; | |
|
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2170
diff
changeset
|
932 |
| 5234 | 933 classname = g_hash_table_lookup(data, "class"); |
| 934 instname = g_hash_table_lookup(data, "instance"); | |
| 935 recip = g_hash_table_lookup(data, "recipient"); | |
| 936 | |
| 937 if (!classname || !instname || !recip) | |
|
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2170
diff
changeset
|
938 return; |
| 2086 | 939 |
| 4793 | 940 if (!g_ascii_strcasecmp(recip, "%me%")) |
| 4588 | 941 recip = ZGetSender(); |
| 2086 | 942 |
| 943 zt1 = new_triple(classname, instname, recip); | |
| 944 zt2 = find_sub_by_triple(zt1); | |
| 945 if (zt2) { | |
| 946 free_triple(zt1); | |
| 947 if (!zt2->open) | |
| 948 serv_got_joined_chat(gc, zt2->id, zt2->name); | |
| 949 return; | |
| 950 } | |
| 951 | |
| 952 sub.zsub_class = zt1->class; | |
| 953 sub.zsub_classinst = zt1->instance; | |
| 954 sub.zsub_recipient = zt1->recipient; | |
| 955 | |
| 956 if (ZSubscribeTo(&sub, 1, 0) != ZERR_NONE) { | |
| 957 free_triple(zt1); | |
| 958 return; | |
| 959 } | |
| 960 | |
| 961 subscrips = g_slist_append(subscrips, zt1); | |
| 962 zt1->open = TRUE; | |
| 963 serv_got_joined_chat(gc, zt1->id, zt1->name); | |
| 964 } | |
| 965 | |
| 5606 | 966 static void zephyr_chat_leave(GaimConnection *gc, int id) |
| 2086 | 967 { |
| 968 zephyr_triple *zt; | |
| 969 zt = find_sub_by_id(id); | |
| 970 if (zt) { | |
| 971 zt->open = FALSE; | |
| 972 zt->id = ++last_id; | |
| 973 } | |
| 974 } | |
| 975 | |
| 6695 | 976 static const char *zephyr_list_icon(GaimAccount *a, GaimBuddy *b) |
| 5202 | 977 { |
| 978 return "zephyr"; | |
| 979 } | |
| 980 | |
|
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
981 static GaimPlugin *my_protocol = NULL; |
| 2086 | 982 |
|
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
983 static GaimPluginProtocolInfo prpl_info = |
| 2086 | 984 { |
|
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
985 GAIM_PROTO_ZEPHYR, |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
986 OPT_PROTO_NO_PASSWORD, |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
987 NULL, |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
988 NULL, |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
989 zephyr_list_icon, |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
990 NULL, |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
991 NULL, |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
992 NULL, |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
993 zephyr_away_states, |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
994 NULL, |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
995 zephyr_buddy_menu, |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
996 zephyr_chat_info, |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
997 zephyr_login, |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
998 zephyr_close, |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
999 zephyr_send_im, |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
1000 NULL, |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
1001 NULL, |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
1002 zephyr_zloc, |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
1003 zephyr_set_away, |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
1004 NULL, |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
1005 NULL, |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
1006 NULL, |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
1007 NULL, |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
1008 NULL, |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
1009 NULL, |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
1010 zephyr_add_buddy, |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
1011 NULL, |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
1012 zephyr_remove_buddy, |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
1013 NULL, |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
1014 NULL, |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
1015 NULL, |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
1016 NULL, |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
1017 NULL, |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
1018 NULL, |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
1019 NULL, |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
1020 zephyr_join_chat, |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
1021 NULL, |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
1022 zephyr_chat_leave, |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
1023 NULL, |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
1024 zephyr_chat_send, |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
1025 NULL, |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
1026 NULL, |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
1027 NULL, |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
1028 NULL, |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
1029 NULL, |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
1030 NULL, |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
1031 NULL, |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
1032 NULL, |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
1033 NULL, |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
1034 zephyr_normalize |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
1035 }; |
| 2086 | 1036 |
|
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
1037 static GaimPluginInfo info = |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
1038 { |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
1039 2, /**< api_version */ |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
1040 GAIM_PLUGIN_PROTOCOL, /**< type */ |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
1041 NULL, /**< ui_requirement */ |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
1042 0, /**< flags */ |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
1043 NULL, /**< dependencies */ |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
1044 GAIM_PRIORITY_DEFAULT, /**< priority */ |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
1045 |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
1046 "prpl-zephyr", /**< id */ |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
1047 "Zephyr", /**< name */ |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
1048 VERSION, /**< version */ |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
1049 /** summary */ |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
1050 N_("Zephyr Protocol Plugin"), |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
1051 /** description */ |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
1052 N_("Zephyr Protocol Plugin"), |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
1053 NULL, /**< author */ |
|
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6059
diff
changeset
|
1054 GAIM_WEBSITE, /**< homepage */ |
|
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
1055 |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
1056 NULL, /**< load */ |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
1057 NULL, /**< unload */ |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
1058 NULL, /**< destroy */ |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
1059 |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
1060 NULL, /**< ui_info */ |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
1061 &prpl_info /**< extra_info */ |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
1062 }; |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
1063 |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
1064 static void |
|
5920
7d385de2f9cd
[gaim-migrate @ 6360]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1065 init_plugin(GaimPlugin *plugin) |
|
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
1066 { |
|
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5202
diff
changeset
|
1067 my_protocol = plugin; |
| 2086 | 1068 } |
| 1069 | |
|
5920
7d385de2f9cd
[gaim-migrate @ 6360]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1070 GAIM_INIT_PLUGIN(zephyr, init_plugin, info); |
