about summary refs log tree commit diff stats
path: root/src/xmpp
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2014-09-21 00:22:03 +0100
committerJames Booth <boothj5@gmail.com>2014-09-21 00:22:03 +0100
commit06856ecea1d4df06549de9a84ea61f800655441b (patch)
tree3f63270b0a7efca870b5f0d7daf20fad27a84718 /src/xmpp
parentae08e820d9e4c7802211b4a1bfbcc3513949919f (diff)
downloadprofani-tty-06856ecea1d4df06549de9a84ea61f800655441b.tar.gz
Removed _get_caps_key function
Diffstat (limited to 'src/xmpp')
-rw-r--r--src/xmpp/presence.c66
1 files changed, 5 insertions, 61 deletions
diff --git a/src/xmpp/presence.c b/src/xmpp/presence.c
index ff5e5982..a4cc549e 100644
--- a/src/xmpp/presence.c
+++ b/src/xmpp/presence.c
@@ -70,9 +70,8 @@ static int _muc_user_handler(xmpp_conn_t * const conn,
 static int _presence_error_handler(xmpp_conn_t * const conn,
     xmpp_stanza_t * const stanza, void * const userdata);
 
-static char* _get_caps_key(xmpp_stanza_t * const stanza);
-static void _send_room_presence(xmpp_conn_t *conn, xmpp_stanza_t *presence);
 void _send_caps_request(char *node, char *caps_key, char *id, char *from);
+static void _send_room_presence(xmpp_conn_t *conn, xmpp_stanza_t *presence);
 
 void
 presence_sub_requests_init(void)
@@ -667,55 +666,6 @@ _send_caps_request(char *node, char *caps_key, char *id, char *from)
         log_debug("No node string, not sending discovery IQ.");
     }
 }
-
-static char *
-_get_caps_key(xmpp_stanza_t * const stanza)
-{
-    char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
-    char *hash_type = stanza_caps_get_hash(stanza);
-    char *node = stanza_get_caps_str(stanza);
-    char *caps_key = NULL;
-    char *id = NULL;
-
-    if (node == NULL) {
-        return NULL;
-    }
-
-    // xep-0115
-    if ((hash_type != NULL) && (strcmp(hash_type, "sha-1") == 0)) {
-        log_debug("Hash type %s supported.", hash_type);
-        caps_key = strdup(node);
-        id = create_unique_id("caps");
-
-        _send_caps_request(node, caps_key, id, from);
-        free(id);
-
-    // unsupported hash or legacy capabilities
-    } else {
-        if (hash_type != NULL) {
-            log_debug("Hash type %s unsupported.", hash_type);
-        } else {
-            log_debug("No hash type, using legacy capabilities.");
-        }
-
-        guint from_hash = g_str_hash(from);
-        char from_hash_str[9];
-        g_snprintf(from_hash_str, sizeof(from_hash_str), "%08x", from_hash);
-        caps_key = strdup(from_hash_str);
-        GString *id_str = g_string_new("capsreq_");
-        g_string_append(id_str, from_hash_str);
-        id = id_str->str;
-
-        _send_caps_request(node, caps_key, id, from);
-
-        g_string_free(id_str, TRUE);
-    }
-
-    g_free(node);
-
-    return caps_key;
-}
-
 static int
 _muc_user_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza,
     void * const userdata)
@@ -768,11 +718,6 @@ _muc_user_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza,
         char *type = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_TYPE);
         char *status_str;
 
-        char *caps_key = NULL;
-        if (stanza_contains_caps(stanza)) {
-            caps_key = _get_caps_key(stanza);
-        }
-
         log_debug("Room presence received from %s", from_jid->fulljid);
 
         status_str = stanza_get_status(stanza, NULL);
@@ -792,19 +737,19 @@ _muc_user_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza,
         } else {
             char *show_str = stanza_get_show(stanza, "online");
             if (!muc_get_roster_received(from_room)) {
-                muc_add_to_roster(from_room, from_nick, show_str, status_str, caps_key);
+                muc_add_to_roster(from_room, from_nick, show_str, status_str);
             } else {
                 char *old_nick = muc_complete_roster_nick_change(from_room, from_nick);
 
                 if (old_nick != NULL) {
-                    muc_add_to_roster(from_room, from_nick, show_str, status_str, caps_key);
+                    muc_add_to_roster(from_room, from_nick, show_str, status_str);
                     handle_room_member_nick_change(from_room, old_nick, from_nick);
                     free(old_nick);
                 } else {
                     if (!muc_nick_in_roster(from_room, from_nick)) {
-                        handle_room_member_online(from_room, from_nick, show_str, status_str, caps_key);
+                        handle_room_member_online(from_room, from_nick, show_str, status_str);
                     } else {
-                        handle_room_member_presence(from_room, from_nick, show_str, status_str, caps_key);
+                        handle_room_member_presence(from_room, from_nick, show_str, status_str);
                     }
                 }
             }
@@ -813,7 +758,6 @@ _muc_user_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza,
         }
 
         free(status_str);
-        free(caps_key);
     }
 
     jid_destroy(from_jid);
f='#n331'>331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539