annotate src/server.c @ 498:6899492d9d91

[gaim-migrate @ 508] The start of 0.9.21 committer: Tailor Script <tailor@pidgin.im>
author Rob Flynn <gaim@robflynn.com>
date Fri, 14 Jul 2000 22:19:43 +0000
parents 6a92cd7322cc
children 6e318907bcce
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1 /*
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2 * gaim
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3 *
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4 * Copyright (C) 1998-1999, Mark Spencer <markster@marko.net>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
5 *
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
6 * This program is free software; you can redistribute it and/or modify
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
7 * it under the terms of the GNU General Public License as published by
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
8 * the Free Software Foundation; either version 2 of the License, or
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
9 * (at your option) any later version.
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
10 *
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
11 * This program is distributed in the hope that it will be useful,
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
14 * GNU General Public License for more details.
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
15 *
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
16 * You should have received a copy of the GNU General Public License
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
17 * along with this program; if not, write to the Free Software
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
19 *
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
20 */
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
21
349
b402a23f35df [gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 338
diff changeset
22 #ifdef HAVE_CONFIG_H
b402a23f35df [gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 338
diff changeset
23 #include "../config.h"
b402a23f35df [gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 338
diff changeset
24 #endif
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
25 #include <time.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
26 #include <stdio.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
27 #include <string.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
28 #include <sys/types.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
29 #include <sys/stat.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
30 #include <sys/time.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
31 #include <unistd.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
32 #include <gtk/gtk.h>
338
9d258a0aa560 [gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 335
diff changeset
33 #include <aim.h>
276
9e6fc62490cd [gaim-migrate @ 286]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 273
diff changeset
34 extern int gaim_caps;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
35 #include "gaim.h"
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
36
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
37 static int idle_timer = -1;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
38 static time_t lastsent = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
39 static time_t login_time = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
40 static struct timeval lag_tv;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
41 static int is_idle = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
42
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
43 int correction_time = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
44
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
45 int serv_login(char *username, char *password)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
46 {
423
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
47 if (!(general_options & OPT_GEN_USE_OSCAR)) {
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
48 USE_OSCAR = 0;
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
49 return toc_login(username, password);
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
50 } else {
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
51 USE_OSCAR = 1;
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
52 debug_print("Logging in using Oscar. Expect problems.\n");
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
53 return oscar_login(username, password);
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
54 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
55 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
56
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
57 void serv_close()
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
58 {
423
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
59 if (!USE_OSCAR)
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
60 toc_close();
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
61 else
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
62 oscar_close();
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
63
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
64 gtk_timeout_remove(idle_timer);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
65 idle_timer = -1;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
66 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
67
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
68
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
69 void serv_touch_idle()
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
70 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
71 /* Are we idle? If so, not anymore */
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
72 if (is_idle > 0) {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
73 is_idle = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
74 serv_set_idle(0);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
75 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
76 time(&lastsent);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
77 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
78
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
79
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
80 static gint check_idle()
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
81 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
82 time_t t;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
83
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
84 /* Not idle, really... :) */
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
85 update_all_buddies();
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
86
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
87 time(&t);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
88
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
89 gettimeofday(&lag_tv, NULL);
171
789c792ed14b [gaim-migrate @ 181]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 145
diff changeset
90 if (general_options & OPT_GEN_SHOW_LAGMETER)
181
f2d631f867a3 [gaim-migrate @ 191]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 171
diff changeset
91 serv_send_im(current_user->username, LAGOMETER_STR, 1);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
92
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
93 if (report_idle != IDLE_GAIM)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
94 return TRUE;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
95
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
96
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
97 if (is_idle)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
98 return TRUE;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
99
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
100 if ((t - lastsent) > 600) { /* 15 minutes! */
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
101 serv_set_idle((int)t - lastsent);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
102 is_idle = 1;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
103 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
104
115
890cfb7d8fdb [gaim-migrate @ 125]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 101
diff changeset
105 #ifdef GAIM_PLUGINS
890cfb7d8fdb [gaim-migrate @ 125]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 101
diff changeset
106 {
890cfb7d8fdb [gaim-migrate @ 125]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 101
diff changeset
107 GList *c = callbacks;
890cfb7d8fdb [gaim-migrate @ 125]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 101
diff changeset
108 struct gaim_callback *g;
890cfb7d8fdb [gaim-migrate @ 125]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 101
diff changeset
109 void (*function)(void *);
890cfb7d8fdb [gaim-migrate @ 125]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 101
diff changeset
110 while (c) {
890cfb7d8fdb [gaim-migrate @ 125]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 101
diff changeset
111 g = (struct gaim_callback *)c->data;
890cfb7d8fdb [gaim-migrate @ 125]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 101
diff changeset
112 if (g->event == event_blist_update &&
890cfb7d8fdb [gaim-migrate @ 125]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 101
diff changeset
113 g->function != NULL) {
890cfb7d8fdb [gaim-migrate @ 125]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 101
diff changeset
114 function = g->function;
890cfb7d8fdb [gaim-migrate @ 125]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 101
diff changeset
115 (*function)(g->data);
890cfb7d8fdb [gaim-migrate @ 125]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 101
diff changeset
116 }
890cfb7d8fdb [gaim-migrate @ 125]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 101
diff changeset
117 c = c->next;
890cfb7d8fdb [gaim-migrate @ 125]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 101
diff changeset
118 }
890cfb7d8fdb [gaim-migrate @ 125]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 101
diff changeset
119 }
890cfb7d8fdb [gaim-migrate @ 125]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 101
diff changeset
120 #endif
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
121
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
122 return TRUE;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
123
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
124 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
125
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
126
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
127 void serv_finish_login()
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
128 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
129 char *buf;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
130
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
131 if (strlen(current_user->user_info)) {
79
bfdc427b936d [gaim-migrate @ 89]
Rob Flynn <gaim@robflynn.com>
parents: 45
diff changeset
132 buf = g_malloc(strlen(current_user->user_info) * 4);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
133 strcpy(buf, current_user->user_info);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
134 escape_text(buf);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
135 serv_set_info(buf);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
136 g_free(buf);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
137 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
138
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
139 if (idle_timer != -1)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
140 gtk_timeout_remove(idle_timer);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
141
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
142 idle_timer = gtk_timeout_add(20000, (GtkFunction)check_idle, NULL);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
143 serv_touch_idle();
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
144
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
145 time(&login_time);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
146
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
147 serv_add_buddy(current_user->username);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
148
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
149 if (!(general_options & OPT_GEN_REGISTERED))
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
150 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
151 show_register_dialog();
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
152 save_prefs();
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
153 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
154 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
155
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
156
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
157
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
158 void serv_send_im(char *name, char *message, int away)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
159 {
423
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
160 if (!USE_OSCAR) {
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 447
diff changeset
161 char buf[MSG_LEN - 7];
94
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
162
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 447
diff changeset
163 g_snprintf(buf, MSG_LEN - 8, "toc_send_im %s \"%s\"%s", normalize(name),
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 447
diff changeset
164 message, ((away) ? " auto" : ""));
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 447
diff changeset
165 sflap_send(buf, strlen(buf), TYPE_DATA);
423
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
166 } else {
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 447
diff changeset
167 if (away)
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 447
diff changeset
168 aim_send_im(gaim_sess, gaim_conn, name, AIM_IMFLAGS_AWAY, message);
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 447
diff changeset
169 else
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 447
diff changeset
170 aim_send_im(gaim_sess, gaim_conn, name, 0, message);
423
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
171 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
172 if (!away)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
173 serv_touch_idle();
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
174 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
175
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
176 void serv_get_info(char *name)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
177 {
423
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
178 if (!USE_OSCAR) {
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 200
diff changeset
179 char buf[MSG_LEN];
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
180 g_snprintf(buf, MSG_LEN, "toc_get_info %s", normalize(name));
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
181 sflap_send(buf, -1, TYPE_DATA);
423
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
182 } else {
249
810c595258c8 [gaim-migrate @ 259]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 248
diff changeset
183 aim_getinfo(gaim_sess, gaim_conn, name, AIM_GETINFO_GENERALINFO);
423
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
184 }
249
810c595258c8 [gaim-migrate @ 259]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 248
diff changeset
185 }
810c595258c8 [gaim-migrate @ 259]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 248
diff changeset
186
810c595258c8 [gaim-migrate @ 259]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 248
diff changeset
187 void serv_get_away_msg(char *name)
810c595258c8 [gaim-migrate @ 259]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 248
diff changeset
188 {
423
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
189 if (!USE_OSCAR) {
249
810c595258c8 [gaim-migrate @ 259]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 248
diff changeset
190 /* HAHA! TOC doesn't have this yet */
423
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
191 } else {
249
810c595258c8 [gaim-migrate @ 259]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 248
diff changeset
192 aim_getinfo(gaim_sess, gaim_conn, name, AIM_GETINFO_AWAYMESSAGE);
423
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
193 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
194 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
195
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
196 void serv_get_dir(char *name)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
197 {
423
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
198 if (!USE_OSCAR) {
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
199 char buf[MSG_LEN];
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
200 g_snprintf(buf, MSG_LEN, "toc_get_dir %s", normalize(name));
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
201 sflap_send(buf, -1, TYPE_DATA);
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
202 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
203 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
204
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
205 void serv_set_dir(char *first, char *middle, char *last, char *maiden,
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
206 char *city, char *state, char *country, int web)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
207 {
423
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
208 if (!USE_OSCAR) {
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 200
diff changeset
209 char buf2[BUF_LEN*4], buf[BUF_LEN];
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
210 g_snprintf(buf2, sizeof(buf2), "%s:%s:%s:%s:%s:%s:%s:%s", first,
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
211 middle, last, maiden, city, state, country,
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
212 (web == 1) ? "Y" : "");
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
213 escape_text(buf2);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
214 g_snprintf(buf, sizeof(buf), "toc_set_dir %s", buf2);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
215 sflap_send(buf, -1, TYPE_DATA);
423
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
216 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
217 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
218
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
219 void serv_dir_search(char *first, char *middle, char *last, char *maiden,
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
220 char *city, char *state, char *country, char *email)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
221 {
423
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
222 if (!USE_OSCAR) {
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
223 char buf[BUF_LONG];
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
224 g_snprintf(buf, sizeof(buf)/2, "toc_dir_search %s:%s:%s:%s:%s:%s:%s:%s", first, middle, last, maiden, city, state, country, email);
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
225 sprintf(debug_buff,"Searching for: %s,%s,%s,%s,%s,%s,%s\n", first, middle, last, maiden, city, state, country);
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
226 debug_print(debug_buff);
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
227 sflap_send(buf, -1, TYPE_DATA);
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
228 } else {
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
229 if (strlen(email))
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
230 aim_usersearch_address(gaim_sess, gaim_conn, email);
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
231 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
232 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
233
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
234
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
235 void serv_set_away(char *message)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
236 {
423
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
237 if (!USE_OSCAR) {
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
238 char buf[MSG_LEN];
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
239 if (message)
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
240 g_snprintf(buf, MSG_LEN, "toc_set_away \"%s\"", message);
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
241 else
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
242 g_snprintf(buf, MSG_LEN, "toc_set_away \"\"");
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
243 sflap_send(buf, -1, TYPE_DATA);
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
244 } else {
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
245 aim_bos_setprofile(gaim_sess, gaim_conn, current_user->user_info,
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
246 message, gaim_caps);
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
247 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
248 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
249
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
250 void serv_set_info(char *info)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
251 {
423
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
252 if (!USE_OSCAR) {
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
253 char buf[MSG_LEN];
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
254 g_snprintf(buf, sizeof(buf), "toc_set_info \"%s\n\"", info);
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
255 sflap_send(buf, -1, TYPE_DATA);
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
256 } else {
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
257 if (awaymessage)
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
258 aim_bos_setprofile(gaim_sess, gaim_conn, info,
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
259 awaymessage->message, gaim_caps);
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
260 else
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
261 aim_bos_setprofile(gaim_sess, gaim_conn, info,
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
262 NULL, gaim_caps);
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
263 }
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 200
diff changeset
264 }
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 200
diff changeset
265
331
f3c8d79688db [gaim-migrate @ 341]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 319
diff changeset
266 extern gboolean change_password;
f3c8d79688db [gaim-migrate @ 341]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 319
diff changeset
267 extern char *old_password;
f3c8d79688db [gaim-migrate @ 341]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 319
diff changeset
268 extern char *new_password;
f3c8d79688db [gaim-migrate @ 341]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 319
diff changeset
269
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 200
diff changeset
270 void serv_change_passwd(char *orig, char *new) {
423
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
271 if (!USE_OSCAR) {
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
272 char *buf = g_malloc(BUF_LONG);
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
273 g_snprintf(buf, BUF_LONG, "toc_change_passwd %s %s", orig, new);
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
274 sflap_send(buf, strlen(buf), TYPE_DATA);
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
275 g_free(buf);
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
276 } else {
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
277 if (change_password) return;
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
278 change_password = TRUE;
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
279 old_password = g_strdup(orig);
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
280 new_password = g_strdup(new);
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
281 aim_bos_reqservice(gaim_sess, gaim_conn, AIM_CONN_TYPE_AUTH);
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
282 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
283 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
284
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
285 void serv_add_buddy(char *name)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
286 {
423
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
287 if (!USE_OSCAR) {
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
288 char buf[1024];
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
289 g_snprintf(buf, sizeof(buf), "toc_add_buddy %s", normalize(name));
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
290 sflap_send(buf, -1, TYPE_DATA);
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
291 } else {
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
292 aim_add_buddy(gaim_sess, gaim_conn, name);
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
293 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
294 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
295
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
296 void serv_add_buddies(GList *buddies)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
297 {
423
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
298 if (!USE_OSCAR) {
447
5db3734a1fe6 [gaim-migrate @ 457]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 423
diff changeset
299 char buf[MSG_LEN];
5db3734a1fe6 [gaim-migrate @ 457]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 423
diff changeset
300 int n, num = 0;
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 200
diff changeset
301
447
5db3734a1fe6 [gaim-migrate @ 457]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 423
diff changeset
302 n = g_snprintf(buf, sizeof(buf), "toc_add_buddy");
5db3734a1fe6 [gaim-migrate @ 457]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 423
diff changeset
303 while(buddies) {
5db3734a1fe6 [gaim-migrate @ 457]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 423
diff changeset
304 /* i don't know why we choose 8, it just seems good */
5db3734a1fe6 [gaim-migrate @ 457]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 423
diff changeset
305 if (strlen(normalize(buddies->data)) > MSG_LEN - n - 8) {
5db3734a1fe6 [gaim-migrate @ 457]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 423
diff changeset
306 sflap_send(buf, -1, TYPE_DATA);
5db3734a1fe6 [gaim-migrate @ 457]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 423
diff changeset
307 n = g_snprintf(buf, sizeof(buf), "toc_add_buddy");
5db3734a1fe6 [gaim-migrate @ 457]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 423
diff changeset
308 num = 0;
5db3734a1fe6 [gaim-migrate @ 457]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 423
diff changeset
309 }
5db3734a1fe6 [gaim-migrate @ 457]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 423
diff changeset
310 ++num;
5db3734a1fe6 [gaim-migrate @ 457]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 423
diff changeset
311 n += g_snprintf(buf + n, sizeof(buf) - n, " %s", normalize(buddies->data));
5db3734a1fe6 [gaim-migrate @ 457]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 423
diff changeset
312 buddies = buddies->next;
5db3734a1fe6 [gaim-migrate @ 457]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 423
diff changeset
313 }
5db3734a1fe6 [gaim-migrate @ 457]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 423
diff changeset
314 sflap_send(buf, -1, TYPE_DATA);
423
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
315 } else {
447
5db3734a1fe6 [gaim-migrate @ 457]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 423
diff changeset
316 char buf[MSG_LEN];
5db3734a1fe6 [gaim-migrate @ 457]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 423
diff changeset
317 int n = 0;
5db3734a1fe6 [gaim-migrate @ 457]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 423
diff changeset
318 while(buddies) {
5db3734a1fe6 [gaim-migrate @ 457]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 423
diff changeset
319 if (n > MSG_LEN - 18) {
5db3734a1fe6 [gaim-migrate @ 457]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 423
diff changeset
320 aim_bos_setbuddylist(gaim_sess, gaim_conn, buf);
5db3734a1fe6 [gaim-migrate @ 457]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 423
diff changeset
321 n = 0;
5db3734a1fe6 [gaim-migrate @ 457]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 423
diff changeset
322 }
5db3734a1fe6 [gaim-migrate @ 457]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 423
diff changeset
323 n += g_snprintf(buf + n, sizeof(buf) - n, "%s&",
5db3734a1fe6 [gaim-migrate @ 457]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 423
diff changeset
324 (char *)buddies->data);
5db3734a1fe6 [gaim-migrate @ 457]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 423
diff changeset
325 buddies = buddies->next;
319
cea40691706c [gaim-migrate @ 329]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 318
diff changeset
326 }
447
5db3734a1fe6 [gaim-migrate @ 457]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 423
diff changeset
327 aim_bos_setbuddylist(gaim_sess, gaim_conn, buf);
423
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
328 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
329 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
330
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
331
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
332 void serv_remove_buddy(char *name)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
333 {
423
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
334 if (!USE_OSCAR) {
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
335 char buf[1024];
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
336 g_snprintf(buf, sizeof(buf), "toc_remove_buddy %s", normalize(name));
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
337 sflap_send(buf, -1, TYPE_DATA);
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
338 } else {
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
339 aim_remove_buddy(gaim_sess, gaim_conn, name);
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
340 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
341 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
342
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
343 void serv_add_permit(char *name)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
344 {
423
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
345 if (!USE_OSCAR) {
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
346 char buf[1024];
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
347 g_snprintf(buf, sizeof(buf), "toc_add_permit %s", normalize(name));
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
348 sflap_send(buf, -1, TYPE_DATA);
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
349 } else {
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
350 serv_set_permit_deny();
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
351 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
352 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
353
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
354
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
355
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
356 void serv_add_deny(char *name)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
357 {
423
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
358 if (!USE_OSCAR) {
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
359 char buf[1024];
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
360 g_snprintf(buf, sizeof(buf), "toc_add_deny %s", normalize(name));
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
361 sflap_send(buf, -1, TYPE_DATA);
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
362 } else {
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
363 serv_set_permit_deny();
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
364 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
365 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
366
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
367
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
368
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
369 void serv_set_permit_deny()
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
370 {
423
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
371 if (!USE_OSCAR) {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
372 char buf[MSG_LEN];
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
373 int at;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
374 GList *list;
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 200
diff changeset
375
318
35796808896a [gaim-migrate @ 328]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 314
diff changeset
376 if (permdeny == 1 || permdeny == 4) {
35796808896a [gaim-migrate @ 328]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 314
diff changeset
377 g_snprintf(buf, sizeof(buf), "toc_add_deny");
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
378 sflap_send(buf, -1, TYPE_DATA);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
379 } else {
318
35796808896a [gaim-migrate @ 328]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 314
diff changeset
380 g_snprintf(buf, sizeof(buf), "toc_add_permit");
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
381 sflap_send(buf, -1, TYPE_DATA);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
382 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
383
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
384
318
35796808896a [gaim-migrate @ 328]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 314
diff changeset
385 if (permit) {
35796808896a [gaim-migrate @ 328]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 314
diff changeset
386 at = g_snprintf(buf, sizeof(buf), "toc_add_permit");
35796808896a [gaim-migrate @ 328]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 314
diff changeset
387 list = permit;
35796808896a [gaim-migrate @ 328]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 314
diff changeset
388 while(list) {
35796808896a [gaim-migrate @ 328]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 314
diff changeset
389 at += g_snprintf(&buf[at], sizeof(buf) - at, " %s", normalize(list->data));
35796808896a [gaim-migrate @ 328]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 314
diff changeset
390 list = list->next;
35796808896a [gaim-migrate @ 328]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 314
diff changeset
391 }
35796808896a [gaim-migrate @ 328]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 314
diff changeset
392 buf[at] = 0;
35796808896a [gaim-migrate @ 328]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 314
diff changeset
393 sflap_send(buf, -1, TYPE_DATA);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
394 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
395
318
35796808896a [gaim-migrate @ 328]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 314
diff changeset
396 if (deny) {
35796808896a [gaim-migrate @ 328]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 314
diff changeset
397 at = g_snprintf(buf, sizeof(buf), "toc_add_deny");
35796808896a [gaim-migrate @ 328]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 314
diff changeset
398 list = deny;
35796808896a [gaim-migrate @ 328]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 314
diff changeset
399 while(list) {
35796808896a [gaim-migrate @ 328]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 314
diff changeset
400 at += g_snprintf(&buf[at], sizeof(buf) - at, " %s", normalize(list->data));
35796808896a [gaim-migrate @ 328]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 314
diff changeset
401 list = list->next;
35796808896a [gaim-migrate @ 328]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 314
diff changeset
402 }
35796808896a [gaim-migrate @ 328]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 314
diff changeset
403 buf[at] = 0;
35796808896a [gaim-migrate @ 328]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 314
diff changeset
404 sflap_send(buf, -1, TYPE_DATA);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
405 }
423
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
406 } else {
247
f6e8ea29b24f [gaim-migrate @ 257]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 243
diff changeset
407 /* oscar requires us to do everyone at once (?) */
265
59f1748b09a6 [gaim-migrate @ 275]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 263
diff changeset
408 /* I think this code is OK now. */
281
7b06ba09ffe2 [gaim-migrate @ 291]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 280
diff changeset
409 char buf[BUF_LONG]; int at; GList *list, *grp, *bud;
7b06ba09ffe2 [gaim-migrate @ 291]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 280
diff changeset
410 if (permdeny == 3) { /* Permit Some : Only people on buddy list and
7b06ba09ffe2 [gaim-migrate @ 291]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 280
diff changeset
411 on permit list */
7b06ba09ffe2 [gaim-migrate @ 291]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 280
diff changeset
412 struct group *g; struct buddy *b;
7b06ba09ffe2 [gaim-migrate @ 291]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 280
diff changeset
413 at = 0; list = permit; grp = groups;
7b06ba09ffe2 [gaim-migrate @ 291]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 280
diff changeset
414 debug_print("Setting permit list...\n");
7b06ba09ffe2 [gaim-migrate @ 291]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 280
diff changeset
415 while (grp) {
7b06ba09ffe2 [gaim-migrate @ 291]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 280
diff changeset
416 g = (struct group *)grp->data;
7b06ba09ffe2 [gaim-migrate @ 291]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 280
diff changeset
417 bud = g->members;
7b06ba09ffe2 [gaim-migrate @ 291]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 280
diff changeset
418 while (bud) {
7b06ba09ffe2 [gaim-migrate @ 291]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 280
diff changeset
419 b = (struct buddy *)bud->data;
7b06ba09ffe2 [gaim-migrate @ 291]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 280
diff changeset
420 at += g_snprintf(&buf[at], sizeof(buf) - at,
7b06ba09ffe2 [gaim-migrate @ 291]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 280
diff changeset
421 "%s&", b->name);
7b06ba09ffe2 [gaim-migrate @ 291]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 280
diff changeset
422 bud = bud->next;
7b06ba09ffe2 [gaim-migrate @ 291]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 280
diff changeset
423 }
7b06ba09ffe2 [gaim-migrate @ 291]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 280
diff changeset
424 grp = grp->next;
7b06ba09ffe2 [gaim-migrate @ 291]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 280
diff changeset
425 }
7b06ba09ffe2 [gaim-migrate @ 291]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 280
diff changeset
426 while (list) {
7b06ba09ffe2 [gaim-migrate @ 291]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 280
diff changeset
427 at += g_snprintf(&buf[at], sizeof(buf) - at, "%s&",
411
a330017b3aa4 [gaim-migrate @ 421]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 400
diff changeset
428 (char *)list->data);
281
7b06ba09ffe2 [gaim-migrate @ 291]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 280
diff changeset
429 list = list->next;
7b06ba09ffe2 [gaim-migrate @ 291]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 280
diff changeset
430 }
7b06ba09ffe2 [gaim-migrate @ 291]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 280
diff changeset
431 aim_bos_changevisibility(gaim_sess, gaim_conn,
7b06ba09ffe2 [gaim-migrate @ 291]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 280
diff changeset
432 AIM_VISIBILITYCHANGE_PERMITADD, buf);
7b06ba09ffe2 [gaim-migrate @ 291]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 280
diff changeset
433 } else { /* Deny Some : Deny people on deny list */
7b06ba09ffe2 [gaim-migrate @ 291]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 280
diff changeset
434 list = deny; at = 0;
7b06ba09ffe2 [gaim-migrate @ 291]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 280
diff changeset
435 if (list == NULL) return;
7b06ba09ffe2 [gaim-migrate @ 291]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 280
diff changeset
436 while (list) {
7b06ba09ffe2 [gaim-migrate @ 291]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 280
diff changeset
437 at += g_snprintf(&buf[at], sizeof(buf) - at, "%s&",
411
a330017b3aa4 [gaim-migrate @ 421]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 400
diff changeset
438 (char *)list->data);
281
7b06ba09ffe2 [gaim-migrate @ 291]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 280
diff changeset
439 list = list->next;
7b06ba09ffe2 [gaim-migrate @ 291]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 280
diff changeset
440 }
7b06ba09ffe2 [gaim-migrate @ 291]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 280
diff changeset
441 aim_bos_changevisibility(gaim_sess, gaim_conn,
7b06ba09ffe2 [gaim-migrate @ 291]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 280
diff changeset
442 AIM_VISIBILITYCHANGE_DENYADD, buf);
280
e606585a38bd [gaim-migrate @ 290]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 276
diff changeset
443 }
423
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
444 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
445 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
446
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
447 void serv_set_idle(int time)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
448 {
423
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
449 if (!USE_OSCAR) {
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
450 char buf[256];
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
451 g_snprintf(buf, sizeof(buf), "toc_set_idle %d", time);
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
452 sflap_send(buf, -1, TYPE_DATA);
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
453 } else {
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
454 aim_bos_setidle(gaim_sess, gaim_conn, time);
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
455 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
456 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
457
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
458
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
459 void serv_warn(char *name, int anon)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
460 {
423
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
461 if (!USE_OSCAR) {
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
462 char *send = g_malloc(256);
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
463 g_snprintf(send, 255, "toc_evil %s %s", name,
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
464 ((anon) ? "anon" : "norm"));
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
465 sflap_send(send, -1, TYPE_DATA);
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
466 g_free(send);
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
467 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
468 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
469
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 200
diff changeset
470 void serv_build_config(char *buf, int len) {
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 200
diff changeset
471 toc_build_config(buf, len);
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 200
diff changeset
472 }
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 200
diff changeset
473
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
474
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
475 void serv_save_config()
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
476 {
423
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
477 if (!USE_OSCAR) {
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
478 char *buf = g_malloc(BUF_LONG);
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
479 char *buf2 = g_malloc(MSG_LEN);
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
480 serv_build_config(buf, BUF_LONG / 2);
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
481 g_snprintf(buf2, MSG_LEN, "toc_set_config {%s}", buf);
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
482 sflap_send(buf2, -1, TYPE_DATA);
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
483 g_free(buf2);
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
484 g_free(buf);
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
485 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
486 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
487
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
488
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
489 void serv_accept_chat(int i)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
490 {
423
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
491 if (!USE_OSCAR) {
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
492 char *buf = g_malloc(256);
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
493 g_snprintf(buf, 255, "toc_chat_accept %d", i);
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
494 sflap_send(buf, -1, TYPE_DATA);
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
495 g_free(buf);
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
496 } else {
252
4a41f8323022 [gaim-migrate @ 262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 249
diff changeset
497 /* this should never get called because libfaim doesn't use the id
4a41f8323022 [gaim-migrate @ 262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 249
diff changeset
498 * (i'm not even sure Oscar does). go through serv_join_chat instead */
423
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
499 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
500 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
501
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
502 void serv_join_chat(int exchange, char *name)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
503 {
423
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
504 if (!USE_OSCAR) {
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
505 char buf[BUF_LONG];
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
506 g_snprintf(buf, sizeof(buf)/2, "toc_chat_join %d \"%s\"", exchange, name);
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
507 sflap_send(buf, -1, TYPE_DATA);
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
508 } else {
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
509 sprintf(debug_buff, "Attempting to join chat room %s.\n", name);
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
510 debug_print(debug_buff);
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
511 aim_chat_join(gaim_sess, gaim_conn, 0x0004, name);
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
512 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
513 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
514
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
515 void serv_chat_invite(int id, char *message, char *name)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
516 {
423
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
517 if (!USE_OSCAR) {
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
518 char buf[BUF_LONG];
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
519 g_snprintf(buf, sizeof(buf)/2, "toc_chat_invite %d \"%s\" %s", id, message, normalize(name));
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
520 sflap_send(buf, -1, TYPE_DATA);
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
521 } else {
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
522 GList *bcs = buddy_chats;
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 447
diff changeset
523 struct conversation *b = NULL;
258
1eeece1c7b7b [gaim-migrate @ 268]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 256
diff changeset
524
423
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
525 while (bcs) {
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 447
diff changeset
526 b = (struct conversation *)bcs->data;
423
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
527 if (id == b->id)
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
528 break;
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
529 bcs = bcs->next;
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
530 b = NULL;
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
531 }
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
532
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
533 if (!b)
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
534 return;
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
535
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
536 aim_chat_invite(gaim_sess, gaim_conn, name, message, 0x4, b->name, 0x1);
258
1eeece1c7b7b [gaim-migrate @ 268]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 256
diff changeset
537 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
538 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
539
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
540 void serv_chat_leave(int id)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
541 {
423
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
542 if (!USE_OSCAR) {
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
543 char *buf = g_malloc(256);
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
544 g_snprintf(buf, 255, "toc_chat_leave %d", id);
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
545 sflap_send(buf, -1, TYPE_DATA);
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
546 g_free(buf);
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
547 } else {
248
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
548 GList *bcs = buddy_chats;
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 447
diff changeset
549 struct conversation *b = NULL;
312
3069be4c291e [gaim-migrate @ 322]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 302
diff changeset
550 struct chat_connection *c = NULL;
368
9bf1f77985d2 [gaim-migrate @ 378]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 349
diff changeset
551 int count = 0;
248
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
552
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
553 while (bcs) {
368
9bf1f77985d2 [gaim-migrate @ 378]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 349
diff changeset
554 count++;
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 447
diff changeset
555 b = (struct conversation *)bcs->data;
248
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
556 if (id == b->id)
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
557 break;
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
558 bcs = bcs->next;
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
559 b = NULL;
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
560 }
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
561
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
562 if (!b)
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
563 return;
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
564
368
9bf1f77985d2 [gaim-migrate @ 378]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 349
diff changeset
565 sprintf(debug_buff, "Attempting to leave room %s (currently in %d rooms)\n",
9bf1f77985d2 [gaim-migrate @ 378]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 349
diff changeset
566 b->name, count);
9bf1f77985d2 [gaim-migrate @ 378]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 349
diff changeset
567 debug_print(debug_buff);
9bf1f77985d2 [gaim-migrate @ 378]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 349
diff changeset
568
248
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
569 aim_chat_leaveroom(gaim_sess, b->name);
312
3069be4c291e [gaim-migrate @ 322]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 302
diff changeset
570 c = find_oscar_chat(b->name);
3069be4c291e [gaim-migrate @ 322]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 302
diff changeset
571 if (c != NULL) {
3069be4c291e [gaim-migrate @ 322]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 302
diff changeset
572 oscar_chats = g_list_remove(oscar_chats, c);
3069be4c291e [gaim-migrate @ 322]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 302
diff changeset
573 gdk_input_remove(c->inpa);
3069be4c291e [gaim-migrate @ 322]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 302
diff changeset
574 g_free(c->name);
3069be4c291e [gaim-migrate @ 322]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 302
diff changeset
575 g_free(c);
3069be4c291e [gaim-migrate @ 322]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 302
diff changeset
576 }
368
9bf1f77985d2 [gaim-migrate @ 378]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 349
diff changeset
577 /* we do this because with Oscar it doesn't tell us we left */
9bf1f77985d2 [gaim-migrate @ 378]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 349
diff changeset
578 serv_got_chat_left(b->id);
423
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
579 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
580 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
581
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
582 void serv_chat_whisper(int id, char *who, char *message)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
583 {
423
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
584 if (!USE_OSCAR) {
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
585 char buf2[MSG_LEN];
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
586 g_snprintf(buf2, sizeof(buf2), "toc_chat_whisper %d %s \"%s\"", id, who, message);
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
587 sflap_send(buf2, -1, TYPE_DATA);
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
588 } else {
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
589 do_error_dialog("Sorry, Oscar doesn't whisper. Send an IM. (The last message was not received.)",
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
590 "Gaim - Chat");
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
591 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
592 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
593
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
594 void serv_chat_send(int id, char *message)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
595 {
423
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
596 if (!USE_OSCAR) {
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
597 char buf[MSG_LEN];
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
598 g_snprintf(buf, sizeof(buf), "toc_chat_send %d \"%s\"",id, message);
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
599 sflap_send(buf, -1, TYPE_DATA);
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
600 } else {
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
601 struct aim_conn_t *cn;
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
602 GList *bcs = buddy_chats;
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 447
diff changeset
603 struct conversation *b = NULL;
248
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
604
423
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
605 while (bcs) {
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 447
diff changeset
606 b = (struct conversation *)bcs->data;
423
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
607 if (id == b->id)
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
608 break;
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
609 bcs = bcs->next;
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
610 b = NULL;
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
611 }
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
612 if (!b)
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
613 return;
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
614
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
615 cn = aim_chat_getconn(gaim_sess, b->name);
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
616 aim_chat_send_im(gaim_sess, cn, message);
248
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
617 }
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 447
diff changeset
618 serv_touch_idle();
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
619 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
620
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
621
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
622
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
623
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
624 void serv_got_im(char *name, char *message, int away)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
625 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
626 struct conversation *cnv;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
627 int is_idle = -1;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
628 int new_conv = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
629 char *nname;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
630
94
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
631 #ifdef GAIM_PLUGINS
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
632 GList *c = callbacks;
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
633 struct gaim_callback *g;
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
634 void (*function)(char **, char **, void *);
391
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
635 char *buffy = g_strdup(message);
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
636 char *angel = g_strdup(name);
94
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
637 while (c) {
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
638 g = (struct gaim_callback *)c->data;
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
639 if (g->event == event_im_recv && g->function != NULL) {
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
640 function = g->function;
391
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
641 (*function)(&angel, &buffy, g->data);
94
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
642 }
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
643 c = c->next;
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
644 }
391
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
645 if (!buffy || !angel)
94
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
646 return;
391
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
647 g_snprintf(message, strlen(message) + 1, "%s", buffy);
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
648 g_free(buffy);
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
649 g_snprintf(name, strlen(name) + 1, "%s", angel);
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
650 g_free(angel);
94
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
651 #endif
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
652
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
653 nname = g_strdup(normalize(name));
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
654
171
789c792ed14b [gaim-migrate @ 181]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 145
diff changeset
655 if (!strcasecmp(normalize(current_user->username), nname)) {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
656 if (!strcmp(message, LAGOMETER_STR)) {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
657 struct timeval tv;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
658 int ms;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
659
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
660 gettimeofday(&tv, NULL);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
661
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
662 ms = 1000000 * (tv.tv_sec - lag_tv.tv_sec);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
663
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
664 ms += tv.tv_usec - lag_tv.tv_usec;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
665
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
666 update_lagometer(ms);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
667 g_free(nname);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
668 return;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
669 }
14
d5119dc66284 [gaim-migrate @ 23]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
670 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
671 g_free(nname);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
672
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
673 cnv = find_conversation(name);
145
41bd1cd48571 [gaim-migrate @ 155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 136
diff changeset
674 if (away) away = WFLAG_AUTO;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
675
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
676 if (awaymessage != NULL) {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
677 if (!(general_options & OPT_GEN_DISCARD_WHEN_AWAY)) {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
678 if (cnv == NULL) {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
679 new_conv = 1;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
680 cnv = new_conversation(name);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
681 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
682 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
683 if (cnv != NULL) {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
684 if (sound_options & OPT_SOUND_WHEN_AWAY)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
685 play_sound(AWAY);
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 447
diff changeset
686 write_to_conv(cnv, message, away | WFLAG_RECV, NULL);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
687 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
688
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
689 } else {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
690 if (cnv == NULL) {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
691 new_conv = 1;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
692 cnv = new_conversation(name);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
693 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
694 if (new_conv && (sound_options & OPT_SOUND_FIRST_RCV)) {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
695 play_sound(FIRST_RECEIVE);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
696 } else {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
697 if (cnv->makesound && (sound_options & OPT_SOUND_RECV))
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
698 play_sound(RECEIVE);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
699 }
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 447
diff changeset
700 write_to_conv(cnv, message, away | WFLAG_RECV, NULL);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
701 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
702
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
703
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
704
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
705
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
706 if (awaymessage != NULL) {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
707 time_t t;
263
8aa7368baae7 [gaim-migrate @ 273]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 260
diff changeset
708 char tmpmsg[BUF_LEN];
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
709
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
710 time(&t);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
711
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
712
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
713 if ((cnv == NULL) || (t - cnv->sent_away) < 120)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
714 return;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
715
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
716 cnv->sent_away = t;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
717
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
718 if (is_idle)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
719 is_idle = -1;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
720
263
8aa7368baae7 [gaim-migrate @ 273]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 260
diff changeset
721 strcpy(tmpmsg, awaymessage->message);
8aa7368baae7 [gaim-migrate @ 273]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 260
diff changeset
722 escape_text(tmpmsg);
8aa7368baae7 [gaim-migrate @ 273]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 260
diff changeset
723 escape_message(tmpmsg);
8aa7368baae7 [gaim-migrate @ 273]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 260
diff changeset
724 serv_send_im(name, tmpmsg, 1);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
725
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
726 if (is_idle == -1)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
727 is_idle = 1;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
728
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
729 if (cnv != NULL)
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 447
diff changeset
730 write_to_conv(cnv, awaymessage->message, WFLAG_SEND | WFLAG_AUTO, NULL);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
731 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
732 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
733
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
734
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
735
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
736 void serv_got_update(char *name, int loggedin, int evil, time_t signon, time_t idle, int type)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
737 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
738 struct buddy *b;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
739 char *nname;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
740
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
741 b = find_buddy(name);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
742
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
743 nname = g_strdup(normalize(name));
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
744 if (!strcasecmp(nname, normalize(current_user->username))) {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
745 correction_time = (int)(signon - login_time);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
746 update_all_buddies();
25
c56db1b46b0d [gaim-migrate @ 34]
Rob Flynn <gaim@robflynn.com>
parents: 14
diff changeset
747 if (!b) {
c56db1b46b0d [gaim-migrate @ 34]
Rob Flynn <gaim@robflynn.com>
parents: 14
diff changeset
748 g_free(nname);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
749 return;
25
c56db1b46b0d [gaim-migrate @ 34]
Rob Flynn <gaim@robflynn.com>
parents: 14
diff changeset
750 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
751 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
752
25
c56db1b46b0d [gaim-migrate @ 34]
Rob Flynn <gaim@robflynn.com>
parents: 14
diff changeset
753 g_free(nname);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
754
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
755 if (!b) {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
756 sprintf(debug_buff,"Error, no such person\n");
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
757 debug_print(debug_buff);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
758 return;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
759 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
760
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
761 /* This code will 'align' the name from the TOC */
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
762 /* server with what's in our record. We want to */
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
763 /* store things how THEY want it... */
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
764 if (strcmp(name, b->name)) {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
765 GList *cnv = conversations;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
766 struct conversation *cv;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
767
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
768 char *who = g_malloc(80);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
769
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
770 strcpy(who, normalize(name));
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
771
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
772 while(cnv) {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
773 cv = (struct conversation *)cnv->data;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
774 if (!strcasecmp(who, normalize(cv->name))) {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
775 g_snprintf(cv->name, sizeof(cv->name), "%s", name);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
776 if (find_log_info(name) || (general_options & OPT_GEN_LOG_ALL))
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
777 g_snprintf(who, 63, LOG_CONVERSATION_TITLE, name);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
778 else
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
779 g_snprintf(who, 63, CONVERSATION_TITLE, name);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
780 gtk_window_set_title(GTK_WINDOW(cv->window), who);
79
bfdc427b936d [gaim-migrate @ 89]
Rob Flynn <gaim@robflynn.com>
parents: 45
diff changeset
781 /* was g_free(buf), but break gives us that
bfdc427b936d [gaim-migrate @ 89]
Rob Flynn <gaim@robflynn.com>
parents: 45
diff changeset
782 * and freeing twice is not good --Sumner */
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
783 break;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
784 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
785 cnv = cnv->next;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
786 }
45
939455223459 [gaim-migrate @ 54]
Rob Flynn <gaim@robflynn.com>
parents: 25
diff changeset
787 g_free(who);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
788 g_snprintf(b->name, sizeof(b->name), "%s", name);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
789 /*gtk_label_set_text(GTK_LABEL(b->label), b->name);*/
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
790
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
791 /* okay lets save the new config... */
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
792
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
793 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
794
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
795 b->idle = idle;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
796 b->evil = evil;
136
4e91b92f91a7 [gaim-migrate @ 146]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 115
diff changeset
797 #ifdef GAIM_PLUGINS
4e91b92f91a7 [gaim-migrate @ 146]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 115
diff changeset
798 if ((b->uc & UC_UNAVAILABLE) && !(type & UC_UNAVAILABLE)) {
4e91b92f91a7 [gaim-migrate @ 146]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 115
diff changeset
799 GList *c = callbacks;
4e91b92f91a7 [gaim-migrate @ 146]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 115
diff changeset
800 struct gaim_callback *g;
4e91b92f91a7 [gaim-migrate @ 146]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 115
diff changeset
801 void (*function)(char *, void *);
4e91b92f91a7 [gaim-migrate @ 146]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 115
diff changeset
802 while (c) {
4e91b92f91a7 [gaim-migrate @ 146]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 115
diff changeset
803 g = (struct gaim_callback *)c->data;
4e91b92f91a7 [gaim-migrate @ 146]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 115
diff changeset
804 if (g->event == event_buddy_back &&
4e91b92f91a7 [gaim-migrate @ 146]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 115
diff changeset
805 g->function != NULL) {
4e91b92f91a7 [gaim-migrate @ 146]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 115
diff changeset
806 function = g->function;
4e91b92f91a7 [gaim-migrate @ 146]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 115
diff changeset
807 (*function)(b->name, g->data);
4e91b92f91a7 [gaim-migrate @ 146]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 115
diff changeset
808 }
4e91b92f91a7 [gaim-migrate @ 146]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 115
diff changeset
809 c = c->next;
4e91b92f91a7 [gaim-migrate @ 146]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 115
diff changeset
810 }
4e91b92f91a7 [gaim-migrate @ 146]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 115
diff changeset
811 }
4e91b92f91a7 [gaim-migrate @ 146]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 115
diff changeset
812 #endif
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
813 b->uc = type;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
814
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
815 b->signon = signon;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
816
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
817 if (loggedin) {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
818 if (!b->present) {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
819 b->present = 1;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
820 do_pounce(b->name);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
821 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
822 } else
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
823 b->present = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
824
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
825 set_buddy(b);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
826 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
827
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
828 static
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
829 void close_warned(GtkWidget *w, GtkWidget *w2)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
830 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
831 gtk_widget_destroy(w2);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
832 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
833
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
834
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
835
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
836 void serv_got_eviled(char *name, int lev)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
837 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
838 char *buf2 = g_malloc(1024);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
839 GtkWidget *d, *label, *close;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
840
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
841
391
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
842 #ifdef GAIM_PLUGINS
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
843 GList *c = callbacks;
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
844 struct gaim_callback *g;
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
845 void (*function)(char *, int, void *);
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
846 while (c) {
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
847 g = (struct gaim_callback *)c->data;
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
848 if (g->event == event_warned && g->function != NULL) {
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
849 function = g->function;
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
850 (*function)(name, lev, g->data);
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
851 }
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
852 c = c->next;
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
853 }
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
854 #endif
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
855
400
bb87776942c4 [gaim-migrate @ 410]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 391
diff changeset
856 g_snprintf(buf2, 1023, "You have just been warned by %s.\nYour new warning level is %d%%",
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
857 ((name == NULL) ? "an anonymous person" : name) , lev);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
858
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
859
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
860 d = gtk_dialog_new();
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
861 gtk_widget_realize(d);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
862 aol_icon(d->window);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
863
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
864 label = gtk_label_new(buf2);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
865 gtk_widget_show(label);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
866 close = gtk_button_new_with_label("Close");
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
867 gtk_widget_show(close);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
868 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(d)->vbox),
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
869 label, FALSE, FALSE, 5);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
870 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(d)->action_area),
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
871 close, FALSE, FALSE, 5);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
872
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
873 gtk_window_set_title(GTK_WINDOW(d), "Warned");
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
874 gtk_signal_connect(GTK_OBJECT(close), "clicked", GTK_SIGNAL_FUNC(close_warned), d);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
875 gtk_widget_show(d);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
876 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
877
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
878
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
879
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
880 static void close_invite(GtkWidget *w, GtkWidget *w2)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
881 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
882 gtk_widget_destroy(w2);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
883 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
884
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
885 static void chat_invite_callback(GtkWidget *w, GtkWidget *w2)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
886 {
423
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
887 if (!USE_OSCAR) {
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
888 int i = (int)gtk_object_get_user_data(GTK_OBJECT(w2));
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
889 serv_accept_chat(i);
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
890 gtk_widget_destroy(w2);
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
891 } else {
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
892 char *i = (char *)gtk_object_get_user_data(GTK_OBJECT(w2));
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
893 serv_join_chat(0, i); /* for oscar, it doesn't use the id anyway */
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
894 g_free(i);
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
895 gtk_widget_destroy(w2);
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
896 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
897 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
898
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
899
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
900
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
901 void serv_got_chat_invite(char *name, int id, char *who, char *message)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
902 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
903 GtkWidget *d;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
904 GtkWidget *label;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
905 GtkWidget *yesbtn;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
906 GtkWidget *nobtn;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
907
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
908 char buf2[BUF_LONG];
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
909
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
910
391
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
911 #ifdef GAIM_PLUGINS
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
912 GList *c = callbacks;
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
913 struct gaim_callback *g;
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
914 void (*function)(char *, char *, char *, void *);
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
915 while (c) {
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
916 g = (struct gaim_callback *)c->data;
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
917 if (g->event == event_chat_invited && g->function != NULL) {
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
918 function = g->function;
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
919 (*function)(who, name, message, g->data);
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
920 }
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
921 c = c->next;
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
922 }
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
923 #endif
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
924
414
f9dc74875833 [gaim-migrate @ 424]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
925 if (message)
f9dc74875833 [gaim-migrate @ 424]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
926 g_snprintf(buf2, sizeof(buf2), "User '%s' invites you to buddy chat room: '%s'\n%s", who, name, message);
f9dc74875833 [gaim-migrate @ 424]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
927 else
f9dc74875833 [gaim-migrate @ 424]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 411
diff changeset
928 g_snprintf(buf2, sizeof(buf2), "User '%s' invites you to buddy chat room: '%s'\n", who, name);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
929
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
930 d = gtk_dialog_new();
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
931 gtk_widget_realize(d);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
932 aol_icon(d->window);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
933
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
934
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
935 label = gtk_label_new(buf2);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
936 gtk_widget_show(label);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
937 yesbtn = gtk_button_new_with_label("Yes");
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
938 gtk_widget_show(yesbtn);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
939 nobtn = gtk_button_new_with_label("No");
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
940 gtk_widget_show(nobtn);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
941 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(d)->vbox),
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
942 label, FALSE, FALSE, 5);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
943 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(d)->action_area),
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
944 yesbtn, FALSE, FALSE, 5);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
945 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(d)->action_area),
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
946 nobtn, FALSE, FALSE, 5);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
947
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
948
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
949 /* gtk_widget_set_usize(d, 200, 110); */
423
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
950
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
951 if (!USE_OSCAR)
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
952 gtk_object_set_user_data(GTK_OBJECT(d), (void *)id);
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
953 else
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
954 gtk_object_set_user_data(GTK_OBJECT(d), (void *)g_strdup(name));
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
955
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
956
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
957 gtk_window_set_title(GTK_WINDOW(d), "Buddy chat invite");
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
958 gtk_signal_connect(GTK_OBJECT(nobtn), "clicked", GTK_SIGNAL_FUNC(close_invite), d);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
959 gtk_signal_connect(GTK_OBJECT(yesbtn), "clicked", GTK_SIGNAL_FUNC(chat_invite_callback), d);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
960
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
961
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
962 gtk_widget_show(d);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
963 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
964
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
965 void serv_got_joined_chat(int id, char *name)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
966 {
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 447
diff changeset
967 struct conversation *b;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
968
391
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
969 #ifdef GAIM_PLUGINS
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
970 GList *c = callbacks;
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
971 struct gaim_callback *g;
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
972 void (*function)(char *, void *);
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
973 while (c) {
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
974 g = (struct gaim_callback *)c->data;
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
975 if (g->event == event_chat_join && g->function != NULL) {
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
976 function = g->function;
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
977 (*function)(name, g->data);
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
978 }
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
979 c = c->next;
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
980 }
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
981 #endif
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
982
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 447
diff changeset
983 b = (struct conversation *)g_new0(struct conversation, 1);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
984 buddy_chats = g_list_append(buddy_chats, b);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
985
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 447
diff changeset
986 b->is_chat = TRUE;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
987 b->ignored = NULL;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
988 b->in_room = NULL;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
989 b->id = id;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
990 g_snprintf(b->name, 80, "%s", name);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
991 show_new_buddy_chat(b);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
992 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
993
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
994 void serv_got_chat_left(int id)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
995 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
996 GList *bcs = buddy_chats;
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 447
diff changeset
997 struct conversation *b = NULL;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
998
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
999
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1000 while(bcs) {
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 447
diff changeset
1001 b = (struct conversation *)bcs->data;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1002 if (id == b->id) {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1003 break;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1004 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1005 b = NULL;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1006 bcs = bcs->next;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1007 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1008
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1009 if (!b)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1010 return;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1011
391
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
1012 #ifdef GAIM_PLUGINS
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
1013 {
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
1014 GList *c = callbacks;
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
1015 struct gaim_callback *g;
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
1016 void (*function)(char *, void *);
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
1017 while (c) {
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
1018 g = (struct gaim_callback *)c->data;
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
1019 if (g->event == event_chat_leave && g->function != NULL) {
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
1020 function = g->function;
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
1021 (*function)(b->name, g->data);
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
1022 }
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
1023 c = c->next;
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
1024 }
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
1025 }
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
1026 #endif
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
1027
368
9bf1f77985d2 [gaim-migrate @ 378]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 349
diff changeset
1028 sprintf(debug_buff, "Leaving room %s.\n", b->name);
9bf1f77985d2 [gaim-migrate @ 378]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 349
diff changeset
1029 debug_print(debug_buff);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1030
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1031 buddy_chats = g_list_remove(buddy_chats, b);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1032
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1033 g_free(b);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1034 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1035
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1036 void serv_got_chat_in(int id, char *who, int whisper, char *message)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1037 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1038 int w;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1039 GList *bcs = buddy_chats;
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 447
diff changeset
1040 struct conversation *b = NULL;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1041
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1042 while(bcs) {
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 447
diff changeset
1043 b = (struct conversation *)bcs->data;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1044 if (id == b->id)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1045 break;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1046 bcs = bcs->next;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1047 b = NULL;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1048
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1049 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1050 if (!b)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1051 return;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1052
391
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
1053 #ifdef GAIM_PLUGINS
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
1054 {
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
1055 GList *c = callbacks;
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
1056 struct gaim_callback *g;
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
1057 void (*function)(char *, char *, char *, void *);
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
1058 while (c) {
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
1059 g = (struct gaim_callback *)c->data;
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
1060 if (g->event == event_chat_recv && g->function != NULL) {
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
1061 function = g->function;
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
1062 (*function)(b->name, who, message, g->data);
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
1063 }
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
1064 c = c->next;
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
1065 }
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
1066 }
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
1067 #endif
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 368
diff changeset
1068
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1069 if (whisper)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1070 w = WFLAG_WHISPER;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1071 else
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1072 w = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1073
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1074 chat_write(b, who, w, message);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1075 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1076
260
325d9804df10 [gaim-migrate @ 270]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 258
diff changeset
1077 void serv_rvous_accept(char *name, char *cookie, char *uid)
325d9804df10 [gaim-migrate @ 270]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 258
diff changeset
1078 {
423
0d4e80bdb96b [gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 414
diff changeset
1079 /* Oscar doesn't matter here because this won't ever be called for it */
260
325d9804df10 [gaim-migrate @ 270]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 258
diff changeset
1080 char buf[MSG_LEN];
325d9804df10 [gaim-migrate @ 270]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 258
diff changeset
1081 g_snprintf(buf, MSG_LEN, "toc_rvous_accept %s %s %s", normalize(name),
325d9804df10 [gaim-migrate @ 270]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 258
diff changeset
1082 cookie, uid);
325d9804df10 [gaim-migrate @ 270]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 258
diff changeset
1083 sflap_send(buf, strlen(buf), TYPE_DATA);
325d9804df10 [gaim-migrate @ 270]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 258
diff changeset
1084 }
325d9804df10 [gaim-migrate @ 270]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 258
diff changeset
1085
325d9804df10 [gaim-migrate @ 270]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 258
diff changeset
1086 void serv_rvous_cancel(char *name, char *cookie, char *uid)
325d9804df10 [gaim-migrate @ 270]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 258
diff changeset
1087 {
325d9804df10 [gaim-migrate @ 270]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 258
diff changeset
1088 char buf[MSG_LEN];
325d9804df10 [gaim-migrate @ 270]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 258
diff changeset
1089 g_snprintf(buf, MSG_LEN, "toc_rvous_cancel %s %s %s", normalize(name),
325d9804df10 [gaim-migrate @ 270]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 258
diff changeset
1090 cookie, uid);
325d9804df10 [gaim-migrate @ 270]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 258
diff changeset
1091 sflap_send(buf, strlen(buf), TYPE_DATA);
325d9804df10 [gaim-migrate @ 270]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 258
diff changeset
1092 }