Mercurial > pidgin
comparison src/server.c @ 960:fa681641643d
[gaim-migrate @ 970]
*** MULTIPLE-CONNECTIONS ***
committer: Tailor Script <tailor@pidgin.im>
| author | Eric Warmenhoven <eric@warmenhoven.org> |
|---|---|
| date | Tue, 10 Oct 2000 00:02:02 +0000 |
| parents | 59d9e1177ab5 |
| children | e006338ce34e |
comparison
equal
deleted
inserted
replaced
| 959:034d5d1d53eb | 960:fa681641643d |
|---|---|
| 30 #include <sys/time.h> | 30 #include <sys/time.h> |
| 31 #include <unistd.h> | 31 #include <unistd.h> |
| 32 #include <gtk/gtk.h> | 32 #include <gtk/gtk.h> |
| 33 #include <aim.h> | 33 #include <aim.h> |
| 34 extern int gaim_caps; | 34 extern int gaim_caps; |
| 35 #include "multi.h" | |
| 35 #include "gaim.h" | 36 #include "gaim.h" |
| 36 | 37 |
| 37 static int idle_timer = -1; | |
| 38 static time_t lastsent = 0; | |
| 39 static time_t login_time = 0; | |
| 40 static int is_idle = 0; | |
| 41 | |
| 42 int correction_time = 0; | 38 int correction_time = 0; |
| 43 | 39 |
| 44 int serv_login(char *username, char *password) | 40 struct gaim_connection *serv_login(char *username, char *password) |
| 45 { | 41 { |
| 46 if (!(general_options & OPT_GEN_USE_OSCAR)) { | 42 struct aim_user *u = find_user(username); |
| 47 USE_OSCAR = 0; | 43 |
| 44 if (u->protocol == PROTO_TOC) { | |
| 48 return toc_login(username, password); | 45 return toc_login(username, password); |
| 49 } else { | 46 } else if (u->protocol == PROTO_OSCAR) { |
| 50 USE_OSCAR = 1; | |
| 51 debug_print("Logging in using Oscar. Expect problems.\n"); | 47 debug_print("Logging in using Oscar. Expect problems.\n"); |
| 52 return oscar_login(username, password); | 48 return oscar_login(username, password); |
| 53 } | 49 } else { |
| 54 } | 50 /* PRPL */ |
| 55 | 51 return NULL; |
| 56 void serv_close() | 52 } |
| 57 { | 53 } |
| 58 if (!USE_OSCAR) | 54 |
| 59 toc_close(); | 55 void serv_close(struct gaim_connection *gc) |
| 60 else | 56 { |
| 61 oscar_close(); | 57 if (gc->protocol == PROTO_TOC) |
| 62 | 58 toc_close(gc); |
| 63 gtk_timeout_remove(idle_timer); | 59 else if (gc->protocol == PROTO_OSCAR) |
| 64 idle_timer = -1; | 60 oscar_close(gc); |
| 65 } | 61 else /* PRPL */ ; |
| 66 | 62 |
| 67 | 63 account_offline(gc); |
| 68 void serv_touch_idle() | 64 destroy_gaim_conn(gc); |
| 65 | |
| 66 if (connections) return; | |
| 67 | |
| 68 if (gc->idle_timer > 0) | |
| 69 gtk_timeout_remove(gc->idle_timer); | |
| 70 gc->idle_timer = -1; | |
| 71 } | |
| 72 | |
| 73 | |
| 74 void serv_touch_idle(struct gaim_connection *gc) | |
| 69 { | 75 { |
| 70 /* Are we idle? If so, not anymore */ | 76 /* Are we idle? If so, not anymore */ |
| 71 if (is_idle > 0) { | 77 if (gc->is_idle > 0) { |
| 72 is_idle = 0; | 78 gc->is_idle = 0; |
| 73 serv_set_idle(0); | 79 serv_set_idle(gc, 0); |
| 74 } | 80 } |
| 75 time(&lastsent); | 81 time(&gc->lastsent); |
| 76 } | 82 } |
| 77 | 83 |
| 78 | 84 |
| 79 static gint check_idle() | 85 static gint check_idle(struct gaim_connection *gc) |
| 80 { | 86 { |
| 81 time_t t; | 87 time_t t; |
| 82 | 88 |
| 83 /* Not idle, really... :) */ | 89 /* Not idle, really... :) */ |
| 84 update_all_buddies(); | 90 update_all_buddies(); |
| 89 | 95 |
| 90 if (report_idle != IDLE_GAIM) | 96 if (report_idle != IDLE_GAIM) |
| 91 return TRUE; | 97 return TRUE; |
| 92 | 98 |
| 93 | 99 |
| 94 if (is_idle) | 100 if (gc->is_idle) |
| 95 return TRUE; | 101 return TRUE; |
| 96 | 102 |
| 97 if ((t - lastsent) > 600) { /* 15 minutes! */ | 103 if ((t - gc->lastsent) > 600) { /* 15 minutes! */ |
| 98 serv_set_idle((int)t - lastsent); | 104 serv_set_idle(gc, (int)t - gc->lastsent); |
| 99 is_idle = 1; | 105 gc->is_idle = 1; |
| 100 } | 106 } |
| 101 | 107 |
| 102 return TRUE; | 108 return TRUE; |
| 103 | 109 |
| 104 } | 110 } |
| 105 | 111 |
| 106 | 112 |
| 107 void serv_finish_login() | 113 void serv_finish_login(struct gaim_connection *gc) |
| 108 { | 114 { |
| 109 char *buf; | 115 char *buf; |
| 110 | 116 |
| 111 if (strlen(current_user->user_info)) { | 117 if (strlen(gc->user_info)) { |
| 112 buf = g_malloc(strlen(current_user->user_info) * 4); | 118 buf = g_malloc(strlen(gc->user_info) * 4); |
| 113 strcpy(buf, current_user->user_info); | 119 strcpy(buf, gc->user_info); |
| 114 escape_text(buf); | 120 serv_set_info(gc, buf); |
| 115 serv_set_info(buf); | |
| 116 g_free(buf); | 121 g_free(buf); |
| 117 } | 122 } |
| 118 | 123 |
| 119 if (idle_timer != -1) | 124 if (gc->idle_timer > 0) |
| 120 gtk_timeout_remove(idle_timer); | 125 gtk_timeout_remove(gc->idle_timer); |
| 121 | 126 |
| 122 idle_timer = gtk_timeout_add(20000, (GtkFunction)check_idle, NULL); | 127 gc->idle_timer = gtk_timeout_add(20000, (GtkFunction)check_idle, gc); |
| 123 serv_touch_idle(); | 128 serv_touch_idle(gc); |
| 124 | 129 |
| 125 time(&login_time); | 130 time(&gc->login_time); |
| 126 | 131 |
| 127 serv_add_buddy(current_user->username); | 132 serv_add_buddy(gc->username); |
| 128 | |
| 129 if (!(general_options & OPT_GEN_REGISTERED)) | |
| 130 { | |
| 131 show_register_dialog(); | |
| 132 save_prefs(); | |
| 133 } | |
| 134 } | 133 } |
| 135 | 134 |
| 136 | 135 |
| 137 | 136 |
| 138 void serv_send_im(char *name, char *message, int away) | 137 void serv_send_im(char *name, char *message, int away) |
| 139 { | 138 { |
| 140 struct conversation *cnv = find_conversation(name); | 139 struct conversation *cnv = find_conversation(name); |
| 141 if (cnv && cnv->is_direct) { | 140 if (cnv && cnv->is_direct) { |
| 142 if (!USE_OSCAR) { | 141 if (cnv->gc->protocol == PROTO_OSCAR) { |
| 143 /* Direct IM TOC FIXME */ | |
| 144 } else { | |
| 145 sprintf(debug_buff, "Sending DirectIM to %s\n", name); | 142 sprintf(debug_buff, "Sending DirectIM to %s\n", name); |
| 146 debug_print(debug_buff); | 143 debug_print(debug_buff); |
| 147 aim_send_im_direct(gaim_sess, cnv->conn, message); | 144 aim_send_im_direct(cnv->gc->oscar_sess, cnv->conn, message); |
| 145 } else { | |
| 146 /* Direct IM TOC FIXME */ | |
| 148 } | 147 } |
| 149 } else { | 148 } else { |
| 150 if (!USE_OSCAR) { | 149 if (cnv->gc->protocol == PROTO_TOC) { |
| 151 char buf[MSG_LEN - 7]; | 150 char buf[MSG_LEN - 7]; |
| 152 | 151 |
| 152 escape_text(message); | |
| 153 g_snprintf(buf, MSG_LEN - 8, "toc_send_im %s \"%s\"%s", normalize(name), | 153 g_snprintf(buf, MSG_LEN - 8, "toc_send_im %s \"%s\"%s", normalize(name), |
| 154 message, ((away) ? " auto" : "")); | 154 message, ((away) ? " auto" : "")); |
| 155 sflap_send(buf, strlen(buf), TYPE_DATA); | 155 sflap_send(cnv->gc, buf, -1, TYPE_DATA); |
| 156 } else { | 156 } else if (cnv->gc->protocol == PROTO_OSCAR) { |
| 157 if (away) | 157 if (away) |
| 158 aim_send_im(gaim_sess, gaim_conn, name, AIM_IMFLAGS_AWAY, message); | 158 aim_send_im(cnv->gc->oscar_sess, cnv->gc->oscar_conn, |
| 159 name, AIM_IMFLAGS_AWAY, message); | |
| 159 else | 160 else |
| 160 aim_send_im(gaim_sess, gaim_conn, name, AIM_IMFLAGS_ACK, message); | 161 aim_send_im(cnv->gc->oscar_sess, cnv->gc->oscar_conn, |
| 162 name, AIM_IMFLAGS_ACK, message); | |
| 161 } | 163 } |
| 162 } | 164 } |
| 163 if (!away) | 165 if (!away) |
| 164 serv_touch_idle(); | 166 serv_touch_idle(cnv->gc); |
| 165 } | 167 } |
| 166 | 168 |
| 167 void serv_get_info(char *name) | 169 void serv_get_info(char *name) |
| 168 { | 170 { |
| 169 if (!USE_OSCAR) { | 171 /* FIXME */ |
| 172 struct gaim_connection *g = connections->data; | |
| 173 if (g->protocol == PROTO_TOC) { | |
| 170 char buf[MSG_LEN]; | 174 char buf[MSG_LEN]; |
| 171 g_snprintf(buf, MSG_LEN, "toc_get_info %s", normalize(name)); | 175 g_snprintf(buf, MSG_LEN, "toc_get_info %s", normalize(name)); |
| 172 sflap_send(buf, -1, TYPE_DATA); | 176 sflap_send(g, buf, -1, TYPE_DATA); |
| 173 } else { | 177 } else if (g->protocol == PROTO_OSCAR) { |
| 174 aim_getinfo(gaim_sess, gaim_conn, name, AIM_GETINFO_GENERALINFO); | 178 aim_getinfo(g->oscar_sess, g->oscar_conn, name, AIM_GETINFO_GENERALINFO); |
| 175 } | 179 } |
| 176 } | 180 } |
| 177 | 181 |
| 178 void serv_get_away_msg(char *name) | 182 void serv_get_away_msg(char *name) |
| 179 { | 183 { |
| 180 if (!USE_OSCAR) { | 184 /* FIXME */ |
| 185 struct gaim_connection *g = connections->data; | |
| 186 if (g->protocol == PROTO_TOC) { | |
| 181 /* HAHA! TOC doesn't have this yet */ | 187 /* HAHA! TOC doesn't have this yet */ |
| 182 } else { | 188 } else if (g->protocol == PROTO_OSCAR) { |
| 183 aim_getinfo(gaim_sess, gaim_conn, name, AIM_GETINFO_AWAYMESSAGE); | 189 aim_getinfo(g->oscar_sess, g->oscar_conn, name, AIM_GETINFO_AWAYMESSAGE); |
| 184 } | 190 } |
| 185 } | 191 } |
| 186 | 192 |
| 187 void serv_get_dir(char *name) | 193 void serv_get_dir(char *name) |
| 188 { | 194 { |
| 189 if (!USE_OSCAR) { | 195 /* FIXME */ |
| 196 struct gaim_connection *g = connections->data; | |
| 197 if (g->protocol == PROTO_TOC) { | |
| 190 char buf[MSG_LEN]; | 198 char buf[MSG_LEN]; |
| 191 g_snprintf(buf, MSG_LEN, "toc_get_dir %s", normalize(name)); | 199 g_snprintf(buf, MSG_LEN, "toc_get_dir %s", normalize(name)); |
| 192 sflap_send(buf, -1, TYPE_DATA); | 200 sflap_send(g, buf, -1, TYPE_DATA); |
| 193 } | 201 } |
| 194 } | 202 } |
| 195 | 203 |
| 196 void serv_set_dir(char *first, char *middle, char *last, char *maiden, | 204 void serv_set_dir(char *first, char *middle, char *last, char *maiden, |
| 197 char *city, char *state, char *country, int web) | 205 char *city, char *state, char *country, int web) |
| 198 { | 206 { |
| 199 if (!USE_OSCAR) { | 207 /* FIXME */ |
| 208 struct gaim_connection *g = connections->data; | |
| 209 if (g->protocol == PROTO_TOC) { | |
| 200 char buf2[BUF_LEN*4], buf[BUF_LEN]; | 210 char buf2[BUF_LEN*4], buf[BUF_LEN]; |
| 201 g_snprintf(buf2, sizeof(buf2), "%s:%s:%s:%s:%s:%s:%s:%s", first, | 211 g_snprintf(buf2, sizeof(buf2), "%s:%s:%s:%s:%s:%s:%s:%s", first, |
| 202 middle, last, maiden, city, state, country, | 212 middle, last, maiden, city, state, country, |
| 203 (web == 1) ? "Y" : ""); | 213 (web == 1) ? "Y" : ""); |
| 204 escape_text(buf2); | 214 escape_text(buf2); |
| 205 g_snprintf(buf, sizeof(buf), "toc_set_dir %s", buf2); | 215 g_snprintf(buf, sizeof(buf), "toc_set_dir %s", buf2); |
| 206 sflap_send(buf, -1, TYPE_DATA); | 216 sflap_send(g, buf, -1, TYPE_DATA); |
| 207 } else { | 217 } else if (g->protocol == PROTO_OSCAR) { |
| 208 /* FIXME : some of these things are wrong, but i'm lazy */ | 218 /* FIXME : some of these things are wrong, but i'm lazy */ |
| 209 aim_setdirectoryinfo(gaim_sess, gaim_conn, first, middle, last, | 219 aim_setdirectoryinfo(g->oscar_sess, g->oscar_conn, first, middle, last, |
| 210 maiden, NULL, NULL, city, state, NULL, 0, web); | 220 maiden, NULL, NULL, city, state, NULL, 0, web); |
| 211 } | 221 } |
| 212 } | 222 } |
| 213 | 223 |
| 214 void serv_dir_search(char *first, char *middle, char *last, char *maiden, | 224 void serv_dir_search(char *first, char *middle, char *last, char *maiden, |
| 215 char *city, char *state, char *country, char *email) | 225 char *city, char *state, char *country, char *email) |
| 216 { | 226 { |
| 217 if (!USE_OSCAR) { | 227 /* FIXME */ |
| 228 struct gaim_connection *g = connections->data; | |
| 229 if (g->protocol == PROTO_TOC) { | |
| 218 char buf[BUF_LONG]; | 230 char buf[BUF_LONG]; |
| 219 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); | 231 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); |
| 220 sprintf(debug_buff,"Searching for: %s,%s,%s,%s,%s,%s,%s\n", first, middle, last, maiden, city, state, country); | 232 sprintf(debug_buff,"Searching for: %s,%s,%s,%s,%s,%s,%s\n", first, middle, last, maiden, city, state, country); |
| 221 debug_print(debug_buff); | 233 debug_print(debug_buff); |
| 222 sflap_send(buf, -1, TYPE_DATA); | 234 sflap_send(g, buf, -1, TYPE_DATA); |
| 223 } else { | 235 } else if (g->protocol == PROTO_OSCAR) { |
| 224 if (strlen(email)) | 236 if (strlen(email)) |
| 225 aim_usersearch_address(gaim_sess, gaim_conn, email); | 237 aim_usersearch_address(g->oscar_sess, g->oscar_conn, email); |
| 226 } | 238 } |
| 227 } | 239 } |
| 228 | 240 |
| 229 | 241 |
| 230 void serv_set_away(char *message) | 242 void serv_set_away(char *message) |
| 231 { | 243 { |
| 232 if (!USE_OSCAR) { | 244 /* FIXME */ |
| 245 struct gaim_connection *g = connections->data; | |
| 246 if (g->protocol == PROTO_TOC) { | |
| 233 char buf[MSG_LEN]; | 247 char buf[MSG_LEN]; |
| 234 if (message) | 248 if (message) { |
| 249 escape_text(message); | |
| 235 g_snprintf(buf, MSG_LEN, "toc_set_away \"%s\"", message); | 250 g_snprintf(buf, MSG_LEN, "toc_set_away \"%s\"", message); |
| 236 else | 251 } else |
| 237 g_snprintf(buf, MSG_LEN, "toc_set_away \"\""); | 252 g_snprintf(buf, MSG_LEN, "toc_set_away \"\""); |
| 238 sflap_send(buf, -1, TYPE_DATA); | 253 sflap_send(g, buf, -1, TYPE_DATA); |
| 239 } else { | 254 } else if (g->protocol == PROTO_OSCAR) { |
| 240 aim_bos_setprofile(gaim_sess, gaim_conn, current_user->user_info, | 255 aim_bos_setprofile(g->oscar_sess, g->oscar_conn, g->user_info, message, gaim_caps); |
| 241 message, gaim_caps); | 256 } |
| 242 } | 257 } |
| 243 } | 258 |
| 244 | 259 void serv_set_info(struct gaim_connection *g, char *info) |
| 245 void serv_set_info(char *info) | 260 { |
| 246 { | 261 if (g->protocol == PROTO_TOC) { |
| 247 if (!USE_OSCAR) { | |
| 248 char buf[MSG_LEN]; | 262 char buf[MSG_LEN]; |
| 263 escape_text(info); | |
| 249 g_snprintf(buf, sizeof(buf), "toc_set_info \"%s\n\"", info); | 264 g_snprintf(buf, sizeof(buf), "toc_set_info \"%s\n\"", info); |
| 250 sflap_send(buf, -1, TYPE_DATA); | 265 sflap_send(g, buf, -1, TYPE_DATA); |
| 251 } else { | 266 } else if (g->protocol == PROTO_OSCAR) { |
| 252 if (awaymessage) | 267 if (awaymessage) |
| 253 aim_bos_setprofile(gaim_sess, gaim_conn, info, | 268 aim_bos_setprofile(g->oscar_sess, g->oscar_conn, info, |
| 254 awaymessage->message, gaim_caps); | 269 awaymessage->message, gaim_caps); |
| 255 else | 270 else |
| 256 aim_bos_setprofile(gaim_sess, gaim_conn, info, | 271 aim_bos_setprofile(g->oscar_sess, g->oscar_conn, info, |
| 257 NULL, gaim_caps); | 272 NULL, gaim_caps); |
| 258 } | 273 } |
| 259 } | 274 } |
| 260 | 275 |
| 261 void serv_change_passwd(char *orig, char *new) { | 276 void serv_change_passwd(char *orig, char *new) { |
| 262 if (!USE_OSCAR) { | 277 /* FIXME */ |
| 278 struct gaim_connection *g = connections->data; | |
| 279 if (g->protocol == PROTO_TOC) { | |
| 263 char *buf = g_malloc(BUF_LONG); | 280 char *buf = g_malloc(BUF_LONG); |
| 264 g_snprintf(buf, BUF_LONG, "toc_change_passwd %s %s", orig, new); | 281 g_snprintf(buf, BUF_LONG, "toc_change_passwd %s %s", orig, new); |
| 265 sflap_send(buf, strlen(buf), TYPE_DATA); | 282 sflap_send(g, buf, strlen(buf), TYPE_DATA); |
| 266 g_free(buf); | 283 g_free(buf); |
| 267 } else { | 284 } else if (g->protocol == PROTO_OSCAR) { |
| 268 /* Oscar change_passwd FIXME */ | 285 /* Oscar change_passwd FIXME */ |
| 269 } | 286 } |
| 270 } | 287 } |
| 271 | 288 |
| 272 void serv_add_buddy(char *name) | 289 void serv_add_buddy(char *name) |
| 273 { | 290 { |
| 274 if (!USE_OSCAR) { | 291 /* FIXME */ |
| 292 struct gaim_connection *g = connections->data; | |
| 293 if (g->protocol == PROTO_TOC) { | |
| 275 char buf[1024]; | 294 char buf[1024]; |
| 276 g_snprintf(buf, sizeof(buf), "toc_add_buddy %s", normalize(name)); | 295 g_snprintf(buf, sizeof(buf), "toc_add_buddy %s", normalize(name)); |
| 277 sflap_send(buf, -1, TYPE_DATA); | 296 sflap_send(g, buf, -1, TYPE_DATA); |
| 278 } else { | 297 } else if (g->protocol == PROTO_OSCAR) { |
| 279 aim_add_buddy(gaim_sess, gaim_conn, name); | 298 aim_add_buddy(g->oscar_sess, g->oscar_conn, name); |
| 280 } | 299 } |
| 281 } | 300 } |
| 282 | 301 |
| 283 void serv_add_buddies(GList *buddies) | 302 void serv_add_buddies(GList *buddies) |
| 284 { | 303 { |
| 285 if (!USE_OSCAR) { | 304 /* FIXME */ |
| 305 struct gaim_connection *g = connections->data; | |
| 306 if (g->protocol == PROTO_TOC) { | |
| 286 char buf[MSG_LEN]; | 307 char buf[MSG_LEN]; |
| 287 int n, num = 0; | 308 int n, num = 0; |
| 288 | 309 |
| 289 n = g_snprintf(buf, sizeof(buf), "toc_add_buddy"); | 310 n = g_snprintf(buf, sizeof(buf), "toc_add_buddy"); |
| 290 while(buddies) { | 311 while(buddies) { |
| 291 /* i don't know why we choose 8, it just seems good */ | 312 /* i don't know why we choose 8, it just seems good */ |
| 292 if (strlen(normalize(buddies->data)) > MSG_LEN - n - 8) { | 313 if (strlen(normalize(buddies->data)) > MSG_LEN - n - 8) { |
| 293 sflap_send(buf, -1, TYPE_DATA); | 314 sflap_send(g, buf, -1, TYPE_DATA); |
| 294 n = g_snprintf(buf, sizeof(buf), "toc_add_buddy"); | 315 n = g_snprintf(buf, sizeof(buf), "toc_add_buddy"); |
| 295 num = 0; | 316 num = 0; |
| 296 } | 317 } |
| 297 ++num; | 318 ++num; |
| 298 n += g_snprintf(buf + n, sizeof(buf) - n, " %s", normalize(buddies->data)); | 319 n += g_snprintf(buf + n, sizeof(buf) - n, " %s", normalize(buddies->data)); |
| 299 buddies = buddies->next; | 320 buddies = buddies->next; |
| 300 } | 321 } |
| 301 sflap_send(buf, -1, TYPE_DATA); | 322 sflap_send(g, buf, -1, TYPE_DATA); |
| 302 } else { | 323 } else if (g->protocol == PROTO_OSCAR) { |
| 303 char buf[MSG_LEN]; | 324 char buf[MSG_LEN]; |
| 304 int n = 0; | 325 int n = 0; |
| 305 while(buddies) { | 326 while(buddies) { |
| 306 if (n > MSG_LEN - 18) { | 327 if (n > MSG_LEN - 18) { |
| 307 aim_bos_setbuddylist(gaim_sess, gaim_conn, buf); | 328 aim_bos_setbuddylist(g->oscar_sess, g->oscar_conn, buf); |
| 308 n = 0; | 329 n = 0; |
| 309 } | 330 } |
| 310 n += g_snprintf(buf + n, sizeof(buf) - n, "%s&", | 331 n += g_snprintf(buf + n, sizeof(buf) - n, "%s&", |
| 311 (char *)buddies->data); | 332 (char *)buddies->data); |
| 312 buddies = buddies->next; | 333 buddies = buddies->next; |
| 313 } | 334 } |
| 314 aim_bos_setbuddylist(gaim_sess, gaim_conn, buf); | 335 aim_bos_setbuddylist(g->oscar_sess, g->oscar_conn, buf); |
| 315 } | 336 } |
| 316 } | 337 } |
| 317 | 338 |
| 318 | 339 |
| 319 void serv_remove_buddy(char *name) | 340 void serv_remove_buddy(char *name) |
| 320 { | 341 { |
| 321 if (!USE_OSCAR) { | 342 /* FIXME */ |
| 343 struct gaim_connection *g = connections->data; | |
| 344 if (g->protocol == PROTO_TOC) { | |
| 322 char buf[1024]; | 345 char buf[1024]; |
| 323 g_snprintf(buf, sizeof(buf), "toc_remove_buddy %s", normalize(name)); | 346 g_snprintf(buf, sizeof(buf), "toc_remove_buddy %s", normalize(name)); |
| 324 sflap_send(buf, -1, TYPE_DATA); | 347 sflap_send(g, buf, -1, TYPE_DATA); |
| 325 } else { | 348 } else if (g->protocol == PROTO_OSCAR) { |
| 326 aim_remove_buddy(gaim_sess, gaim_conn, name); | 349 aim_remove_buddy(g->oscar_sess, g->oscar_conn, name); |
| 327 } | 350 } |
| 328 } | 351 } |
| 329 | 352 |
| 330 void serv_add_permit(char *name) | 353 void serv_add_permit(char *name) |
| 331 { | 354 { |
| 345 | 368 |
| 346 | 369 |
| 347 | 370 |
| 348 void serv_set_permit_deny() | 371 void serv_set_permit_deny() |
| 349 { | 372 { |
| 350 if (!USE_OSCAR) { | 373 /* FIXME */ |
| 374 struct gaim_connection *g = connections->data; | |
| 375 if (g->protocol == PROTO_TOC) { | |
| 351 char buf[MSG_LEN]; | 376 char buf[MSG_LEN]; |
| 352 int at; | 377 int at; |
| 353 GList *list; | 378 GList *list; |
| 354 | 379 |
| 355 switch (permdeny) { | 380 switch (permdeny) { |
| 356 case PERMIT_ALL: | 381 case PERMIT_ALL: |
| 357 sprintf(buf, "toc_add_permit %s", current_user->username); | 382 sprintf(buf, "toc_add_permit %s", g->username); |
| 358 sflap_send(buf, -1, TYPE_DATA); | 383 sflap_send(g, buf, -1, TYPE_DATA); |
| 359 sprintf(buf, "toc_add_deny"); | 384 sprintf(buf, "toc_add_deny"); |
| 360 sflap_send(buf, -1, TYPE_DATA); | 385 sflap_send(g, buf, -1, TYPE_DATA); |
| 361 break; | 386 break; |
| 362 case PERMIT_NONE: | 387 case PERMIT_NONE: |
| 363 sprintf(buf, "toc_add_deny %s", current_user->username); | 388 sprintf(buf, "toc_add_deny %s", g->username); |
| 364 sflap_send(buf, -1, TYPE_DATA); | 389 sflap_send(g, buf, -1, TYPE_DATA); |
| 365 sprintf(buf, "toc_add_permit"); | 390 sprintf(buf, "toc_add_permit"); |
| 366 sflap_send(buf, -1, TYPE_DATA); | 391 sflap_send(g, buf, -1, TYPE_DATA); |
| 367 break; | 392 break; |
| 368 case PERMIT_SOME: | 393 case PERMIT_SOME: |
| 369 at = g_snprintf(buf, sizeof(buf), "toc_add_permit"); | 394 at = g_snprintf(buf, sizeof(buf), "toc_add_permit"); |
| 370 list = permit; | 395 list = permit; |
| 371 while (list) { | 396 while (list) { |
| 372 at += g_snprintf(&buf[at], sizeof(buf) - at, " %s", normalize(list->data)); | 397 at += g_snprintf(&buf[at], sizeof(buf) - at, " %s", normalize(list->data)); |
| 373 list = list->next; | 398 list = list->next; |
| 374 } | 399 } |
| 375 buf[at] = 0; /* is this necessary? */ | 400 buf[at] = 0; /* is this necessary? */ |
| 376 sflap_send(buf, -1, TYPE_DATA); | 401 sflap_send(g, buf, -1, TYPE_DATA); |
| 377 break; | 402 break; |
| 378 case DENY_SOME: | 403 case DENY_SOME: |
| 379 /* you'll still see people as being online, but they won't see you, and you | 404 /* you'll still see people as being online, but they won't see you, and you |
| 380 * won't get updates for them. that's why i thought this was broken. */ | 405 * won't get updates for them. that's why i thought this was broken. */ |
| 381 at = g_snprintf(buf, sizeof(buf), "toc_add_deny"); | 406 at = g_snprintf(buf, sizeof(buf), "toc_add_deny"); |
| 383 while (list) { | 408 while (list) { |
| 384 at += g_snprintf(&buf[at], sizeof(buf) - at, " %s", normalize(list->data)); | 409 at += g_snprintf(&buf[at], sizeof(buf) - at, " %s", normalize(list->data)); |
| 385 list = list->next; | 410 list = list->next; |
| 386 } | 411 } |
| 387 buf[at] = 0; /* is this necessary? */ | 412 buf[at] = 0; /* is this necessary? */ |
| 388 sflap_send(buf, -1, TYPE_DATA); | 413 sflap_send(g, buf, -1, TYPE_DATA); |
| 389 break; | 414 break; |
| 390 } | 415 } |
| 391 } else { | 416 } else if (g->protocol == PROTO_OSCAR) { |
| 392 /* | 417 /* |
| 393 int at; | 418 int at; |
| 394 GList *list; | 419 GList *list; |
| 395 char buf[MSG_LEN]; | 420 char buf[MSG_LEN]; |
| 396 | 421 |
| 436 } | 461 } |
| 437 */ | 462 */ |
| 438 } | 463 } |
| 439 } | 464 } |
| 440 | 465 |
| 441 void serv_set_idle(int time) | 466 void serv_set_idle(struct gaim_connection *g, int time) |
| 442 { | 467 { |
| 443 if (!USE_OSCAR) { | 468 if (g->protocol == PROTO_TOC) { |
| 444 char buf[256]; | 469 char buf[256]; |
| 445 g_snprintf(buf, sizeof(buf), "toc_set_idle %d", time); | 470 g_snprintf(buf, sizeof(buf), "toc_set_idle %d", time); |
| 446 sflap_send(buf, -1, TYPE_DATA); | 471 sflap_send(g, buf, -1, TYPE_DATA); |
| 447 } else { | 472 } else if (g->protocol == PROTO_OSCAR) { |
| 448 aim_bos_setidle(gaim_sess, gaim_conn, time); | 473 aim_bos_setidle(g->oscar_sess, g->oscar_conn, time); |
| 449 } | 474 } |
| 450 } | 475 } |
| 451 | 476 |
| 452 | 477 |
| 453 void serv_warn(char *name, int anon) | 478 void serv_warn(char *name, int anon) |
| 454 { | 479 { |
| 455 if (!USE_OSCAR) { | 480 /* FIXME */ |
| 481 struct gaim_connection *g = connections->data; | |
| 482 if (g->protocol == PROTO_TOC) { | |
| 456 char *send = g_malloc(256); | 483 char *send = g_malloc(256); |
| 457 g_snprintf(send, 255, "toc_evil %s %s", name, | 484 g_snprintf(send, 255, "toc_evil %s %s", name, |
| 458 ((anon) ? "anon" : "norm")); | 485 ((anon) ? "anon" : "norm")); |
| 459 sflap_send(send, -1, TYPE_DATA); | 486 sflap_send(g, send, -1, TYPE_DATA); |
| 460 g_free(send); | 487 g_free(send); |
| 461 } else { | 488 } else if (g->protocol == PROTO_OSCAR) { |
| 462 aim_send_warning(gaim_sess, gaim_conn, name, anon); | 489 aim_send_warning(g->oscar_sess, g->oscar_conn, name, anon); |
| 463 } | 490 } |
| 464 } | 491 } |
| 465 | 492 |
| 466 void serv_build_config(char *buf, int len, gboolean show) { | 493 void serv_build_config(char *buf, int len, gboolean show) { |
| 467 toc_build_config(buf, len, show); | 494 toc_build_config(buf, len, show); |
| 468 } | 495 } |
| 469 | 496 |
| 470 | 497 |
| 471 void serv_save_config() | 498 void serv_save_config() |
| 472 { | 499 { |
| 473 if (!USE_OSCAR) { | 500 /* FIXME */ |
| 501 struct gaim_connection *g = connections->data; | |
| 502 if (g->protocol == PROTO_TOC) { | |
| 474 char *buf = g_malloc(BUF_LONG); | 503 char *buf = g_malloc(BUF_LONG); |
| 475 char *buf2 = g_malloc(MSG_LEN); | 504 char *buf2 = g_malloc(MSG_LEN); |
| 476 serv_build_config(buf, BUF_LONG / 2, FALSE); | 505 serv_build_config(buf, BUF_LONG / 2, FALSE); |
| 477 g_snprintf(buf2, MSG_LEN, "toc_set_config {%s}", buf); | 506 g_snprintf(buf2, MSG_LEN, "toc_set_config {%s}", buf); |
| 478 sflap_send(buf2, -1, TYPE_DATA); | 507 sflap_send(g, buf2, -1, TYPE_DATA); |
| 479 g_free(buf2); | 508 g_free(buf2); |
| 480 g_free(buf); | 509 g_free(buf); |
| 481 } | 510 } |
| 482 } | 511 } |
| 483 | 512 |
| 484 | 513 |
| 485 void serv_accept_chat(int i) | 514 void serv_accept_chat(int i) |
| 486 { | 515 { |
| 487 if (!USE_OSCAR) { | 516 /* FIXME */ |
| 517 struct gaim_connection *g = connections->data; | |
| 518 if (g->protocol == PROTO_TOC) { | |
| 488 char *buf = g_malloc(256); | 519 char *buf = g_malloc(256); |
| 489 g_snprintf(buf, 255, "toc_chat_accept %d", i); | 520 g_snprintf(buf, 255, "toc_chat_accept %d", i); |
| 490 sflap_send(buf, -1, TYPE_DATA); | 521 sflap_send(g, buf, -1, TYPE_DATA); |
| 491 g_free(buf); | 522 g_free(buf); |
| 492 } else { | 523 } else if (g->protocol == PROTO_OSCAR) { |
| 493 /* this should never get called because libfaim doesn't use the id | 524 /* this should never get called because libfaim doesn't use the id |
| 494 * (i'm not even sure Oscar does). go through serv_join_chat instead */ | 525 * (i'm not even sure Oscar does). go through serv_join_chat instead */ |
| 495 } | 526 } |
| 496 } | 527 } |
| 497 | 528 |
| 498 void serv_join_chat(int exchange, char *name) | 529 void serv_join_chat(int exchange, char *name) |
| 499 { | 530 { |
| 500 if (!USE_OSCAR) { | 531 /* FIXME */ |
| 532 struct gaim_connection *g = connections->data; | |
| 533 if (g->protocol == PROTO_TOC) { | |
| 501 char buf[BUF_LONG]; | 534 char buf[BUF_LONG]; |
| 502 g_snprintf(buf, sizeof(buf)/2, "toc_chat_join %d \"%s\"", exchange, name); | 535 g_snprintf(buf, sizeof(buf)/2, "toc_chat_join %d \"%s\"", exchange, name); |
| 503 sflap_send(buf, -1, TYPE_DATA); | 536 sflap_send(g, buf, -1, TYPE_DATA); |
| 504 } else { | 537 } else if (g->protocol == PROTO_OSCAR) { |
| 505 struct aim_conn_t *cur = NULL; | 538 struct aim_conn_t *cur = NULL; |
| 506 sprintf(debug_buff, "Attempting to join chat room %s.\n", name); | 539 sprintf(debug_buff, "Attempting to join chat room %s.\n", name); |
| 507 debug_print(debug_buff); | 540 debug_print(debug_buff); |
| 508 if ((cur = aim_getconn_type(gaim_sess, AIM_CONN_TYPE_CHATNAV))) { | 541 if ((cur = aim_getconn_type(g->oscar_sess, AIM_CONN_TYPE_CHATNAV))) { |
| 509 debug_print("chatnav exists, creating room\n"); | 542 debug_print("chatnav exists, creating room\n"); |
| 510 aim_chatnav_createroom(gaim_sess, cur, name, exchange); | 543 aim_chatnav_createroom(g->oscar_sess, cur, name, exchange); |
| 511 } else { | 544 } else { |
| 512 /* this gets tricky */ | 545 /* this gets tricky */ |
| 513 debug_print("chatnav does not exist, opening chatnav\n"); | 546 debug_print("chatnav does not exist, opening chatnav\n"); |
| 514 create_exchange = exchange; | 547 g->create_exchange = exchange; |
| 515 create_name = g_strdup(name); | 548 g->create_name = g_strdup(name); |
| 516 aim_bos_reqservice(gaim_sess, gaim_conn, AIM_CONN_TYPE_CHATNAV); | 549 aim_bos_reqservice(g->oscar_sess, g->oscar_conn, AIM_CONN_TYPE_CHATNAV); |
| 517 } | 550 } |
| 518 } | 551 } |
| 519 } | 552 } |
| 520 | 553 |
| 521 void serv_chat_invite(int id, char *message, char *name) | 554 void serv_chat_invite(int id, char *message, char *name) |
| 522 { | 555 { |
| 523 if (!USE_OSCAR) { | 556 /* FIXME */ |
| 557 struct gaim_connection *g = connections->data; | |
| 558 if (g->protocol == PROTO_TOC) { | |
| 524 char buf[BUF_LONG]; | 559 char buf[BUF_LONG]; |
| 525 g_snprintf(buf, sizeof(buf)/2, "toc_chat_invite %d \"%s\" %s", id, message, normalize(name)); | 560 g_snprintf(buf, sizeof(buf)/2, "toc_chat_invite %d \"%s\" %s", id, message, normalize(name)); |
| 526 sflap_send(buf, -1, TYPE_DATA); | 561 sflap_send(g, buf, -1, TYPE_DATA); |
| 527 } else { | 562 } else if (g->protocol == PROTO_OSCAR) { |
| 528 GList *bcs = buddy_chats; | 563 GList *bcs = buddy_chats; |
| 529 struct conversation *b = NULL; | 564 struct conversation *b = NULL; |
| 530 | 565 |
| 531 while (bcs) { | 566 while (bcs) { |
| 532 b = (struct conversation *)bcs->data; | 567 b = (struct conversation *)bcs->data; |
| 537 } | 572 } |
| 538 | 573 |
| 539 if (!b) | 574 if (!b) |
| 540 return; | 575 return; |
| 541 | 576 |
| 542 aim_chat_invite(gaim_sess, gaim_conn, name, message, 0x4, b->name, 0x1); | 577 aim_chat_invite(g->oscar_sess, g->oscar_conn, name, message, 0x4, b->name, 0x1); |
| 543 } | 578 } |
| 544 } | 579 } |
| 545 | 580 |
| 546 void serv_chat_leave(int id) | 581 void serv_chat_leave(int id) |
| 547 { | 582 { |
| 548 if (!USE_OSCAR) { | 583 /* FIXME */ |
| 584 struct gaim_connection *g = connections->data; | |
| 585 if (g->protocol == PROTO_TOC) { | |
| 549 char *buf = g_malloc(256); | 586 char *buf = g_malloc(256); |
| 550 g_snprintf(buf, 255, "toc_chat_leave %d", id); | 587 g_snprintf(buf, 255, "toc_chat_leave %d", id); |
| 551 sflap_send(buf, -1, TYPE_DATA); | 588 sflap_send(g, buf, -1, TYPE_DATA); |
| 552 g_free(buf); | 589 g_free(buf); |
| 553 } else { | 590 } else if (g->protocol == PROTO_OSCAR) { |
| 554 GList *bcs = buddy_chats; | 591 GList *bcs = buddy_chats; |
| 555 struct conversation *b = NULL; | 592 struct conversation *b = NULL; |
| 556 struct chat_connection *c = NULL; | 593 struct chat_connection *c = NULL; |
| 557 int count = 0; | 594 int count = 0; |
| 558 | 595 |
| 570 | 607 |
| 571 sprintf(debug_buff, "Attempting to leave room %s (currently in %d rooms)\n", | 608 sprintf(debug_buff, "Attempting to leave room %s (currently in %d rooms)\n", |
| 572 b->name, count); | 609 b->name, count); |
| 573 debug_print(debug_buff); | 610 debug_print(debug_buff); |
| 574 | 611 |
| 575 c = find_oscar_chat(b->name); | 612 c = find_oscar_chat(g, b->name); |
| 576 if (c != NULL) { | 613 if (c != NULL) { |
| 577 oscar_chats = g_list_remove(oscar_chats, c); | 614 g->oscar_chats = g_slist_remove(g->oscar_chats, c); |
| 578 gdk_input_remove(c->inpa); | 615 gdk_input_remove(c->inpa); |
| 579 if (gaim_sess) | 616 if (g && g->oscar_sess) |
| 580 aim_conn_kill(gaim_sess, &c->conn); | 617 aim_conn_kill(g->oscar_sess, &c->conn); |
| 581 g_free(c->name); | 618 g_free(c->name); |
| 582 g_free(c); | 619 g_free(c); |
| 583 } | 620 } |
| 584 /* we do this because with Oscar it doesn't tell us we left */ | 621 /* we do this because with Oscar it doesn't tell us we left */ |
| 585 serv_got_chat_left(b->id); | 622 serv_got_chat_left(b->id); |
| 586 } | 623 } |
| 587 } | 624 } |
| 588 | 625 |
| 589 void serv_chat_whisper(int id, char *who, char *message) | 626 void serv_chat_whisper(int id, char *who, char *message) |
| 590 { | 627 { |
| 591 if (!USE_OSCAR) { | 628 /* FIXME */ |
| 629 struct gaim_connection *g = connections->data; | |
| 630 if (g->protocol == PROTO_TOC) { | |
| 592 char buf2[MSG_LEN]; | 631 char buf2[MSG_LEN]; |
| 593 g_snprintf(buf2, sizeof(buf2), "toc_chat_whisper %d %s \"%s\"", id, who, message); | 632 g_snprintf(buf2, sizeof(buf2), "toc_chat_whisper %d %s \"%s\"", id, who, message); |
| 594 sflap_send(buf2, -1, TYPE_DATA); | 633 sflap_send(g, buf2, -1, TYPE_DATA); |
| 595 } else { | 634 } else if (g->protocol == PROTO_OSCAR) { |
| 596 do_error_dialog("Sorry, Oscar doesn't whisper. Send an IM. (The last message was not received.)", | 635 do_error_dialog("Sorry, Oscar doesn't whisper. Send an IM. (The last message was not received.)", |
| 597 "Gaim - Chat"); | 636 "Gaim - Chat"); |
| 598 } | 637 } |
| 599 } | 638 } |
| 600 | 639 |
| 601 void serv_chat_send(int id, char *message) | 640 void serv_chat_send(int id, char *message) |
| 602 { | 641 { |
| 603 if (!USE_OSCAR) { | 642 /* FIXME */ |
| 643 struct gaim_connection *g = connections->data; | |
| 644 if (g->protocol == PROTO_TOC) { | |
| 604 char buf[MSG_LEN]; | 645 char buf[MSG_LEN]; |
| 605 escape_text(message); | 646 escape_text(message); |
| 606 g_snprintf(buf, sizeof(buf), "toc_chat_send %d \"%s\"",id, message); | 647 g_snprintf(buf, sizeof(buf), "toc_chat_send %d \"%s\"",id, message); |
| 607 sflap_send(buf, -1, TYPE_DATA); | 648 sflap_send(g, buf, -1, TYPE_DATA); |
| 608 } else { | 649 } else if (g->protocol == PROTO_OSCAR) { |
| 609 struct aim_conn_t *cn; | 650 struct aim_conn_t *cn; |
| 610 GList *bcs = buddy_chats; | 651 GList *bcs = buddy_chats; |
| 611 struct conversation *b = NULL; | 652 struct conversation *b = NULL; |
| 612 | 653 |
| 613 while (bcs) { | 654 while (bcs) { |
| 618 b = NULL; | 659 b = NULL; |
| 619 } | 660 } |
| 620 if (!b) | 661 if (!b) |
| 621 return; | 662 return; |
| 622 | 663 |
| 623 cn = aim_chat_getconn(gaim_sess, b->name); | 664 cn = aim_chat_getconn(g->oscar_sess, b->name); |
| 624 aim_chat_send_im(gaim_sess, cn, message); | 665 aim_chat_send_im(g->oscar_sess, cn, message); |
| 625 } | 666 } |
| 626 serv_touch_idle(); | 667 serv_touch_idle(g); |
| 627 } | 668 } |
| 628 | 669 |
| 629 | 670 |
| 630 | 671 |
| 631 void serv_got_im(char *name, char *message, int away) | 672 void serv_got_im(struct gaim_connection *gc, char *name, char *message, int away) |
| 632 { | 673 { |
| 633 struct conversation *cnv; | 674 struct conversation *cnv; |
| 634 int is_idle = -1; | 675 int is_idle = -1; |
| 635 int new_conv = 0; | 676 int new_conv = 0; |
| 636 | 677 |
| 688 } | 729 } |
| 689 write_to_conv(cnv, message, away | WFLAG_RECV, NULL); | 730 write_to_conv(cnv, message, away | WFLAG_RECV, NULL); |
| 690 } | 731 } |
| 691 | 732 |
| 692 | 733 |
| 734 cnv->gc = gc; | |
| 735 gtk_option_menu_set_history(GTK_OPTION_MENU(cnv->menu), g_slist_index(connections, gc)); | |
| 693 | 736 |
| 694 | 737 |
| 695 if (awaymessage != NULL) { | 738 if (awaymessage != NULL) { |
| 696 time_t t; | 739 time_t t; |
| 697 char *tmpmsg; | 740 char *tmpmsg; |
| 741 struct buddy *b = find_buddy(name); | |
| 742 char *alias = b ? b->show : name; | |
| 698 | 743 |
| 699 time(&t); | 744 time(&t); |
| 700 | 745 |
| 701 | 746 |
| 702 if ((cnv == NULL) || (t - cnv->sent_away) < 120) | 747 if ((cnv == NULL) || (t - cnv->sent_away) < 120) |
| 710 /* apply default fonts and colors */ | 755 /* apply default fonts and colors */ |
| 711 tmpmsg = stylize(awaymessage->message, MSG_LEN); | 756 tmpmsg = stylize(awaymessage->message, MSG_LEN); |
| 712 | 757 |
| 713 escape_text(tmpmsg); | 758 escape_text(tmpmsg); |
| 714 escape_message(tmpmsg); | 759 escape_message(tmpmsg); |
| 715 serv_send_im(name, away_subs(tmpmsg, name), 1); | 760 serv_send_im(name, away_subs(tmpmsg, alias), 1); |
| 716 g_free(tmpmsg); | 761 g_free(tmpmsg); |
| 717 tmpmsg = stylize(awaymessage->message, MSG_LEN); | 762 tmpmsg = stylize(awaymessage->message, MSG_LEN); |
| 718 | 763 |
| 719 if (is_idle == -1) | 764 if (is_idle == -1) |
| 720 is_idle = 1; | 765 is_idle = 1; |
| 721 | 766 |
| 722 if (cnv != NULL) | 767 if (cnv != NULL) |
| 723 write_to_conv(cnv, away_subs(tmpmsg, name), WFLAG_SEND | WFLAG_AUTO, NULL); | 768 write_to_conv(cnv, away_subs(tmpmsg, alias), WFLAG_SEND | WFLAG_AUTO, NULL); |
| 724 g_free(tmpmsg); | 769 g_free(tmpmsg); |
| 725 } | 770 } |
| 726 } | 771 } |
| 727 | 772 |
| 728 | 773 |
| 729 | 774 |
| 730 void serv_got_update(char *name, int loggedin, int evil, time_t signon, time_t idle, int type, u_short caps) | 775 void serv_got_update(char *name, int loggedin, int evil, time_t signon, time_t idle, int type, u_short caps) |
| 731 { | 776 { |
| 732 struct buddy *b; | 777 struct buddy *b = find_buddy(name); |
| 733 char *nname; | 778 struct gaim_connection *gc = find_gaim_conn_by_name(name); |
| 734 | 779 |
| 735 b = find_buddy(name); | 780 if (gc) { |
| 736 | 781 correction_time = (int)(signon - gc->login_time); |
| 737 nname = g_strdup(normalize(name)); | |
| 738 if (!strcasecmp(nname, normalize(current_user->username))) { | |
| 739 correction_time = (int)(signon - login_time); | |
| 740 update_all_buddies(); | 782 update_all_buddies(); |
| 741 if (!b) { | 783 if (!b) { |
| 742 g_free(nname); | |
| 743 return; | 784 return; |
| 744 } | 785 } |
| 745 } | 786 } |
| 746 | |
| 747 g_free(nname); | |
| 748 | 787 |
| 749 if (!b) { | 788 if (!b) { |
| 750 sprintf(debug_buff,"Error, no such person\n"); | 789 sprintf(debug_buff,"Error, no such person\n"); |
| 751 debug_print(debug_buff); | 790 debug_print(debug_buff); |
| 752 return; | 791 return; |
| 858 gtk_widget_destroy(w2); | 897 gtk_widget_destroy(w2); |
| 859 } | 898 } |
| 860 | 899 |
| 861 static void chat_invite_callback(GtkWidget *w, GtkWidget *w2) | 900 static void chat_invite_callback(GtkWidget *w, GtkWidget *w2) |
| 862 { | 901 { |
| 863 if (!USE_OSCAR) { | 902 /* FIXME */ |
| 903 struct gaim_connection *g = connections->data; | |
| 904 if (g->protocol == PROTO_TOC) { | |
| 864 int i = (int)gtk_object_get_user_data(GTK_OBJECT(w2)); | 905 int i = (int)gtk_object_get_user_data(GTK_OBJECT(w2)); |
| 865 serv_accept_chat(i); | 906 serv_accept_chat(i); |
| 866 gtk_widget_destroy(w2); | 907 gtk_widget_destroy(w2); |
| 867 } else { | 908 } else if (g->protocol == PROTO_OSCAR) { |
| 868 char *i = (char *)gtk_object_get_user_data(GTK_OBJECT(w2)); | 909 char *i = (char *)gtk_object_get_user_data(GTK_OBJECT(w2)); |
| 869 int id = (int)gtk_object_get_user_data(GTK_OBJECT(w)); | 910 int id = (int)gtk_object_get_user_data(GTK_OBJECT(w)); |
| 870 serv_join_chat(id, i); | 911 serv_join_chat(id, i); |
| 871 g_free(i); | 912 g_free(i); |
| 872 gtk_widget_destroy(w2); | 913 gtk_widget_destroy(w2); |
| 881 GtkWidget *label; | 922 GtkWidget *label; |
| 882 GtkWidget *yesbtn; | 923 GtkWidget *yesbtn; |
| 883 GtkWidget *nobtn; | 924 GtkWidget *nobtn; |
| 884 | 925 |
| 885 char buf2[BUF_LONG]; | 926 char buf2[BUF_LONG]; |
| 927 /* FIXME */ | |
| 928 struct gaim_connection *g = connections->data; | |
| 886 | 929 |
| 887 | 930 |
| 888 plugin_event(event_chat_invited, who, name, message); | 931 plugin_event(event_chat_invited, who, name, message); |
| 889 | 932 |
| 890 if (message) | 933 if (message) |
| 915 if (display_options & OPT_DISP_COOL_LOOK) | 958 if (display_options & OPT_DISP_COOL_LOOK) |
| 916 gtk_button_set_relief(GTK_BUTTON(nobtn), GTK_RELIEF_NONE); | 959 gtk_button_set_relief(GTK_BUTTON(nobtn), GTK_RELIEF_NONE); |
| 917 | 960 |
| 918 /* gtk_widget_set_usize(d, 200, 110); */ | 961 /* gtk_widget_set_usize(d, 200, 110); */ |
| 919 | 962 |
| 920 if (!USE_OSCAR) | 963 if (g->protocol == PROTO_TOC) |
| 921 gtk_object_set_user_data(GTK_OBJECT(d), (void *)id); | 964 gtk_object_set_user_data(GTK_OBJECT(d), (void *)id); |
| 922 else { | 965 else if (g->protocol == PROTO_OSCAR) { |
| 923 gtk_object_set_user_data(GTK_OBJECT(d), (void *)g_strdup(name)); | 966 gtk_object_set_user_data(GTK_OBJECT(d), (void *)g_strdup(name)); |
| 924 gtk_object_set_user_data(GTK_OBJECT(yesbtn), (void *)id); | 967 gtk_object_set_user_data(GTK_OBJECT(yesbtn), (void *)id); |
| 968 } else { | |
| 969 /* PRPL */ | |
| 925 } | 970 } |
| 926 | 971 |
| 927 | 972 |
| 928 gtk_window_set_title(GTK_WINDOW(d), "Buddy chat invite"); | 973 gtk_window_set_title(GTK_WINDOW(d), "Buddy chat invite"); |
| 929 gtk_signal_connect(GTK_OBJECT(nobtn), "clicked", GTK_SIGNAL_FUNC(close_invite), d); | 974 gtk_signal_connect(GTK_OBJECT(nobtn), "clicked", GTK_SIGNAL_FUNC(close_invite), d); |
| 1024 } | 1069 } |
| 1025 | 1070 |
| 1026 void serv_rvous_accept(char *name, char *cookie, char *uid) | 1071 void serv_rvous_accept(char *name, char *cookie, char *uid) |
| 1027 { | 1072 { |
| 1028 /* Oscar doesn't matter here because this won't ever be called for it */ | 1073 /* Oscar doesn't matter here because this won't ever be called for it */ |
| 1074 /* FIXME */ | |
| 1075 struct gaim_connection *g = connections->data; | |
| 1029 char buf[MSG_LEN]; | 1076 char buf[MSG_LEN]; |
| 1030 g_snprintf(buf, MSG_LEN, "toc_rvous_accept %s %s %s", normalize(name), | 1077 g_snprintf(buf, MSG_LEN, "toc_rvous_accept %s %s %s", normalize(name), |
| 1031 cookie, uid); | 1078 cookie, uid); |
| 1032 sflap_send(buf, strlen(buf), TYPE_DATA); | 1079 sflap_send(g, buf, -1, TYPE_DATA); |
| 1033 } | 1080 } |
| 1034 | 1081 |
| 1035 void serv_rvous_cancel(char *name, char *cookie, char *uid) | 1082 void serv_rvous_cancel(char *name, char *cookie, char *uid) |
| 1036 { | 1083 { |
| 1084 /* FIXME */ | |
| 1085 struct gaim_connection *g = connections->data; | |
| 1037 char buf[MSG_LEN]; | 1086 char buf[MSG_LEN]; |
| 1038 g_snprintf(buf, MSG_LEN, "toc_rvous_cancel %s %s %s", normalize(name), | 1087 g_snprintf(buf, MSG_LEN, "toc_rvous_cancel %s %s %s", normalize(name), |
| 1039 cookie, uid); | 1088 cookie, uid); |
| 1040 sflap_send(buf, strlen(buf), TYPE_DATA); | 1089 sflap_send(g, buf, -1, TYPE_DATA); |
| 1041 } | 1090 } |
| 1042 | 1091 |
| 1043 void serv_do_imimage(GtkWidget *w, char *name) { | 1092 void serv_do_imimage(GtkWidget *w, char *name) { |
| 1044 struct conversation *cnv = find_conversation(name); | 1093 struct conversation *cnv = find_conversation(name); |
| 1045 if (!cnv) cnv = new_conversation(name); | 1094 if (!cnv) cnv = new_conversation(name); |
| 1046 | 1095 |
| 1047 if (!USE_OSCAR) { | 1096 if (cnv->gc->protocol == PROTO_TOC) { |
| 1048 /* Direct IM TOC FIXME */ | 1097 /* Direct IM TOC FIXME */ |
| 1049 } else { | 1098 } else if (cnv->gc->protocol == PROTO_OSCAR) { |
| 1050 oscar_do_directim(name); | 1099 oscar_do_directim(cnv->gc, name); |
| 1051 } | 1100 } |
| 1052 } | 1101 } |
| 1053 | 1102 |
| 1054 void serv_got_imimage(char *name, char *cookie, char *ip, struct aim_conn_t *conn, int watcher) | 1103 void serv_got_imimage(struct gaim_connection *gc, char *name, char *cookie, char *ip, |
| 1055 { | 1104 struct aim_conn_t *conn, int watcher) |
| 1056 if (!USE_OSCAR) { | 1105 { |
| 1106 if (gc->protocol == PROTO_TOC) { | |
| 1057 /* Direct IM TOC FIXME */ | 1107 /* Direct IM TOC FIXME */ |
| 1058 } else { | 1108 } else if (gc->protocol == PROTO_OSCAR) { |
| 1059 struct conversation *cnv = find_conversation(name); | 1109 struct conversation *cnv = find_conversation(name); |
| 1060 if (!cnv) cnv = new_conversation(name); | 1110 if (!cnv) cnv = new_conversation(name); |
| 1061 make_direct(cnv, TRUE, conn, watcher); | 1111 make_direct(cnv, TRUE, conn, watcher); |
| 1062 } | 1112 } |
| 1063 } | 1113 } |
