annotate src/server.c @ 276:9e6fc62490cd

[gaim-migrate @ 286] receive messages faster committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Sun, 28 May 2000 21:38:54 +0000
parents 4c6c213646a3
children e606585a38bd
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
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
22 #include <time.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
23 #include <stdio.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
24 #include <string.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
25 #include <sys/types.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
26 #include <sys/stat.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
27 #include <sys/time.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
28 #include <unistd.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
29 #include <gtk/gtk.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
30 #ifdef USE_OSCAR
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
31 #include "../libfaim/aim.h"
276
9e6fc62490cd [gaim-migrate @ 286]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 273
diff changeset
32 extern int gaim_caps;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
33 #endif
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
34 #include "gaim.h"
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
35
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
36 static int idle_timer = -1;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
37 static time_t lastsent = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
38 static time_t login_time = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
39 static struct timeval lag_tv;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
40 static int is_idle = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
41
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
42 int correction_time = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
43
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
44 int serv_login(char *username, char *password)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
45 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
46 #ifndef USE_OSCAR
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
47 return toc_login(username, password);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
48 #else
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
49 return oscar_login(username, password);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
50 #endif
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
51 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
52
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
53 void serv_close()
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
54 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
55 #ifndef USE_OSCAR
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
56 toc_close();
242
14fc16f579c8 [gaim-migrate @ 252]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 237
diff changeset
57 #else
14fc16f579c8 [gaim-migrate @ 252]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 237
diff changeset
58 oscar_close();
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
59 #endif
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
60 gtk_timeout_remove(idle_timer);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
61 idle_timer = -1;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
62 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
63
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
64
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
65 void serv_touch_idle()
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 /* Are we idle? If so, not anymore */
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
68 if (is_idle > 0) {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
69 is_idle = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
70 serv_set_idle(0);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
71 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
72 time(&lastsent);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
73 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
74
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 static gint check_idle()
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 time_t t;
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 /* Not idle, really... :) */
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
81 update_all_buddies();
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
82
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
83 time(&t);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
84
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
85 gettimeofday(&lag_tv, NULL);
171
789c792ed14b [gaim-migrate @ 181]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 145
diff changeset
86 if (general_options & OPT_GEN_SHOW_LAGMETER)
181
f2d631f867a3 [gaim-migrate @ 191]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 171
diff changeset
87 serv_send_im(current_user->username, LAGOMETER_STR, 1);
1
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 if (report_idle != IDLE_GAIM)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
90 return TRUE;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
91
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 (is_idle)
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 if ((t - lastsent) > 600) { /* 15 minutes! */
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
97 serv_set_idle((int)t - lastsent);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
98 is_idle = 1;
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
115
890cfb7d8fdb [gaim-migrate @ 125]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 101
diff changeset
101 #ifdef GAIM_PLUGINS
890cfb7d8fdb [gaim-migrate @ 125]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 101
diff changeset
102 {
890cfb7d8fdb [gaim-migrate @ 125]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 101
diff changeset
103 GList *c = callbacks;
890cfb7d8fdb [gaim-migrate @ 125]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 101
diff changeset
104 struct gaim_callback *g;
890cfb7d8fdb [gaim-migrate @ 125]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 101
diff changeset
105 void (*function)(void *);
890cfb7d8fdb [gaim-migrate @ 125]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 101
diff changeset
106 while (c) {
890cfb7d8fdb [gaim-migrate @ 125]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 101
diff changeset
107 g = (struct gaim_callback *)c->data;
890cfb7d8fdb [gaim-migrate @ 125]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 101
diff changeset
108 if (g->event == event_blist_update &&
890cfb7d8fdb [gaim-migrate @ 125]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 101
diff changeset
109 g->function != NULL) {
890cfb7d8fdb [gaim-migrate @ 125]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 101
diff changeset
110 function = g->function;
890cfb7d8fdb [gaim-migrate @ 125]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 101
diff changeset
111 (*function)(g->data);
890cfb7d8fdb [gaim-migrate @ 125]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 101
diff changeset
112 }
890cfb7d8fdb [gaim-migrate @ 125]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 101
diff changeset
113 c = c->next;
890cfb7d8fdb [gaim-migrate @ 125]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 101
diff changeset
114 }
890cfb7d8fdb [gaim-migrate @ 125]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 101
diff changeset
115 }
890cfb7d8fdb [gaim-migrate @ 125]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 101
diff changeset
116 #endif
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
117
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
118 return TRUE;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
119
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
120 }
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
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
123 void serv_finish_login()
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 char *buf;
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 if (strlen(current_user->user_info)) {
79
bfdc427b936d [gaim-migrate @ 89]
Rob Flynn <gaim@robflynn.com>
parents: 45
diff changeset
128 buf = g_malloc(strlen(current_user->user_info) * 4);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
129 strcpy(buf, current_user->user_info);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
130 escape_text(buf);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
131 serv_set_info(buf);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
132 g_free(buf);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
133 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
134
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
135 if (idle_timer != -1)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
136 gtk_timeout_remove(idle_timer);
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 idle_timer = gtk_timeout_add(20000, (GtkFunction)check_idle, NULL);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
139 serv_touch_idle();
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
140
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
141 time(&login_time);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
142
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
143 serv_add_buddy(current_user->username);
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 if (!(general_options & OPT_GEN_REGISTERED))
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 show_register_dialog();
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
148 save_prefs();
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
149 }
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
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
152
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 void serv_send_im(char *name, char *message, int away)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
155 {
273
4c6c213646a3 [gaim-migrate @ 283]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 270
diff changeset
156 #ifndef USE_OSCAR
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
157 char buf[MSG_LEN - 7];
94
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
158
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
159 g_snprintf(buf, MSG_LEN - 8, "toc_send_im %s \"%s\"%s", normalize(name),
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
160 message, ((away) ? " auto" : ""));
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
161 sflap_send(buf, strlen(buf), TYPE_DATA);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
162 #else
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 200
diff changeset
163 oscar_send_im(name, message, away);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
164 #endif
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
165 if (!away)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
166 serv_touch_idle();
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
167 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
168
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
169 void serv_get_info(char *name)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
170 {
273
4c6c213646a3 [gaim-migrate @ 283]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 270
diff changeset
171 #ifndef USE_OSCAR
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 200
diff changeset
172 char buf[MSG_LEN];
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
173 g_snprintf(buf, MSG_LEN, "toc_get_info %s", normalize(name));
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
174 sflap_send(buf, -1, TYPE_DATA);
243
3414ff74cb0f [gaim-migrate @ 253]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 242
diff changeset
175 #else
249
810c595258c8 [gaim-migrate @ 259]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 248
diff changeset
176 aim_getinfo(gaim_sess, gaim_conn, name, AIM_GETINFO_GENERALINFO);
810c595258c8 [gaim-migrate @ 259]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 248
diff changeset
177 #endif
810c595258c8 [gaim-migrate @ 259]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 248
diff changeset
178 }
810c595258c8 [gaim-migrate @ 259]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 248
diff changeset
179
810c595258c8 [gaim-migrate @ 259]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 248
diff changeset
180 void serv_get_away_msg(char *name)
810c595258c8 [gaim-migrate @ 259]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 248
diff changeset
181 {
273
4c6c213646a3 [gaim-migrate @ 283]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 270
diff changeset
182 #ifndef USE_OSCAR
249
810c595258c8 [gaim-migrate @ 259]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 248
diff changeset
183 char buf[MSG_LEN];
810c595258c8 [gaim-migrate @ 259]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 248
diff changeset
184 /* HAHA! TOC doesn't have this yet */
810c595258c8 [gaim-migrate @ 259]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 248
diff changeset
185 #else
810c595258c8 [gaim-migrate @ 259]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 248
diff changeset
186 aim_getinfo(gaim_sess, gaim_conn, name, AIM_GETINFO_AWAYMESSAGE);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
187 #endif
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
188 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
189
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
190 void serv_get_dir(char *name)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
191 {
273
4c6c213646a3 [gaim-migrate @ 283]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 270
diff changeset
192 #ifndef USE_OSCAR
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 200
diff changeset
193 char buf[MSG_LEN];
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
194 g_snprintf(buf, MSG_LEN, "toc_get_dir %s", normalize(name));
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
195 sflap_send(buf, -1, TYPE_DATA);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
196 #endif
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
197 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
198
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
199 void serv_set_dir(char *first, char *middle, char *last, char *maiden,
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
200 char *city, char *state, char *country, int web)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
201 {
273
4c6c213646a3 [gaim-migrate @ 283]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 270
diff changeset
202 #ifndef USE_OSCAR
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 200
diff changeset
203 char buf2[BUF_LEN*4], buf[BUF_LEN];
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
204 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
205 middle, last, maiden, city, state, country,
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
206 (web == 1) ? "Y" : "");
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
207 escape_text(buf2);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
208 g_snprintf(buf, sizeof(buf), "toc_set_dir %s", buf2);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
209 sflap_send(buf, -1, TYPE_DATA);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
210 #endif
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
211 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
212
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
213 void serv_dir_search(char *first, char *middle, char *last, char *maiden,
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
214 char *city, char *state, char *country, char *email)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
215 {
273
4c6c213646a3 [gaim-migrate @ 283]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 270
diff changeset
216 #ifndef USE_OSCAR
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 200
diff changeset
217 char buf[BUF_LONG];
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
218 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);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
219 sprintf(debug_buff,"Searching for: %s,%s,%s,%s,%s,%s,%s\n", first, middle, last, maiden, city, state, country);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
220 debug_print(debug_buff);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
221 sflap_send(buf, -1, TYPE_DATA);
243
3414ff74cb0f [gaim-migrate @ 253]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 242
diff changeset
222 #else
3414ff74cb0f [gaim-migrate @ 253]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 242
diff changeset
223 if (strlen(email))
3414ff74cb0f [gaim-migrate @ 253]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 242
diff changeset
224 aim_usersearch_address(gaim_sess, gaim_conn, email);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
225 #endif
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
226 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
227
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
228
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
229 void serv_set_away(char *message)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
230 {
273
4c6c213646a3 [gaim-migrate @ 283]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 270
diff changeset
231 #ifndef USE_OSCAR
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 200
diff changeset
232 char buf[MSG_LEN];
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
233 if (message)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
234 g_snprintf(buf, MSG_LEN, "toc_set_away \"%s\"", message);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
235 else
200
bc117fbcf527 [gaim-migrate @ 210]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 181
diff changeset
236 g_snprintf(buf, MSG_LEN, "toc_set_away \"\"");
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
237 sflap_send(buf, -1, TYPE_DATA);
243
3414ff74cb0f [gaim-migrate @ 253]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 242
diff changeset
238 #else
3414ff74cb0f [gaim-migrate @ 253]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 242
diff changeset
239 aim_bos_setprofile(gaim_sess, gaim_conn, current_user->user_info,
276
9e6fc62490cd [gaim-migrate @ 286]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 273
diff changeset
240 message, gaim_caps);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
241 #endif
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
242 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
243
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
244 void serv_set_info(char *info)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
245 {
273
4c6c213646a3 [gaim-migrate @ 283]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 270
diff changeset
246 #ifndef USE_OSCAR
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
247 char buf[MSG_LEN];
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
248 g_snprintf(buf, sizeof(buf), "toc_set_info \"%s\n\"", info);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
249 sflap_send(buf, -1, TYPE_DATA);
243
3414ff74cb0f [gaim-migrate @ 253]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 242
diff changeset
250 #else
3414ff74cb0f [gaim-migrate @ 253]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 242
diff changeset
251 if (awaymessage)
3414ff74cb0f [gaim-migrate @ 253]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 242
diff changeset
252 aim_bos_setprofile(gaim_sess, gaim_conn, info,
276
9e6fc62490cd [gaim-migrate @ 286]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 273
diff changeset
253 awaymessage->message, gaim_caps);
243
3414ff74cb0f [gaim-migrate @ 253]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 242
diff changeset
254 else
3414ff74cb0f [gaim-migrate @ 253]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 242
diff changeset
255 aim_bos_setprofile(gaim_sess, gaim_conn, info,
276
9e6fc62490cd [gaim-migrate @ 286]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 273
diff changeset
256 NULL, gaim_caps);
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 200
diff changeset
257 #endif
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 200
diff changeset
258 }
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 200
diff changeset
259
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 200
diff changeset
260 void serv_change_passwd(char *orig, char *new) {
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 200
diff changeset
261 #ifndef USE_OSCAR
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 200
diff changeset
262 char *buf = g_malloc(BUF_LONG);
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 200
diff changeset
263 g_snprintf(buf, BUF_LONG, "toc_change_passwd %s %s", orig, new);
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 200
diff changeset
264 sflap_send(buf, strlen(buf), TYPE_DATA);
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 200
diff changeset
265 g_free(buf);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
266 #endif
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
267 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
268
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
269 void serv_add_buddy(char *name)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
270 {
273
4c6c213646a3 [gaim-migrate @ 283]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 270
diff changeset
271 #ifndef USE_OSCAR
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 200
diff changeset
272 char buf[1024];
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
273 g_snprintf(buf, sizeof(buf), "toc_add_buddy %s", normalize(name));
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
274 sflap_send(buf, -1, TYPE_DATA);
242
14fc16f579c8 [gaim-migrate @ 252]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 237
diff changeset
275 #else
14fc16f579c8 [gaim-migrate @ 252]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 237
diff changeset
276 aim_add_buddy(gaim_sess, gaim_conn, name);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
277 #endif
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
278 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
279
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
280 void serv_add_buddies(GList *buddies)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
281 {
273
4c6c213646a3 [gaim-migrate @ 283]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 270
diff changeset
282 #ifndef USE_OSCAR
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
283 char buf[MSG_LEN];
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
284 int n, num = 0;
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 200
diff changeset
285
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
286 n = g_snprintf(buf, sizeof(buf), "toc_add_buddy");
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
287 while(buddies) {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
288 if (num == 20) {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
289 sflap_send(buf, -1, TYPE_DATA);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
290 n = g_snprintf(buf, sizeof(buf), "toc_add_buddy");
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
291 num = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
292 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
293 ++num;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
294 n += g_snprintf(buf + n, sizeof(buf) - n, " %s", normalize(buddies->data));
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
295 buddies = buddies->next;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
296 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
297 sflap_send(buf, -1, TYPE_DATA);
242
14fc16f579c8 [gaim-migrate @ 252]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 237
diff changeset
298 #else
14fc16f579c8 [gaim-migrate @ 252]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 237
diff changeset
299 /* oscar you have to add them one name at a time, except at login */
14fc16f579c8 [gaim-migrate @ 252]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 237
diff changeset
300 while(buddies) {
14fc16f579c8 [gaim-migrate @ 252]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 237
diff changeset
301 serv_add_buddy((char *)buddies->data);
14fc16f579c8 [gaim-migrate @ 252]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 237
diff changeset
302 buddies = buddies->next;
14fc16f579c8 [gaim-migrate @ 252]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 237
diff changeset
303 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
304 #endif
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
305 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
306
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
307
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
308 void serv_remove_buddy(char *name)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
309 {
273
4c6c213646a3 [gaim-migrate @ 283]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 270
diff changeset
310 #ifndef USE_OSCAR
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 200
diff changeset
311 char buf[1024];
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
312 g_snprintf(buf, sizeof(buf), "toc_remove_buddy %s", normalize(name));
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
313 sflap_send(buf, -1, TYPE_DATA);
242
14fc16f579c8 [gaim-migrate @ 252]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 237
diff changeset
314 #else
14fc16f579c8 [gaim-migrate @ 252]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 237
diff changeset
315 aim_remove_buddy(gaim_sess, gaim_conn, name);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
316 #endif
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
317 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
318
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
319 void serv_add_permit(char *name)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
320 {
273
4c6c213646a3 [gaim-migrate @ 283]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 270
diff changeset
321 #ifndef USE_OSCAR
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 200
diff changeset
322 char buf[1024];
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
323 g_snprintf(buf, sizeof(buf), "toc_add_permit %s", normalize(name));
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
324 sflap_send(buf, -1, TYPE_DATA);
247
f6e8ea29b24f [gaim-migrate @ 257]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 243
diff changeset
325 #else
f6e8ea29b24f [gaim-migrate @ 257]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 243
diff changeset
326 serv_set_permit_deny();
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
327 #endif
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
328 }
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_add_deny(char *name)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
333 {
273
4c6c213646a3 [gaim-migrate @ 283]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 270
diff changeset
334 #ifndef USE_OSCAR
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 200
diff changeset
335 char buf[1024];
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
336 g_snprintf(buf, sizeof(buf), "toc_add_deny %s", normalize(name));
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
337 sflap_send(buf, -1, TYPE_DATA);
247
f6e8ea29b24f [gaim-migrate @ 257]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 243
diff changeset
338 #else
f6e8ea29b24f [gaim-migrate @ 257]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 243
diff changeset
339 serv_set_permit_deny();
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
340 #endif
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
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
344
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
345 void serv_set_permit_deny()
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
346 {
273
4c6c213646a3 [gaim-migrate @ 283]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 270
diff changeset
347 #ifndef USE_OSCAR
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
348 char buf[MSG_LEN];
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
349 int at;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
350 GList *list;
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 200
diff changeset
351
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
352 /* FIXME! We flash here. */
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
353 if (permdeny == 1 || permdeny == 3) {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
354 g_snprintf(buf, sizeof(buf), "toc_add_permit");
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
355 sflap_send(buf, -1, TYPE_DATA);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
356 } else {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
357 g_snprintf(buf, sizeof(buf), "toc_add_deny");
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
358 sflap_send(buf, -1, TYPE_DATA);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
359 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
360
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
361
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
362 at = g_snprintf(buf, sizeof(buf), "toc_add_permit");
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
363 list = permit;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
364 while(list) {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
365 at += g_snprintf(&buf[at], sizeof(buf) - at, " %s", normalize(list->data));
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
366 list = list->next;
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 buf[at] = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
369 sflap_send(buf, -1, TYPE_DATA);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
370
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
371 at = g_snprintf(buf, sizeof(buf), "toc_add_deny");
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
372 list = deny;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
373 while(list) {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
374 at += g_snprintf(&buf[at], sizeof(buf) - at, " %s", normalize(list->data));
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
375 list = list->next;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
376 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
377 buf[at] = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
378 sflap_send(buf, -1, TYPE_DATA);
247
f6e8ea29b24f [gaim-migrate @ 257]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 243
diff changeset
379 #else
f6e8ea29b24f [gaim-migrate @ 257]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 243
diff changeset
380 /* oscar requires us to do everyone at once (?) */
265
59f1748b09a6 [gaim-migrate @ 275]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 263
diff changeset
381 /* I think this code is OK now. */
270
cfa39d39dec6 [gaim-migrate @ 280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 265
diff changeset
382 /* FIXME : I changed my mind
256
7615d22ad227 [gaim-migrate @ 266]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 253
diff changeset
383 if (!(permdeny == 1 || permdeny == 4)) {
253
5b28ef2b550e [gaim-migrate @ 263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 252
diff changeset
384 list = permit; at = 0;
5b28ef2b550e [gaim-migrate @ 263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 252
diff changeset
385 while (list) {
5b28ef2b550e [gaim-migrate @ 263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 252
diff changeset
386 at += g_snprintf(&buf[at], sizeof(buf) - at, "%s&", list->data);
5b28ef2b550e [gaim-migrate @ 263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 252
diff changeset
387 list = list->next;
5b28ef2b550e [gaim-migrate @ 263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 252
diff changeset
388 }
5b28ef2b550e [gaim-migrate @ 263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 252
diff changeset
389 aim_bos_changevisibility(gaim_sess, gaim_conn,
5b28ef2b550e [gaim-migrate @ 263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 252
diff changeset
390 AIM_VISIBILITYCHANGE_PERMITADD, buf);
5b28ef2b550e [gaim-migrate @ 263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 252
diff changeset
391 } else {
5b28ef2b550e [gaim-migrate @ 263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 252
diff changeset
392 list = deny; at = 0;
5b28ef2b550e [gaim-migrate @ 263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 252
diff changeset
393 if (list == NULL) return;
5b28ef2b550e [gaim-migrate @ 263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 252
diff changeset
394 while (list) {
5b28ef2b550e [gaim-migrate @ 263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 252
diff changeset
395 at += g_snprintf(&buf[at], sizeof(buf) - at, "%s&", list->data);
5b28ef2b550e [gaim-migrate @ 263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 252
diff changeset
396 list = list->next;
5b28ef2b550e [gaim-migrate @ 263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 252
diff changeset
397 }
5b28ef2b550e [gaim-migrate @ 263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 252
diff changeset
398 aim_bos_changevisibility(gaim_sess, gaim_conn,
5b28ef2b550e [gaim-migrate @ 263]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 252
diff changeset
399 AIM_VISIBILITYCHANGE_DENYADD, buf);
247
f6e8ea29b24f [gaim-migrate @ 257]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 243
diff changeset
400 }
270
cfa39d39dec6 [gaim-migrate @ 280]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 265
diff changeset
401 */
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
402 #endif
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
403 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
404
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
405 void serv_set_idle(int time)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
406 {
273
4c6c213646a3 [gaim-migrate @ 283]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 270
diff changeset
407 #ifndef USE_OSCAR
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 200
diff changeset
408 char buf[256];
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
409 g_snprintf(buf, sizeof(buf), "toc_set_idle %d", time);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
410 sflap_send(buf, -1, TYPE_DATA);
243
3414ff74cb0f [gaim-migrate @ 253]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 242
diff changeset
411 #else
3414ff74cb0f [gaim-migrate @ 253]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 242
diff changeset
412 aim_bos_setidle(gaim_sess, gaim_conn, time);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
413 #endif
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
414 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
415
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
416
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
417 void serv_warn(char *name, int anon)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
418 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
419 #ifndef USE_OSCAR
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
420 char *send = g_malloc(256);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
421 g_snprintf(send, 255, "toc_evil %s %s", name,
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
422 ((anon) ? "anon" : "norm"));
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
423 sflap_send(send, -1, TYPE_DATA);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
424 g_free(send);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
425 #endif
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
426 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
427
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 200
diff changeset
428 void serv_build_config(char *buf, int len) {
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 200
diff changeset
429 toc_build_config(buf, len);
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 200
diff changeset
430 }
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 200
diff changeset
431
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
432
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
433 void serv_save_config()
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
434 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
435 #ifndef USE_OSCAR
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
436 char *buf = g_malloc(BUF_LONG);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
437 char *buf2 = g_malloc(MSG_LEN);
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 200
diff changeset
438 serv_build_config(buf, BUF_LONG / 2);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
439 g_snprintf(buf2, MSG_LEN, "toc_set_config {%s}", buf);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
440 sflap_send(buf2, -1, TYPE_DATA);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
441 g_free(buf2);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
442 g_free(buf);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
443 #endif
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
444 }
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_accept_chat(int i)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
448 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
449 #ifndef USE_OSCAR
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
450 char *buf = g_malloc(256);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
451 g_snprintf(buf, 255, "toc_chat_accept %d", i);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
452 sflap_send(buf, -1, TYPE_DATA);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
453 g_free(buf);
252
4a41f8323022 [gaim-migrate @ 262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 249
diff changeset
454 #else
4a41f8323022 [gaim-migrate @ 262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 249
diff changeset
455 /* 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
456 * (i'm not even sure Oscar does). go through serv_join_chat instead */
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
457 #endif
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
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
460 void serv_join_chat(int exchange, char *name)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
461 {
273
4c6c213646a3 [gaim-migrate @ 283]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 270
diff changeset
462 #ifndef USE_OSCAR
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 200
diff changeset
463 char buf[BUF_LONG];
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
464 g_snprintf(buf, sizeof(buf)/2, "toc_chat_join %d \"%s\"", exchange, name);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
465 sflap_send(buf, -1, TYPE_DATA);
248
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
466 #else
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
467 aim_chat_join(gaim_sess, gaim_conn, 0x0004, name);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
468 #endif
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
469 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
470
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
471 void serv_chat_invite(int id, char *message, char *name)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
472 {
273
4c6c213646a3 [gaim-migrate @ 283]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 270
diff changeset
473 #ifndef USE_OSCAR
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 200
diff changeset
474 char buf[BUF_LONG];
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
475 g_snprintf(buf, sizeof(buf)/2, "toc_chat_invite %d \"%s\" %s", id, message, normalize(name));
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
476 sflap_send(buf, -1, TYPE_DATA);
258
1eeece1c7b7b [gaim-migrate @ 268]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 256
diff changeset
477 #else
1eeece1c7b7b [gaim-migrate @ 268]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 256
diff changeset
478 GList *bcs = buddy_chats;
1eeece1c7b7b [gaim-migrate @ 268]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 256
diff changeset
479 struct buddy_chat *b = NULL;
1eeece1c7b7b [gaim-migrate @ 268]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 256
diff changeset
480
1eeece1c7b7b [gaim-migrate @ 268]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 256
diff changeset
481 while (bcs) {
1eeece1c7b7b [gaim-migrate @ 268]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 256
diff changeset
482 b = (struct buddy_chat *)bcs->data;
1eeece1c7b7b [gaim-migrate @ 268]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 256
diff changeset
483 if (id == b->id)
1eeece1c7b7b [gaim-migrate @ 268]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 256
diff changeset
484 break;
1eeece1c7b7b [gaim-migrate @ 268]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 256
diff changeset
485 bcs = bcs->next;
1eeece1c7b7b [gaim-migrate @ 268]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 256
diff changeset
486 b = NULL;
1eeece1c7b7b [gaim-migrate @ 268]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 256
diff changeset
487 }
1eeece1c7b7b [gaim-migrate @ 268]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 256
diff changeset
488
1eeece1c7b7b [gaim-migrate @ 268]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 256
diff changeset
489 if (!b)
1eeece1c7b7b [gaim-migrate @ 268]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 256
diff changeset
490 return;
1eeece1c7b7b [gaim-migrate @ 268]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 256
diff changeset
491
1eeece1c7b7b [gaim-migrate @ 268]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 256
diff changeset
492 aim_chat_invite(gaim_sess, gaim_conn, name, message, 0x4, b->name, 0x1);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
493 #endif
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
494 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
495
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
496 void serv_chat_leave(int id)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
497 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
498 #ifndef USE_OSCAR
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
499 char *buf = g_malloc(256);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
500 g_snprintf(buf, 255, "toc_chat_leave %d", id);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
501 sflap_send(buf, -1, TYPE_DATA);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
502 g_free(buf);
248
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
503 #else
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
504 GList *bcs = buddy_chats;
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
505 struct buddy_chat *b = NULL;
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
506
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
507 while (bcs) {
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
508 b = (struct buddy_chat *)bcs->data;
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
509 if (id == b->id)
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
510 break;
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
511 bcs = bcs->next;
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
512 b = NULL;
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
513 }
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
514
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
515 if (!b)
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
516 return;
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
517
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
518 aim_chat_leaveroom(gaim_sess, b->name);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
519 #endif
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
520 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
521
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
522 void serv_chat_whisper(int id, char *who, char *message)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
523 {
273
4c6c213646a3 [gaim-migrate @ 283]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 270
diff changeset
524 #ifndef USE_OSCAR
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 200
diff changeset
525 char buf2[MSG_LEN];
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
526 g_snprintf(buf2, sizeof(buf2), "toc_chat_whisper %d %s \"%s\"", id, who, message);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
527 sflap_send(buf2, -1, TYPE_DATA);
248
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
528 #else
258
1eeece1c7b7b [gaim-migrate @ 268]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 256
diff changeset
529 do_error_dialog("Sorry, Oscar doesn't whisper. Send an IM.",
1eeece1c7b7b [gaim-migrate @ 268]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 256
diff changeset
530 "Gaim - Chat");
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
531 #endif
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
532 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
533
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
534 void serv_chat_send(int id, char *message)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
535 {
273
4c6c213646a3 [gaim-migrate @ 283]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 270
diff changeset
536 #ifndef USE_OSCAR
237
6ced2f1c8b24 [gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 200
diff changeset
537 char buf[MSG_LEN];
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
538 g_snprintf(buf, sizeof(buf), "toc_chat_send %d \"%s\"",id, message);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
539 sflap_send(buf, -1, TYPE_DATA);
248
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
540 #else
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
541 struct aim_conn_t *cn;
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
542 GList *bcs = buddy_chats;
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
543 struct buddy_chat *b = NULL;
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
544
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
545 while (bcs) {
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
546 b = (struct buddy_chat *)bcs->data;
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
547 if (id == b->id)
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
548 break;
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
549 bcs = bcs->next;
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
550 b = NULL;
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
551 }
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
552 if (!b)
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
553 return;
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
554
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
555 cn = aim_chat_getconn(gaim_sess, b->name);
cfc73b8501a7 [gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 247
diff changeset
556 aim_chat_send_im(gaim_sess, cn, message);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
557 #endif
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
558 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
559
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
560
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
561
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
562
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
563 void serv_got_im(char *name, char *message, int away)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
564 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
565 struct conversation *cnv;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
566 int is_idle = -1;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
567 int new_conv = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
568 char *nname;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
569
94
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
570 #ifdef GAIM_PLUGINS
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
571 GList *c = callbacks;
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
572 struct gaim_callback *g;
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
573 void (*function)(char **, char **, void *);
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
574 while (c) {
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
575 g = (struct gaim_callback *)c->data;
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
576 if (g->event == event_im_recv && g->function != NULL) {
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
577 function = g->function;
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
578 /* I can guarantee you this is wrong */
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
579 (*function)(&name, &message, g->data);
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
580 }
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
581 c = c->next;
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
582 }
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
583 /* make sure no evil plugin is trying to crash gaim */
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
584 if (message == NULL)
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
585 return;
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
586 #endif
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 79
diff changeset
587
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
588 nname = g_strdup(normalize(name));
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
589
171
789c792ed14b [gaim-migrate @ 181]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 145
diff changeset
590 if (!strcasecmp(normalize(current_user->username), nname)) {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
591 if (!strcmp(message, LAGOMETER_STR)) {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
592 struct timeval tv;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
593 int ms;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
594
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
595 gettimeofday(&tv, NULL);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
596
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
597 ms = 1000000 * (tv.tv_sec - lag_tv.tv_sec);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
598
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
599 ms += tv.tv_usec - lag_tv.tv_usec;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
600
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
601 update_lagometer(ms);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
602 g_free(nname);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
603 return;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
604 }
14
d5119dc66284 [gaim-migrate @ 23]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
605 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
606 g_free(nname);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
607
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
608 cnv = find_conversation(name);
145
41bd1cd48571 [gaim-migrate @ 155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 136
diff changeset
609 if (away) away = WFLAG_AUTO;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
610
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
611 if (awaymessage != NULL) {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
612 if (!(general_options & OPT_GEN_DISCARD_WHEN_AWAY)) {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
613 if (cnv == NULL) {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
614 new_conv = 1;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
615 cnv = new_conversation(name);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
616 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
617 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
618 if (cnv != NULL) {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
619 if (sound_options & OPT_SOUND_WHEN_AWAY)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
620 play_sound(AWAY);
145
41bd1cd48571 [gaim-migrate @ 155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 136
diff changeset
621 write_to_conv(cnv, message, away | WFLAG_RECV);
1
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 } else {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
625 if (cnv == NULL) {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
626 new_conv = 1;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
627 cnv = new_conversation(name);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
628 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
629 if (new_conv && (sound_options & OPT_SOUND_FIRST_RCV)) {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
630 play_sound(FIRST_RECEIVE);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
631 } else {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
632 if (cnv->makesound && (sound_options & OPT_SOUND_RECV))
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
633 play_sound(RECEIVE);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
634 }
145
41bd1cd48571 [gaim-migrate @ 155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 136
diff changeset
635 write_to_conv(cnv, message, away | WFLAG_RECV);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
636 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
637
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
638
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
639
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
640
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
641 if (awaymessage != NULL) {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
642 time_t t;
263
8aa7368baae7 [gaim-migrate @ 273]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 260
diff changeset
643 char tmpmsg[BUF_LEN];
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
644
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
645 time(&t);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
646
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
647
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
648 if ((cnv == NULL) || (t - cnv->sent_away) < 120)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
649 return;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
650
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
651 cnv->sent_away = t;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
652
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
653 if (is_idle)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
654 is_idle = -1;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
655
263
8aa7368baae7 [gaim-migrate @ 273]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 260
diff changeset
656 strcpy(tmpmsg, awaymessage->message);
8aa7368baae7 [gaim-migrate @ 273]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 260
diff changeset
657 escape_text(tmpmsg);
8aa7368baae7 [gaim-migrate @ 273]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 260
diff changeset
658 escape_message(tmpmsg);
8aa7368baae7 [gaim-migrate @ 273]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 260
diff changeset
659 serv_send_im(name, tmpmsg, 1);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
660
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
661 if (is_idle == -1)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
662 is_idle = 1;
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 if (cnv != NULL)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
665 write_to_conv(cnv, awaymessage->message, WFLAG_SEND | WFLAG_AUTO);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
666 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
667 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
668
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
669
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
670
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
671 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
672 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
673 struct buddy *b;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
674 char *nname;
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 b = find_buddy(name);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
677
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
678 nname = g_strdup(normalize(name));
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
679 if (!strcasecmp(nname, normalize(current_user->username))) {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
680 correction_time = (int)(signon - login_time);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
681 update_all_buddies();
25
c56db1b46b0d [gaim-migrate @ 34]
Rob Flynn <gaim@robflynn.com>
parents: 14
diff changeset
682 if (!b) {
c56db1b46b0d [gaim-migrate @ 34]
Rob Flynn <gaim@robflynn.com>
parents: 14
diff changeset
683 g_free(nname);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
684 return;
25
c56db1b46b0d [gaim-migrate @ 34]
Rob Flynn <gaim@robflynn.com>
parents: 14
diff changeset
685 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
686 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
687
25
c56db1b46b0d [gaim-migrate @ 34]
Rob Flynn <gaim@robflynn.com>
parents: 14
diff changeset
688 g_free(nname);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
689
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
690 if (!b) {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
691 sprintf(debug_buff,"Error, no such person\n");
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
692 debug_print(debug_buff);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
693 return;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
694 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
695
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
696 /* This code will 'align' the name from the TOC */
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
697 /* server with what's in our record. We want to */
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
698 /* store things how THEY want it... */
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
699 if (strcmp(name, b->name)) {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
700 GList *cnv = conversations;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
701 struct conversation *cv;
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 char *who = g_malloc(80);
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 strcpy(who, normalize(name));
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
706
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
707 while(cnv) {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
708 cv = (struct conversation *)cnv->data;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
709 if (!strcasecmp(who, normalize(cv->name))) {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
710 g_snprintf(cv->name, sizeof(cv->name), "%s", name);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
711 if (find_log_info(name) || (general_options & OPT_GEN_LOG_ALL))
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
712 g_snprintf(who, 63, LOG_CONVERSATION_TITLE, name);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
713 else
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
714 g_snprintf(who, 63, CONVERSATION_TITLE, name);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
715 gtk_window_set_title(GTK_WINDOW(cv->window), who);
79
bfdc427b936d [gaim-migrate @ 89]
Rob Flynn <gaim@robflynn.com>
parents: 45
diff changeset
716 /* was g_free(buf), but break gives us that
bfdc427b936d [gaim-migrate @ 89]
Rob Flynn <gaim@robflynn.com>
parents: 45
diff changeset
717 * and freeing twice is not good --Sumner */
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
718 break;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
719 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
720 cnv = cnv->next;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
721 }
45
939455223459 [gaim-migrate @ 54]
Rob Flynn <gaim@robflynn.com>
parents: 25
diff changeset
722 g_free(who);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
723 g_snprintf(b->name, sizeof(b->name), "%s", name);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
724 /*gtk_label_set_text(GTK_LABEL(b->label), b->name);*/
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 /* okay lets save the new config... */
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
727
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
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
730 b->idle = idle;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
731 b->evil = evil;
136
4e91b92f91a7 [gaim-migrate @ 146]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 115
diff changeset
732 #ifdef GAIM_PLUGINS
4e91b92f91a7 [gaim-migrate @ 146]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 115
diff changeset
733 if ((b->uc & UC_UNAVAILABLE) && !(type & UC_UNAVAILABLE)) {
4e91b92f91a7 [gaim-migrate @ 146]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 115
diff changeset
734 GList *c = callbacks;
4e91b92f91a7 [gaim-migrate @ 146]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 115
diff changeset
735 struct gaim_callback *g;
4e91b92f91a7 [gaim-migrate @ 146]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 115
diff changeset
736 void (*function)(char *, void *);
4e91b92f91a7 [gaim-migrate @ 146]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 115
diff changeset
737 while (c) {
4e91b92f91a7 [gaim-migrate @ 146]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 115
diff changeset
738 g = (struct gaim_callback *)c->data;
4e91b92f91a7 [gaim-migrate @ 146]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 115
diff changeset
739 if (g->event == event_buddy_back &&
4e91b92f91a7 [gaim-migrate @ 146]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 115
diff changeset
740 g->function != NULL) {
4e91b92f91a7 [gaim-migrate @ 146]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 115
diff changeset
741 function = g->function;
4e91b92f91a7 [gaim-migrate @ 146]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 115
diff changeset
742 (*function)(b->name, g->data);
4e91b92f91a7 [gaim-migrate @ 146]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 115
diff changeset
743 }
4e91b92f91a7 [gaim-migrate @ 146]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 115
diff changeset
744 c = c->next;
4e91b92f91a7 [gaim-migrate @ 146]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 115
diff changeset
745 }
4e91b92f91a7 [gaim-migrate @ 146]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 115
diff changeset
746 }
4e91b92f91a7 [gaim-migrate @ 146]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 115
diff changeset
747 #endif
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
748 b->uc = type;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
749
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
750 b->signon = signon;
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 if (loggedin) {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
753 if (!b->present) {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
754 b->present = 1;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
755 do_pounce(b->name);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
756 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
757 } else
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
758 b->present = 0;
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 set_buddy(b);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
761 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
762
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
763 static
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
764 void close_warned(GtkWidget *w, GtkWidget *w2)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
765 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
766 gtk_widget_destroy(w2);
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
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
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
771 void serv_got_eviled(char *name, int lev)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
772 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
773 char *buf2 = g_malloc(1024);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
774 GtkWidget *d, *label, *close;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
775
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
776
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
777 g_snprintf(buf2, 1023, "You have just been warned by %s.\nYour new warning level is %d./%%",
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
778 ((name == NULL) ? "an anonymous person" : name) , lev);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
779
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
780
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
781 d = gtk_dialog_new();
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
782 gtk_widget_realize(d);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
783 aol_icon(d->window);
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 label = gtk_label_new(buf2);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
786 gtk_widget_show(label);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
787 close = gtk_button_new_with_label("Close");
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
788 gtk_widget_show(close);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
789 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(d)->vbox),
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
790 label, FALSE, FALSE, 5);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
791 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(d)->action_area),
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
792 close, FALSE, FALSE, 5);
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 gtk_window_set_title(GTK_WINDOW(d), "Warned");
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
795 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
796 gtk_widget_show(d);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
797 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
798
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
799
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
800
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
801 static void close_invite(GtkWidget *w, GtkWidget *w2)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
802 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
803 gtk_widget_destroy(w2);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
804 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
805
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
806 static void chat_invite_callback(GtkWidget *w, GtkWidget *w2)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
807 {
252
4a41f8323022 [gaim-migrate @ 262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 249
diff changeset
808 #ifndef USE_OSCAR
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
809 int i = (int)gtk_object_get_user_data(GTK_OBJECT(w2));
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
810 serv_accept_chat(i);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
811 gtk_widget_destroy(w2);
252
4a41f8323022 [gaim-migrate @ 262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 249
diff changeset
812 #else
4a41f8323022 [gaim-migrate @ 262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 249
diff changeset
813 char *i = (char *)gtk_object_get_user_data(GTK_OBJECT(w2));
4a41f8323022 [gaim-migrate @ 262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 249
diff changeset
814 serv_join_chat(0, i); /* for oscar, it doesn't use the id anyway */
4a41f8323022 [gaim-migrate @ 262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 249
diff changeset
815 gtk_widget_destroy(w2);
4a41f8323022 [gaim-migrate @ 262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 249
diff changeset
816 #endif
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
817 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
818
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
819
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
820
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
821 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
822 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
823 GtkWidget *d;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
824 GtkWidget *label;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
825 GtkWidget *yesbtn;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
826 GtkWidget *nobtn;
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 char buf2[BUF_LONG];
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
829
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 g_snprintf(buf2, sizeof(buf2), "User '%s' invites you to buddy chat room: '%s'\n%s", who, name, message);
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 d = gtk_dialog_new();
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
834 gtk_widget_realize(d);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
835 aol_icon(d->window);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
836
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 label = gtk_label_new(buf2);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
839 gtk_widget_show(label);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
840 yesbtn = gtk_button_new_with_label("Yes");
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
841 gtk_widget_show(yesbtn);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
842 nobtn = gtk_button_new_with_label("No");
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
843 gtk_widget_show(nobtn);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
844 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(d)->vbox),
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
845 label, FALSE, FALSE, 5);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
846 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(d)->action_area),
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
847 yesbtn, FALSE, FALSE, 5);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
848 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(d)->action_area),
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
849 nobtn, FALSE, FALSE, 5);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
850
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
851
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
852 /* gtk_widget_set_usize(d, 200, 110); */
252
4a41f8323022 [gaim-migrate @ 262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 249
diff changeset
853 #ifndef USE_OSCAR
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
854 gtk_object_set_user_data(GTK_OBJECT(d), (void *)id);
252
4a41f8323022 [gaim-migrate @ 262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 249
diff changeset
855 #else
4a41f8323022 [gaim-migrate @ 262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 249
diff changeset
856 gtk_object_set_user_data(GTK_OBJECT(d), (void *)name);
4a41f8323022 [gaim-migrate @ 262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 249
diff changeset
857 #endif
1
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 gtk_window_set_title(GTK_WINDOW(d), "Buddy chat invite");
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
861 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
862 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
863
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
864
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
865 gtk_widget_show(d);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
866 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
867
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
868 void serv_got_joined_chat(int id, char *name)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
869 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
870 struct buddy_chat *b;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
871
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
872 b = (struct buddy_chat *)g_new0(struct buddy_chat, 1);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
873 buddy_chats = g_list_append(buddy_chats, b);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
874
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
875 b->ignored = NULL;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
876 b->in_room = NULL;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
877 b->id = id;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
878 g_snprintf(b->name, 80, "%s", name);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
879 show_new_buddy_chat(b);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
880 }
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 void serv_got_chat_left(int id)
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 GList *bcs = buddy_chats;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
885 struct buddy_chat *b = NULL;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
886
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
887
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
888 while(bcs) {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
889 b = (struct buddy_chat *)bcs->data;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
890 if (id == b->id) {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
891 break;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
892 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
893 b = NULL;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
894 bcs = bcs->next;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
895 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
896
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
897 if (!b)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
898 return;
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 if (b->window)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
901 gtk_widget_destroy(GTK_WIDGET(b->window));
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 buddy_chats = g_list_remove(buddy_chats, b);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
904
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
905 g_free(b);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
906 }
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 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
909 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
910 int w;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
911 GList *bcs = buddy_chats;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
912 struct buddy_chat *b = NULL;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
913
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
914 while(bcs) {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
915 b = (struct buddy_chat *)bcs->data;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
916 if (id == b->id)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
917 break;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
918 bcs = bcs->next;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
919 b = NULL;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
920
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
921 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
922 if (!b)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
923 return;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
924
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
925 if (whisper)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
926 w = WFLAG_WHISPER;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
927 else
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
928 w = 0;
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 chat_write(b, who, w, message);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
931 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
932
260
325d9804df10 [gaim-migrate @ 270]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 258
diff changeset
933 void serv_rvous_accept(char *name, char *cookie, char *uid)
325d9804df10 [gaim-migrate @ 270]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 258
diff changeset
934 {
273
4c6c213646a3 [gaim-migrate @ 283]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 270
diff changeset
935 #ifndef USE_OSCAR
260
325d9804df10 [gaim-migrate @ 270]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 258
diff changeset
936 char buf[MSG_LEN];
325d9804df10 [gaim-migrate @ 270]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 258
diff changeset
937 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
938 cookie, uid);
325d9804df10 [gaim-migrate @ 270]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 258
diff changeset
939 sflap_send(buf, strlen(buf), TYPE_DATA);
325d9804df10 [gaim-migrate @ 270]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 258
diff changeset
940 #endif
325d9804df10 [gaim-migrate @ 270]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 258
diff changeset
941 }
325d9804df10 [gaim-migrate @ 270]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 258
diff changeset
942
325d9804df10 [gaim-migrate @ 270]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 258
diff changeset
943 void serv_rvous_cancel(char *name, char *cookie, char *uid)
325d9804df10 [gaim-migrate @ 270]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 258
diff changeset
944 {
273
4c6c213646a3 [gaim-migrate @ 283]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 270
diff changeset
945 #ifndef USE_OSCAR
260
325d9804df10 [gaim-migrate @ 270]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 258
diff changeset
946 char buf[MSG_LEN];
325d9804df10 [gaim-migrate @ 270]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 258
diff changeset
947 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
948 cookie, uid);
325d9804df10 [gaim-migrate @ 270]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 258
diff changeset
949 sflap_send(buf, strlen(buf), TYPE_DATA);
325d9804df10 [gaim-migrate @ 270]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 258
diff changeset
950 #endif
325d9804df10 [gaim-migrate @ 270]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 258
diff changeset
951 }