Mercurial > pidgin
comparison src/server.c @ 976:2586b2a3725e
[gaim-migrate @ 986]
warning works better, i hope :-P for every one fixme i get rid of i add 3, i swear
committer: Tailor Script <tailor@pidgin.im>
| author | Eric Warmenhoven <eric@warmenhoven.org> |
|---|---|
| date | Wed, 11 Oct 2000 04:30:26 +0000 |
| parents | 2e905413b17f |
| children | 563c409e26a1 |
comparison
equal
deleted
inserted
replaced
| 975:a45991891aba | 976:2586b2a3725e |
|---|---|
| 168 serv_touch_idle(cnv->gc); | 168 serv_touch_idle(cnv->gc); |
| 169 } | 169 } |
| 170 | 170 |
| 171 void serv_get_info(char *name) | 171 void serv_get_info(char *name) |
| 172 { | 172 { |
| 173 /* FIXME */ | 173 /* FIXME: getting someone's info? how do you decide something like that? I think that |
| 174 * the buddy list/UI needs to be really changed before this gets fixed*/ | |
| 174 struct gaim_connection *g = connections->data; | 175 struct gaim_connection *g = connections->data; |
| 175 if (g->protocol == PROTO_TOC) { | 176 if (g->protocol == PROTO_TOC) { |
| 176 char buf[MSG_LEN]; | 177 char buf[MSG_LEN]; |
| 177 g_snprintf(buf, MSG_LEN, "toc_get_info %s", normalize(name)); | 178 g_snprintf(buf, MSG_LEN, "toc_get_info %s", normalize(name)); |
| 178 sflap_send(g, buf, -1, TYPE_DATA); | 179 sflap_send(g, buf, -1, TYPE_DATA); |
| 181 } | 182 } |
| 182 } | 183 } |
| 183 | 184 |
| 184 void serv_get_away_msg(char *name) | 185 void serv_get_away_msg(char *name) |
| 185 { | 186 { |
| 186 /* FIXME */ | 187 /* FIXME: see the serv_get_info comment above :-P */ |
| 187 struct gaim_connection *g = connections->data; | 188 struct gaim_connection *g = connections->data; |
| 188 if (g->protocol == PROTO_TOC) { | 189 if (g->protocol == PROTO_TOC) { |
| 189 /* HAHA! TOC doesn't have this yet */ | 190 /* HAHA! TOC doesn't have this yet */ |
| 190 } else if (g->protocol == PROTO_OSCAR) { | 191 } else if (g->protocol == PROTO_OSCAR) { |
| 191 aim_getinfo(g->oscar_sess, g->oscar_conn, name, AIM_GETINFO_AWAYMESSAGE); | 192 aim_getinfo(g->oscar_sess, g->oscar_conn, name, AIM_GETINFO_AWAYMESSAGE); |
| 192 } | 193 } |
| 193 } | 194 } |
| 194 | 195 |
| 195 void serv_get_dir(char *name) | 196 void serv_get_dir(char *name) |
| 196 { | 197 { |
| 197 /* FIXME */ | 198 /* FIXME: see the serv_get_info comment above :-P */ |
| 198 struct gaim_connection *g = connections->data; | 199 struct gaim_connection *g = connections->data; |
| 199 if (g->protocol == PROTO_TOC) { | 200 if (g->protocol == PROTO_TOC) { |
| 200 char buf[MSG_LEN]; | 201 char buf[MSG_LEN]; |
| 201 g_snprintf(buf, MSG_LEN, "toc_get_dir %s", normalize(name)); | 202 g_snprintf(buf, MSG_LEN, "toc_get_dir %s", normalize(name)); |
| 202 sflap_send(g, buf, -1, TYPE_DATA); | 203 sflap_send(g, buf, -1, TYPE_DATA); |
| 241 } | 242 } |
| 242 | 243 |
| 243 | 244 |
| 244 void serv_set_away(char *message) | 245 void serv_set_away(char *message) |
| 245 { | 246 { |
| 246 /* FIXME */ | 247 /* FIXME: for now, setting away sets *everyone* to away */ |
| 247 struct gaim_connection *g = connections->data; | 248 GSList *c = connections; |
| 248 if (g->protocol == PROTO_TOC) { | 249 struct gaim_connection *g; |
| 249 char buf[MSG_LEN]; | 250 |
| 250 if (message) { | 251 while (c) { |
| 251 escape_text(message); | 252 g = (struct gaim_connection *)c->data; |
| 252 g_snprintf(buf, MSG_LEN, "toc_set_away \"%s\"", message); | 253 if (g->protocol == PROTO_TOC) { |
| 253 } else | 254 char buf[MSG_LEN]; |
| 254 g_snprintf(buf, MSG_LEN, "toc_set_away \"\""); | 255 if (message) { |
| 255 sflap_send(g, buf, -1, TYPE_DATA); | 256 escape_text(message); |
| 256 } else if (g->protocol == PROTO_OSCAR) { | 257 g_snprintf(buf, MSG_LEN, "toc_set_away \"%s\"", message); |
| 257 aim_bos_setprofile(g->oscar_sess, g->oscar_conn, g->user_info, message, gaim_caps); | 258 } else |
| 259 g_snprintf(buf, MSG_LEN, "toc_set_away \"\""); | |
| 260 sflap_send(g, buf, -1, TYPE_DATA); | |
| 261 } else if (g->protocol == PROTO_OSCAR) { | |
| 262 aim_bos_setprofile(g->oscar_sess, g->oscar_conn, g->user_info, message, gaim_caps); | |
| 263 } | |
| 264 c = c->next; | |
| 258 } | 265 } |
| 259 } | 266 } |
| 260 | 267 |
| 261 void serv_set_info(struct gaim_connection *g, char *info) | 268 void serv_set_info(struct gaim_connection *g, char *info) |
| 262 { | 269 { |
| 274 NULL, gaim_caps); | 281 NULL, gaim_caps); |
| 275 } | 282 } |
| 276 } | 283 } |
| 277 | 284 |
| 278 void serv_change_passwd(char *orig, char *new) { | 285 void serv_change_passwd(char *orig, char *new) { |
| 279 /* FIXME */ | 286 /* FIXME: passwords are the kinds of things you don't want randomly changed; |
| 287 * this whole thing is commented out :-P | |
| 280 struct gaim_connection *g = connections->data; | 288 struct gaim_connection *g = connections->data; |
| 281 if (g->protocol == PROTO_TOC) { | 289 if (g->protocol == PROTO_TOC) { |
| 282 char *buf = g_malloc(BUF_LONG); | 290 char *buf = g_malloc(BUF_LONG); |
| 283 g_snprintf(buf, BUF_LONG, "toc_change_passwd %s %s", orig, new); | 291 g_snprintf(buf, BUF_LONG, "toc_change_passwd %s %s", orig, new); |
| 284 sflap_send(g, buf, strlen(buf), TYPE_DATA); | 292 sflap_send(g, buf, strlen(buf), TYPE_DATA); |
| 285 g_free(buf); | 293 g_free(buf); |
| 286 } else if (g->protocol == PROTO_OSCAR) { | 294 } else if (g->protocol == PROTO_OSCAR) { |
| 287 /* Oscar change_passwd FIXME */ | 295 Oscar change_passwd FIXME |
| 288 } | 296 } |
| 297 */ | |
| 289 } | 298 } |
| 290 | 299 |
| 291 void serv_add_buddy(char *name) | 300 void serv_add_buddy(char *name) |
| 292 { | 301 { |
| 293 /* FIXME */ | 302 /* FIXME: this will need to be changed. for now all buddies will be added to |
| 294 struct gaim_connection *g = connections->data; | 303 * all connections :-P */ |
| 295 if (g->protocol == PROTO_TOC) { | 304 GSList *c = connections; |
| 296 char buf[1024]; | 305 struct gaim_connection *g; |
| 297 g_snprintf(buf, sizeof(buf), "toc_add_buddy %s", normalize(name)); | 306 |
| 298 sflap_send(g, buf, -1, TYPE_DATA); | 307 while (c) { |
| 299 } else if (g->protocol == PROTO_OSCAR) { | 308 g = (struct gaim_connection *)c->data; |
| 300 aim_add_buddy(g->oscar_sess, g->oscar_conn, name); | 309 if (g->protocol == PROTO_TOC) { |
| 310 char buf[1024]; | |
| 311 g_snprintf(buf, sizeof(buf), "toc_add_buddy %s", normalize(name)); | |
| 312 sflap_send(g, buf, -1, TYPE_DATA); | |
| 313 } else if (g->protocol == PROTO_OSCAR) { | |
| 314 aim_add_buddy(g->oscar_sess, g->oscar_conn, name); | |
| 315 } | |
| 316 c = c->next; | |
| 301 } | 317 } |
| 302 } | 318 } |
| 303 | 319 |
| 304 void serv_add_buddies(GList *buddies) | 320 void serv_add_buddies(GList *buddies) |
| 305 { | 321 { |
| 306 /* FIXME */ | 322 /* FIXME: see the comment above for adding one buddy :-P */ |
| 307 struct gaim_connection *g = connections->data; | 323 GSList *c = connections; |
| 308 if (g->protocol == PROTO_TOC) { | 324 struct gaim_connection *g; |
| 309 char buf[MSG_LEN]; | 325 |
| 310 int n, num = 0; | 326 while (c) { |
| 311 | 327 g = (struct gaim_connection *)c->data; |
| 312 n = g_snprintf(buf, sizeof(buf), "toc_add_buddy"); | 328 if (g->protocol == PROTO_TOC) { |
| 313 while(buddies) { | 329 char buf[MSG_LEN]; |
| 314 /* i don't know why we choose 8, it just seems good */ | 330 int n, num = 0; |
| 315 if (strlen(normalize(buddies->data)) > MSG_LEN - n - 8) { | 331 |
| 316 sflap_send(g, buf, -1, TYPE_DATA); | 332 n = g_snprintf(buf, sizeof(buf), "toc_add_buddy"); |
| 317 n = g_snprintf(buf, sizeof(buf), "toc_add_buddy"); | 333 while(buddies) { |
| 318 num = 0; | 334 /* i don't know why we choose 8, it just seems good */ |
| 319 } | 335 if (strlen(normalize(buddies->data)) > MSG_LEN - n - 8) { |
| 320 ++num; | 336 sflap_send(g, buf, -1, TYPE_DATA); |
| 321 n += g_snprintf(buf + n, sizeof(buf) - n, " %s", normalize(buddies->data)); | 337 n = g_snprintf(buf, sizeof(buf), "toc_add_buddy"); |
| 322 buddies = buddies->next; | 338 num = 0; |
| 323 } | 339 } |
| 324 sflap_send(g, buf, -1, TYPE_DATA); | 340 ++num; |
| 325 } else if (g->protocol == PROTO_OSCAR) { | 341 n += g_snprintf(buf + n, sizeof(buf)-n, " %s", normalize(buddies->data)); |
| 326 char buf[MSG_LEN]; | 342 buddies = buddies->next; |
| 327 int n = 0; | |
| 328 while(buddies) { | |
| 329 if (n > MSG_LEN - 18) { | |
| 330 aim_bos_setbuddylist(g->oscar_sess, g->oscar_conn, buf); | |
| 331 n = 0; | |
| 332 } | 343 } |
| 333 n += g_snprintf(buf + n, sizeof(buf) - n, "%s&", | 344 sflap_send(g, buf, -1, TYPE_DATA); |
| 334 (char *)buddies->data); | 345 } else if (g->protocol == PROTO_OSCAR) { |
| 335 buddies = buddies->next; | 346 char buf[MSG_LEN]; |
| 336 } | 347 int n = 0; |
| 337 aim_bos_setbuddylist(g->oscar_sess, g->oscar_conn, buf); | 348 while(buddies) { |
| 349 if (n > MSG_LEN - 18) { | |
| 350 aim_bos_setbuddylist(g->oscar_sess, g->oscar_conn, buf); | |
| 351 n = 0; | |
| 352 } | |
| 353 n += g_snprintf(buf + n, sizeof(buf) - n, "%s&", | |
| 354 (char *)buddies->data); | |
| 355 buddies = buddies->next; | |
| 356 } | |
| 357 aim_bos_setbuddylist(g->oscar_sess, g->oscar_conn, buf); | |
| 358 } | |
| 359 c = c->next; | |
| 338 } | 360 } |
| 339 } | 361 } |
| 340 | 362 |
| 341 | 363 |
| 342 void serv_remove_buddy(char *name) | 364 void serv_remove_buddy(char *name) |
| 343 { | 365 { |
| 344 /* FIXME */ | 366 /* FIXME: since we added them to all conns, we need to remove them from all conns */ |
| 345 struct gaim_connection *g = connections->data; | 367 GSList *c = connections; |
| 346 if (g->protocol == PROTO_TOC) { | 368 struct gaim_connection *g; |
| 347 char buf[1024]; | 369 |
| 348 g_snprintf(buf, sizeof(buf), "toc_remove_buddy %s", normalize(name)); | 370 while (c) { |
| 349 sflap_send(g, buf, -1, TYPE_DATA); | 371 g = (struct gaim_connection *)c->data; |
| 350 } else if (g->protocol == PROTO_OSCAR) { | 372 if (g->protocol == PROTO_TOC) { |
| 351 aim_remove_buddy(g->oscar_sess, g->oscar_conn, name); | 373 char buf[1024]; |
| 374 g_snprintf(buf, sizeof(buf), "toc_remove_buddy %s", normalize(name)); | |
| 375 sflap_send(g, buf, -1, TYPE_DATA); | |
| 376 } else if (g->protocol == PROTO_OSCAR) { | |
| 377 aim_remove_buddy(g->oscar_sess, g->oscar_conn, name); | |
| 378 } | |
| 379 c = c->next; | |
| 352 } | 380 } |
| 353 } | 381 } |
| 354 | 382 |
| 355 void serv_add_permit(char *name) | 383 void serv_add_permit(char *name) |
| 356 { | 384 { |
| 475 aim_bos_setidle(g->oscar_sess, g->oscar_conn, time); | 503 aim_bos_setidle(g->oscar_sess, g->oscar_conn, time); |
| 476 } | 504 } |
| 477 } | 505 } |
| 478 | 506 |
| 479 | 507 |
| 480 void serv_warn(char *name, int anon) | 508 void serv_warn(struct gaim_connection *g, char *name, int anon) |
| 481 { | 509 { |
| 482 /* FIXME */ | |
| 483 struct gaim_connection *g = connections->data; | |
| 484 if (g->protocol == PROTO_TOC) { | 510 if (g->protocol == PROTO_TOC) { |
| 485 char *send = g_malloc(256); | 511 char *send = g_malloc(256); |
| 486 g_snprintf(send, 255, "toc_evil %s %s", name, | 512 g_snprintf(send, 255, "toc_evil %s %s", name, |
| 487 ((anon) ? "anon" : "norm")); | 513 ((anon) ? "anon" : "norm")); |
| 488 sflap_send(g, send, -1, TYPE_DATA); | 514 sflap_send(g, send, -1, TYPE_DATA); |
