comparison src/protocols/msn/slp.c @ 9198:ab6636c5a136

[gaim-migrate @ 9993] Updated all the copyright headers for all the *.[ch] files -- all 63. No fun, but I receive great satisfaction in knowing that you all have to recompile this, again. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Sun, 06 Jun 2004 03:42:55 +0000
parents 502707ca1836
children 7a00289f2ef1
comparison
equal deleted inserted replaced
9197:ec417d2f9666 9198:ab6636c5a136
1 /** 1 /**
2 * @file msnslp.c MSNSLP support 2 * @file msnslp.c MSNSLP support
3 * 3 *
4 * gaim 4 * gaim
5 * 5 *
6 * Copyright (C) 2003 Christian Hammond <chipx86@gnupdate.org> 6 * Gaim is the legal property of its developers, whose names are too numerous
7 * to list here. Please refer to the COPYRIGHT file distributed with this
8 * source distribution.
7 * 9 *
8 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by 11 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or 12 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version. 13 * (at your option) any later version.
54 56
55 if (end != NULL) 57 if (end != NULL)
56 { 58 {
57 if ((c2 = strstr(c, end)) == NULL) 59 if ((c2 = strstr(c, end)) == NULL)
58 return NULL; 60 return NULL;
59 61
60 return g_strndup(c, c2 - c); 62 return g_strndup(c, c2 - c);
61 } 63 }
62 else 64 else
63 { 65 {
64 /* This has to be changed */ 66 /* This has to be changed */
125 void 127 void
126 msn_xfer_progress_cb(MsnSlpCall *slpcall, gsize total_length, gsize len, gsize offset) 128 msn_xfer_progress_cb(MsnSlpCall *slpcall, gsize total_length, gsize len, gsize offset)
127 { 129 {
128 GaimXfer *xfer; 130 GaimXfer *xfer;
129 131
130 xfer = slpcall->xfer; 132 xfer = slpcall->xfer;
131 133
132 xfer->bytes_sent = offset; 134 xfer->bytes_sent = offset;
133 xfer->bytes_remaining = total_length - offset; 135 xfer->bytes_remaining = total_length - offset;
134 136
135 gaim_xfer_update_progress(xfer); 137 gaim_xfer_update_progress(xfer);
255 gaim_base64_decode(context, &msnobj_data, &len); 257 gaim_base64_decode(context, &msnobj_data, &len);
256 obj = msn_object_new_from_string(msnobj_data); 258 obj = msn_object_new_from_string(msnobj_data);
257 type = msn_object_get_type(obj); 259 type = msn_object_get_type(obj);
258 sha1c = msn_object_get_sha1c(obj); 260 sha1c = msn_object_get_sha1c(obj);
259 g_free(msnobj_data); 261 g_free(msnobj_data);
260 262
261 if (!(type == MSN_OBJECT_USERTILE)) 263 if (!(type == MSN_OBJECT_USERTILE))
262 { 264 {
263 gaim_debug_error("msn", "Wrong object?\n"); 265 gaim_debug_error("msn", "Wrong object?\n");
264 msn_object_destroy(obj); 266 msn_object_destroy(obj);
265 g_return_if_reached(); 267 g_return_if_reached();
266 } 268 }
267 269
268 file_name = msn_object_get_real_location(obj); 270 file_name = msn_object_get_real_location(obj);
269 271
270 slpsession = msn_slplink_find_slp_session(slplink, 272 slpsession = msn_slplink_find_slp_session(slplink,
271 slpcall->session_id); 273 slpcall->session_id);
272 274
273 /* DATA PREP */ 275 /* DATA PREP */
274 slpmsg = msn_slpmsg_new(slplink); 276 slpmsg = msn_slpmsg_new(slplink);
275 slpmsg->slpsession = slpsession; 277 slpmsg->slpsession = slpsession;
276 slpmsg->session_id = slpsession->id; 278 slpmsg->session_id = slpsession->id;
277 msn_slpmsg_set_body(slpmsg, NULL, 4); 279 msn_slpmsg_set_body(slpmsg, NULL, 4);
280 #endif 282 #endif
281 msn_slplink_queue_slpmsg(slplink, slpmsg); 283 msn_slplink_queue_slpmsg(slplink, slpmsg);
282 284
283 /* DATA */ 285 /* DATA */
284 slpmsg = msn_slpmsg_new(slplink); 286 slpmsg = msn_slpmsg_new(slplink);
285 slpmsg->slpsession = slpsession; 287 slpmsg->slpsession = slpsession;
286 slpmsg->flags = 0x20; 288 slpmsg->flags = 0x20;
287 #ifdef DEBUG_SLP 289 #ifdef DEBUG_SLP
288 slpmsg->info = "SLP DATA"; 290 slpmsg->info = "SLP DATA";
289 #endif 291 #endif
290 msn_slpmsg_open_file(slpmsg, file_name); 292 msn_slpmsg_open_file(slpmsg, file_name);
379 381
380 temp = get_token(content, "AppID: ", "\r\n"); 382 temp = get_token(content, "AppID: ", "\r\n");
381 if (temp != NULL) 383 if (temp != NULL)
382 slpcall->app_id = atoi(temp); 384 slpcall->app_id = atoi(temp);
383 g_free(temp); 385 g_free(temp);
384 386
385 context = get_token(content, "Context: ", "\r\n"); 387 context = get_token(content, "Context: ", "\r\n");
386 388
387 got_sessionreq(slpcall, branch, euf_guid, context); 389 got_sessionreq(slpcall, branch, euf_guid, context);
388 390
389 g_free(context); 391 g_free(context);
390 g_free(euf_guid); 392 g_free(euf_guid);
391 } 393 }
392 else if (!strcmp(type, "application/x-msnmsgr-transreqbody")) 394 else if (!strcmp(type, "application/x-msnmsgr-transreqbody"))
393 { 395 {
394 /* A direct connection? */ 396 /* A direct connection? */
395 397
396 char *listening, *nonce; 398 char *listening, *nonce;
397 char *content; 399 char *content;
398 400
399 if (FALSE) 401 if (FALSE)
400 { 402 {
401 #if 0 403 #if 0
402 MsnDirectConn *directconn; 404 MsnDirectConn *directconn;
403 /* const char *ip_addr; */ 405 /* const char *ip_addr; */
432 } 434 }
433 else 435 else
434 { 436 {
435 listening = "false"; 437 listening = "false";
436 nonce = g_strdup("00000000-0000-0000-0000-000000000000"); 438 nonce = g_strdup("00000000-0000-0000-0000-000000000000");
437 439
438 content = g_strdup_printf( 440 content = g_strdup_printf(
439 "Bridge: TCPv1\r\n" 441 "Bridge: TCPv1\r\n"
440 "Listening: %s\r\n" 442 "Listening: %s\r\n"
441 "Nonce: {%s}\r\n" 443 "Nonce: {%s}\r\n"
442 "\r\n", 444 "\r\n",
455 #if 0 457 #if 0
456 char *ip_addrs; 458 char *ip_addrs;
457 char *temp; 459 char *temp;
458 char *nonce; 460 char *nonce;
459 int port; 461 int port;
460 462
461 nonce = get_token(content, "Nonce: {", "}\r\n"); 463 nonce = get_token(content, "Nonce: {", "}\r\n");
462 ip_addrs = get_token(content, "IPv4Internal-Addrs: ", "\r\n"); 464 ip_addrs = get_token(content, "IPv4Internal-Addrs: ", "\r\n");
463 465
464 temp = get_token(content, "IPv4Internal-Port: ", "\r\n"); 466 temp = get_token(content, "IPv4Internal-Port: ", "\r\n");
465 if (temp != NULL) 467 if (temp != NULL)
484 got_ok(MsnSlpCall *slpcall, 486 got_ok(MsnSlpCall *slpcall,
485 const char *type, const char *content) 487 const char *type, const char *content)
486 { 488 {
487 g_return_if_fail(slpcall != NULL); 489 g_return_if_fail(slpcall != NULL);
488 g_return_if_fail(type != NULL); 490 g_return_if_fail(type != NULL);
489 491
490 if (!strcmp(type, "application/x-msnmsgr-sessionreqbody")) 492 if (!strcmp(type, "application/x-msnmsgr-sessionreqbody"))
491 { 493 {
492 #if 0 494 #if 0
493 if (slpcall->type == MSN_SLPCALL_DC) 495 if (slpcall->type == MSN_SLPCALL_DC)
494 { 496 {
525 #endif 527 #endif
526 msn_slplink_send_slpmsg(slplink, slpmsg); 528 msn_slplink_send_slpmsg(slplink, slpmsg);
527 529
528 g_free(header); 530 g_free(header);
529 g_free(content); 531 g_free(content);
530 532
531 g_free(branch); 533 g_free(branch);
532 } 534 }
533 else 535 else
534 { 536 {
535 msn_slp_call_session_init(slpcall); 537 msn_slp_call_session_init(slpcall);
548 #if 0 550 #if 0
549 char *ip_addrs; 551 char *ip_addrs;
550 char *temp; 552 char *temp;
551 char *nonce; 553 char *nonce;
552 int port; 554 int port;
553 555
554 nonce = get_token(content, "Nonce: {", "}\r\n"); 556 nonce = get_token(content, "Nonce: {", "}\r\n");
555 ip_addrs = get_token(content, "IPv4Internal-Addrs: ", "\r\n"); 557 ip_addrs = get_token(content, "IPv4Internal-Addrs: ", "\r\n");
556 558
557 temp = get_token(content, "IPv4Internal-Port: ", "\r\n"); 559 temp = get_token(content, "IPv4Internal-Port: ", "\r\n");
558 if (temp != NULL) 560 if (temp != NULL)
635 (c = strchr(status, '\0'))) 637 (c = strchr(status, '\0')))
636 { 638 {
637 strncpy(temp, status, c - status); 639 strncpy(temp, status, c - status);
638 temp[c - status] = '\0'; 640 temp[c - status] = '\0';
639 } 641 }
640 642
641 gaim_debug_error("msn", "Received non-OK result: %s\n", temp); 643 gaim_debug_error("msn", "Received non-OK result: %s\n", temp);
642 644
643 slpcall->wasted = TRUE; 645 slpcall->wasted = TRUE;
644 646
645 /* msn_slp_call_destroy(slpcall); */ 647 /* msn_slp_call_destroy(slpcall); */
739 741
740 info = slpcall->data_info; 742 info = slpcall->data_info;
741 gaim_debug_info("msn", "Got User Display: %s\n", info); 743 gaim_debug_info("msn", "Got User Display: %s\n", info);
742 744
743 account = slpcall->slplink->session->account; 745 account = slpcall->slplink->session->account;
744 746
745 /* TODO: I think we need better buddy icon core functions. */ 747 /* TODO: I think we need better buddy icon core functions. */
746 gaim_buddy_icons_set_for_user(account, slpcall->slplink->remote_user, 748 gaim_buddy_icons_set_for_user(account, slpcall->slplink->remote_user,
747 (void *)data, size); 749 (void *)data, size);
748 750
749 sl = gaim_find_buddies(account, slpcall->slplink->remote_user); 751 sl = gaim_find_buddies(account, slpcall->slplink->remote_user);
775 { 777 {
776 return FALSE; 778 return FALSE;
777 } 779 }
778 780
779 buddy = (GaimBuddy *)sl->data; 781 buddy = (GaimBuddy *)sl->data;
780 782
781 old = gaim_blist_node_get_string((GaimBlistNode *)buddy, "icon_checksum"); 783 old = gaim_blist_node_get_string((GaimBlistNode *)buddy, "icon_checksum");
782 new = msn_object_get_sha1c(obj); 784 new = msn_object_get_sha1c(obj);
783 785
784 if (new == NULL) 786 if (new == NULL)
785 { 787 {