comparison mcabber/mcabber/xmpp.c @ 1866:e45d13074721

s/jep/xep/ Esp. used for chat states. Bump API to 13:13
author Mikael Berthe <mikael@lilotux.net>
date Sat, 03 Apr 2010 21:58:56 +0200
parents 4694fad35ed8
children fe385f2cfb93
comparison
equal deleted inserted replaced
1865:e9773bd9dd2e 1866:e45d13074721
321 char *rname, *barejid; 321 char *rname, *barejid;
322 GSList *sl_buddy; 322 GSList *sl_buddy;
323 #endif 323 #endif
324 #if defined XEP0022 || defined XEP0085 324 #if defined XEP0022 || defined XEP0085
325 LmMessageNode *event; 325 LmMessageNode *event;
326 guint use_jep85 = 0; 326 guint use_xep85 = 0;
327 struct jep0085 *jep85 = NULL; 327 struct xep0085 *xep85 = NULL;
328 #endif 328 #endif
329 gchar *enc = NULL; 329 gchar *enc = NULL;
330 330
331 if (encrypted) 331 if (encrypted)
332 *encrypted = 0; 332 *encrypted = 0;
436 // If typing notifications are disabled, we can skip all this stuff... 436 // If typing notifications are disabled, we can skip all this stuff...
437 if (chatstates_disabled || type == ROSTER_TYPE_ROOM) 437 if (chatstates_disabled || type == ROSTER_TYPE_ROOM)
438 goto xmpp_send_msg_no_chatstates; 438 goto xmpp_send_msg_no_chatstates;
439 439
440 if (sl_buddy) 440 if (sl_buddy)
441 jep85 = buddy_resource_jep85(sl_buddy->data, rname); 441 xep85 = buddy_resource_xep85(sl_buddy->data, rname);
442 #endif 442 #endif
443 443
444 #ifdef XEP0085 444 #ifdef XEP0085
445 /* XEP-0085 5.1 445 /* XEP-0085 5.1
446 * "Until receiving a reply to the initial content message (or a standalone 446 * "Until receiving a reply to the initial content message (or a standalone
447 * notification) from the Contact, the User MUST NOT send subsequent chat 447 * notification) from the Contact, the User MUST NOT send subsequent chat
448 * state notifications to the Contact." 448 * state notifications to the Contact."
449 * In our implementation support is initially "unknown", then it's "probed" 449 * In our implementation support is initially "unknown", then it's "probed"
450 * and can become "ok". 450 * and can become "ok".
451 */ 451 */
452 if (jep85 && (jep85->support == CHATSTATES_SUPPORT_OK || 452 if (xep85 && (xep85->support == CHATSTATES_SUPPORT_OK ||
453 jep85->support == CHATSTATES_SUPPORT_UNKNOWN)) { 453 xep85->support == CHATSTATES_SUPPORT_UNKNOWN)) {
454 event = lm_message_node_add_child(x->node, "active", NULL); 454 event = lm_message_node_add_child(x->node, "active", NULL);
455 lm_message_node_set_attribute(event, "xmlns", NS_CHATSTATES); 455 lm_message_node_set_attribute(event, "xmlns", NS_CHATSTATES);
456 if (jep85->support == CHATSTATES_SUPPORT_UNKNOWN) 456 if (xep85->support == CHATSTATES_SUPPORT_UNKNOWN)
457 jep85->support = CHATSTATES_SUPPORT_PROBED; 457 xep85->support = CHATSTATES_SUPPORT_PROBED;
458 else 458 else
459 use_jep85 = 1; 459 use_xep85 = 1;
460 jep85->last_state_sent = ROSTER_EVENT_ACTIVE; 460 xep85->last_state_sent = ROSTER_EVENT_ACTIVE;
461 } 461 }
462 #endif 462 #endif
463 #ifdef XEP0022 463 #ifdef XEP0022
464 /* XEP-22 464 /* XEP-22
465 * If the Contact supports XEP-0085, we do not use XEP-0022. 465 * If the Contact supports XEP-0085, we do not use XEP-0022.
466 * If not, we try to fall back to XEP-0022. 466 * If not, we try to fall back to XEP-0022.
467 */ 467 */
468 if (!use_jep85) { 468 if (!use_xep85) {
469 struct jep0022 *jep22 = NULL; 469 struct xep0022 *xep22 = NULL;
470 event = lm_message_node_add_child(x->node, "x", NULL); 470 event = lm_message_node_add_child(x->node, "x", NULL);
471 lm_message_node_set_attribute(event, "xmlns", NS_EVENT); 471 lm_message_node_set_attribute(event, "xmlns", NS_EVENT);
472 lm_message_node_add_child(event, "composing", NULL); 472 lm_message_node_add_child(event, "composing", NULL);
473 473
474 if (sl_buddy) 474 if (sl_buddy)
475 jep22 = buddy_resource_jep22(sl_buddy->data, rname); 475 xep22 = buddy_resource_xep22(sl_buddy->data, rname);
476 if (jep22) 476 if (xep22)
477 jep22->last_state_sent = ROSTER_EVENT_ACTIVE; 477 xep22->last_state_sent = ROSTER_EVENT_ACTIVE;
478 478
479 // An id is mandatory when using XEP-0022. 479 // An id is mandatory when using XEP-0022.
480 if (text || subject) { 480 if (text || subject) {
481 const gchar *msgid = lm_message_get_id(x); 481 const gchar *msgid = lm_message_get_id(x);
482 // Let's update last_msgid_sent 482 // Let's update last_msgid_sent
483 if (jep22) { 483 if (xep22) {
484 g_free(jep22->last_msgid_sent); 484 g_free(xep22->last_msgid_sent);
485 jep22->last_msgid_sent = g_strdup(msgid); 485 xep22->last_msgid_sent = g_strdup(msgid);
486 } 486 }
487 } 487 }
488 } 488 }
489 #endif 489 #endif
490 490
498 lm_connection_send(lconnection, x, NULL); 498 lm_connection_send(lconnection, x, NULL);
499 lm_message_unref(x); 499 lm_message_unref(x);
500 } 500 }
501 501
502 #ifdef XEP0085 502 #ifdef XEP0085
503 // xmpp_send_jep85_chatstate() 503 // xmpp_send_xep85_chatstate()
504 // Send a XEP-85 chatstate. 504 // Send a XEP-85 chatstate.
505 static void xmpp_send_jep85_chatstate(const char *bjid, const char *resname, 505 static void xmpp_send_xep85_chatstate(const char *bjid, const char *resname,
506 guint state) 506 guint state)
507 { 507 {
508 LmMessage *m; 508 LmMessage *m;
509 LmMessageNode *event; 509 LmMessageNode *event;
510 GSList *sl_buddy; 510 GSList *sl_buddy;
511 const char *chattag; 511 const char *chattag;
512 char *rjid, *fjid = NULL; 512 char *rjid, *fjid = NULL;
513 struct jep0085 *jep85 = NULL; 513 struct xep0085 *xep85 = NULL;
514 514
515 if (!xmpp_is_online()) 515 if (!xmpp_is_online())
516 return; 516 return;
517 517
518 sl_buddy = roster_find(bjid, jidsearch, ROSTER_TYPE_USER); 518 sl_buddy = roster_find(bjid, jidsearch, ROSTER_TYPE_USER);
519 519
520 // If we have a resource name, we use it. Else we use NULL, 520 // If we have a resource name, we use it. Else we use NULL,
521 // which hopefully will give us the most likely resource. 521 // which hopefully will give us the most likely resource.
522 if (sl_buddy) 522 if (sl_buddy)
523 jep85 = buddy_resource_jep85(sl_buddy->data, resname); 523 xep85 = buddy_resource_xep85(sl_buddy->data, resname);
524 524
525 if (!jep85 || (jep85->support != CHATSTATES_SUPPORT_OK)) 525 if (!xep85 || (xep85->support != CHATSTATES_SUPPORT_OK))
526 return; 526 return;
527 527
528 if (state == jep85->last_state_sent) 528 if (state == xep85->last_state_sent)
529 return; 529 return;
530 530
531 if (state == ROSTER_EVENT_ACTIVE) 531 if (state == ROSTER_EVENT_ACTIVE)
532 chattag = "active"; 532 chattag = "active";
533 else if (state == ROSTER_EVENT_COMPOSING) 533 else if (state == ROSTER_EVENT_COMPOSING)
537 else { 537 else {
538 scr_LogPrint(LPRINT_LOGNORM, "Error: unsupported XEP-85 state (%d)", state); 538 scr_LogPrint(LPRINT_LOGNORM, "Error: unsupported XEP-85 state (%d)", state);
539 return; 539 return;
540 } 540 }
541 541
542 jep85->last_state_sent = state; 542 xep85->last_state_sent = state;
543 543
544 if (resname) 544 if (resname)
545 fjid = g_strdup_printf("%s/%s", bjid, resname); 545 fjid = g_strdup_printf("%s/%s", bjid, resname);
546 546
547 rjid = resname ? fjid : (char*)bjid; 547 rjid = resname ? fjid : (char*)bjid;
557 g_free(fjid); 557 g_free(fjid);
558 } 558 }
559 #endif 559 #endif
560 560
561 #ifdef XEP0022 561 #ifdef XEP0022
562 // xmpp_send_jep22_event() 562 // xmpp_send_xep22_event()
563 // Send a XEP-22 message event (delivered, composing...). 563 // Send a XEP-22 message event (delivered, composing...).
564 static void xmpp_send_jep22_event(const char *fjid, guint type) 564 static void xmpp_send_xep22_event(const char *fjid, guint type)
565 { 565 {
566 LmMessage *x; 566 LmMessage *x;
567 LmMessageNode *event; 567 LmMessageNode *event;
568 const char *msgid; 568 const char *msgid;
569 char *rname, *barejid; 569 char *rname, *barejid;
570 GSList *sl_buddy; 570 GSList *sl_buddy;
571 struct jep0022 *jep22 = NULL; 571 struct xep0022 *xep22 = NULL;
572 guint jep22_state; 572 guint xep22_state;
573 573
574 if (!xmpp_is_online()) 574 if (!xmpp_is_online())
575 return; 575 return;
576 576
577 rname = strchr(fjid, JID_RESOURCE_SEPARATOR); 577 rname = strchr(fjid, JID_RESOURCE_SEPARATOR);
582 // If we can get a resource name, we use it. Else we use NULL, 582 // If we can get a resource name, we use it. Else we use NULL,
583 // which hopefully will give us the most likely resource. 583 // which hopefully will give us the most likely resource.
584 if (rname) 584 if (rname)
585 rname++; 585 rname++;
586 if (sl_buddy) 586 if (sl_buddy)
587 jep22 = buddy_resource_jep22(sl_buddy->data, rname); 587 xep22 = buddy_resource_xep22(sl_buddy->data, rname);
588 588
589 if (!jep22) 589 if (!xep22)
590 return; // XXX Maybe we could try harder (other resources?) 590 return; // XXX Maybe we could try harder (other resources?)
591 591
592 msgid = jep22->last_msgid_rcvd; 592 msgid = xep22->last_msgid_rcvd;
593 593
594 // For composing events (composing, active, inactive, paused...), 594 // For composing events (composing, active, inactive, paused...),
595 // XEP22 only has 2 states; we'll use composing and active. 595 // XEP22 only has 2 states; we'll use composing and active.
596 if (type == ROSTER_EVENT_COMPOSING) 596 if (type == ROSTER_EVENT_COMPOSING)
597 jep22_state = ROSTER_EVENT_COMPOSING; 597 xep22_state = ROSTER_EVENT_COMPOSING;
598 else if (type == ROSTER_EVENT_ACTIVE || 598 else if (type == ROSTER_EVENT_ACTIVE ||
599 type == ROSTER_EVENT_PAUSED) 599 type == ROSTER_EVENT_PAUSED)
600 jep22_state = ROSTER_EVENT_ACTIVE; 600 xep22_state = ROSTER_EVENT_ACTIVE;
601 else 601 else
602 jep22_state = 0; // ROSTER_EVENT_NONE 602 xep22_state = 0; // ROSTER_EVENT_NONE
603 603
604 if (jep22_state) { 604 if (xep22_state) {
605 // Do not re-send a same event 605 // Do not re-send a same event
606 if (jep22_state == jep22->last_state_sent) 606 if (xep22_state == xep22->last_state_sent)
607 return; 607 return;
608 jep22->last_state_sent = jep22_state; 608 xep22->last_state_sent = xep22_state;
609 } 609 }
610 610
611 x = lm_message_new_with_sub_type(fjid, LM_MESSAGE_TYPE_MESSAGE, 611 x = lm_message_new_with_sub_type(fjid, LM_MESSAGE_TYPE_MESSAGE,
612 LM_MESSAGE_SUB_TYPE_CHAT); 612 LM_MESSAGE_SUB_TYPE_CHAT);
613 613
631 void xmpp_send_chatstate(gpointer buddy, guint chatstate) 631 void xmpp_send_chatstate(gpointer buddy, guint chatstate)
632 { 632 {
633 const char *bjid; 633 const char *bjid;
634 #ifdef XEP0085 634 #ifdef XEP0085
635 GSList *resources, *p_res, *p_next; 635 GSList *resources, *p_res, *p_next;
636 struct jep0085 *jep85 = NULL; 636 struct xep0085 *xep85 = NULL;
637 #endif 637 #endif
638 #ifdef XEP0022 638 #ifdef XEP0022
639 struct jep0022 *jep22; 639 struct xep0022 *xep22;
640 #endif 640 #endif
641 641
642 bjid = buddy_getjid(buddy); 642 bjid = buddy_getjid(buddy);
643 if (!bjid) return; 643 if (!bjid) return;
644 644
649 which do not curently have this state. 649 which do not curently have this state.
650 */ 650 */
651 resources = buddy_getresources(buddy); 651 resources = buddy_getresources(buddy);
652 for (p_res = resources ; p_res ; p_res = p_next) { 652 for (p_res = resources ; p_res ; p_res = p_next) {
653 p_next = g_slist_next(p_res); 653 p_next = g_slist_next(p_res);
654 jep85 = buddy_resource_jep85(buddy, p_res->data); 654 xep85 = buddy_resource_xep85(buddy, p_res->data);
655 if (jep85 && jep85->support == CHATSTATES_SUPPORT_OK) { 655 if (xep85 && xep85->support == CHATSTATES_SUPPORT_OK) {
656 // If p_next is NULL, this is the highest (prio) resource, i.e. 656 // If p_next is NULL, this is the highest (prio) resource, i.e.
657 // the one we are probably writing to. 657 // the one we are probably writing to.
658 if (!p_next || (jep85->last_state_sent != ROSTER_EVENT_ACTIVE && 658 if (!p_next || (xep85->last_state_sent != ROSTER_EVENT_ACTIVE &&
659 chatstate == ROSTER_EVENT_ACTIVE)) 659 chatstate == ROSTER_EVENT_ACTIVE))
660 xmpp_send_jep85_chatstate(bjid, p_res->data, chatstate); 660 xmpp_send_xep85_chatstate(bjid, p_res->data, chatstate);
661 } 661 }
662 g_free(p_res->data); 662 g_free(p_res->data);
663 } 663 }
664 g_slist_free(resources); 664 g_slist_free(resources);
665 // If the last resource had chatstates support when can return now, 665 // If the last resource had chatstates support when can return now,
666 // we don't want to send a XEP22 event. 666 // we don't want to send a XEP22 event.
667 if (jep85 && jep85->support == CHATSTATES_SUPPORT_OK) 667 if (xep85 && xep85->support == CHATSTATES_SUPPORT_OK)
668 return; 668 return;
669 #endif 669 #endif
670 #ifdef XEP0022 670 #ifdef XEP0022
671 jep22 = buddy_resource_jep22(buddy, NULL); 671 xep22 = buddy_resource_xep22(buddy, NULL);
672 if (jep22 && jep22->support == CHATSTATES_SUPPORT_OK) { 672 if (xep22 && xep22->support == CHATSTATES_SUPPORT_OK) {
673 xmpp_send_jep22_event(bjid, chatstate); 673 xmpp_send_xep22_event(bjid, chatstate);
674 } 674 }
675 #endif 675 #endif
676 } 676 }
677 #endif 677 #endif
678 678
683 #if defined XEP0022 || defined XEP0085 683 #if defined XEP0022 || defined XEP0085
684 static void chatstates_reset_probed(const char *fulljid) 684 static void chatstates_reset_probed(const char *fulljid)
685 { 685 {
686 char *rname, *barejid; 686 char *rname, *barejid;
687 GSList *sl_buddy; 687 GSList *sl_buddy;
688 struct jep0085 *jep85; 688 struct xep0085 *xep85;
689 struct jep0022 *jep22; 689 struct xep0022 *xep22;
690 690
691 rname = strchr(fulljid, JID_RESOURCE_SEPARATOR); 691 rname = strchr(fulljid, JID_RESOURCE_SEPARATOR);
692 if (!rname++) 692 if (!rname++)
693 return; 693 return;
694 694
697 g_free(barejid); 697 g_free(barejid);
698 698
699 if (!sl_buddy) 699 if (!sl_buddy)
700 return; 700 return;
701 701
702 jep85 = buddy_resource_jep85(sl_buddy->data, rname); 702 xep85 = buddy_resource_xep85(sl_buddy->data, rname);
703 jep22 = buddy_resource_jep22(sl_buddy->data, rname); 703 xep22 = buddy_resource_xep22(sl_buddy->data, rname);
704 704
705 if (jep85 && jep85->support == CHATSTATES_SUPPORT_PROBED) 705 if (xep85 && xep85->support == CHATSTATES_SUPPORT_PROBED)
706 jep85->support = CHATSTATES_SUPPORT_UNKNOWN; 706 xep85->support = CHATSTATES_SUPPORT_UNKNOWN;
707 if (jep22 && jep22->support == CHATSTATES_SUPPORT_PROBED) 707 if (xep22 && xep22->support == CHATSTATES_SUPPORT_PROBED)
708 jep22->support = CHATSTATES_SUPPORT_UNKNOWN; 708 xep22->support = CHATSTATES_SUPPORT_UNKNOWN;
709 } 709 }
710 #endif 710 #endif
711 711
712 #ifdef HAVE_GPGME 712 #ifdef HAVE_GPGME
713 // keys_mismatch(key, expectedkey) 713 // keys_mismatch(key, expectedkey)
970 LmMessageNode *state_ns = NULL; 970 LmMessageNode *state_ns = NULL;
971 const char *body; 971 const char *body;
972 char *rname, *bjid; 972 char *rname, *bjid;
973 GSList *sl_buddy; 973 GSList *sl_buddy;
974 guint events; 974 guint events;
975 struct jep0022 *jep22 = NULL; 975 struct xep0022 *xep22 = NULL;
976 struct jep0085 *jep85 = NULL; 976 struct xep0085 *xep85 = NULL;
977 enum { 977 enum {
978 XEP_none, 978 XEP_none,
979 XEP_85, 979 XEP_85,
980 XEP_22 980 XEP_22
981 } which_jep = XEP_none; 981 } which_xep = XEP_none;
982 982
983 rname = strchr(from, JID_RESOURCE_SEPARATOR); 983 rname = strchr(from, JID_RESOURCE_SEPARATOR);
984 if (rname) 984 if (rname)
985 ++rname; 985 ++rname;
986 else 986 else
998 998
999 /* Let's see chich XEP the contact uses. If possible, we'll use 999 /* Let's see chich XEP the contact uses. If possible, we'll use
1000 XEP-85, if not we'll look for XEP-22 support. */ 1000 XEP-85, if not we'll look for XEP-22 support. */
1001 events = buddy_resource_getevents(sl_buddy->data, rname); 1001 events = buddy_resource_getevents(sl_buddy->data, rname);
1002 1002
1003 jep85 = buddy_resource_jep85(sl_buddy->data, rname); 1003 xep85 = buddy_resource_xep85(sl_buddy->data, rname);
1004 if (jep85) { 1004 if (xep85) {
1005 state_ns = lm_message_node_find_xmlns(node, NS_CHATSTATES); 1005 state_ns = lm_message_node_find_xmlns(node, NS_CHATSTATES);
1006 if (state_ns) 1006 if (state_ns)
1007 which_jep = XEP_85; 1007 which_xep = XEP_85;
1008 } 1008 }
1009 1009
1010 if (which_jep != XEP_85) { /* Fall back to XEP-0022 */ 1010 if (which_xep != XEP_85) { /* Fall back to XEP-0022 */
1011 jep22 = buddy_resource_jep22(sl_buddy->data, rname); 1011 xep22 = buddy_resource_xep22(sl_buddy->data, rname);
1012 if (jep22) { 1012 if (xep22) {
1013 state_ns = lm_message_node_find_xmlns(node, NS_EVENT); 1013 state_ns = lm_message_node_find_xmlns(node, NS_EVENT);
1014 if (state_ns) 1014 if (state_ns)
1015 which_jep = XEP_22; 1015 which_xep = XEP_22;
1016 } 1016 }
1017 } 1017 }
1018 1018
1019 if (!which_jep) { /* Sender does not use chat states */ 1019 if (!which_xep) { /* Sender does not use chat states */
1020 return; 1020 return;
1021 } 1021 }
1022 1022
1023 body = lm_message_node_get_child_value(node, "body"); 1023 body = lm_message_node_get_child_value(node, "body");
1024 1024
1025 if (which_jep == XEP_85) { /* XEP-0085 */ 1025 if (which_xep == XEP_85) { /* XEP-0085 */
1026 jep85->support = CHATSTATES_SUPPORT_OK; 1026 xep85->support = CHATSTATES_SUPPORT_OK;
1027 1027
1028 if (!strcmp(state_ns->name, "composing")) { 1028 if (!strcmp(state_ns->name, "composing")) {
1029 jep85->last_state_rcvd = ROSTER_EVENT_COMPOSING; 1029 xep85->last_state_rcvd = ROSTER_EVENT_COMPOSING;
1030 } else if (!strcmp(state_ns->name, "active")) { 1030 } else if (!strcmp(state_ns->name, "active")) {
1031 jep85->last_state_rcvd = ROSTER_EVENT_ACTIVE; 1031 xep85->last_state_rcvd = ROSTER_EVENT_ACTIVE;
1032 } else if (!strcmp(state_ns->name, "paused")) { 1032 } else if (!strcmp(state_ns->name, "paused")) {
1033 jep85->last_state_rcvd = ROSTER_EVENT_PAUSED; 1033 xep85->last_state_rcvd = ROSTER_EVENT_PAUSED;
1034 } else if (!strcmp(state_ns->name, "inactive")) { 1034 } else if (!strcmp(state_ns->name, "inactive")) {
1035 jep85->last_state_rcvd = ROSTER_EVENT_INACTIVE; 1035 xep85->last_state_rcvd = ROSTER_EVENT_INACTIVE;
1036 } else if (!strcmp(state_ns->name, "gone")) { 1036 } else if (!strcmp(state_ns->name, "gone")) {
1037 jep85->last_state_rcvd = ROSTER_EVENT_GONE; 1037 xep85->last_state_rcvd = ROSTER_EVENT_GONE;
1038 } 1038 }
1039 events = jep85->last_state_rcvd; 1039 events = xep85->last_state_rcvd;
1040 } else { /* XEP-0022 */ 1040 } else { /* XEP-0022 */
1041 #ifdef XEP0022 1041 #ifdef XEP0022
1042 const char *msgid; 1042 const char *msgid;
1043 jep22->support = CHATSTATES_SUPPORT_OK; 1043 xep22->support = CHATSTATES_SUPPORT_OK;
1044 jep22->last_state_rcvd = ROSTER_EVENT_NONE; 1044 xep22->last_state_rcvd = ROSTER_EVENT_NONE;
1045 1045
1046 msgid = lm_message_node_get_attribute(node, "id"); 1046 msgid = lm_message_node_get_attribute(node, "id");
1047 1047
1048 if (lm_message_node_get_child(state_ns, "composing")) { 1048 if (lm_message_node_get_child(state_ns, "composing")) {
1049 // Clear composing if the message contains a body 1049 // Clear composing if the message contains a body
1050 if (body) 1050 if (body)
1051 events &= ~ROSTER_EVENT_COMPOSING; 1051 events &= ~ROSTER_EVENT_COMPOSING;
1052 else 1052 else
1053 events |= ROSTER_EVENT_COMPOSING; 1053 events |= ROSTER_EVENT_COMPOSING;
1054 jep22->last_state_rcvd |= ROSTER_EVENT_COMPOSING; 1054 xep22->last_state_rcvd |= ROSTER_EVENT_COMPOSING;
1055 1055
1056 } else { 1056 } else {
1057 events &= ~ROSTER_EVENT_COMPOSING; 1057 events &= ~ROSTER_EVENT_COMPOSING;
1058 } 1058 }
1059 1059
1060 // Cache the message id 1060 // Cache the message id
1061 g_free(jep22->last_msgid_rcvd); 1061 g_free(xep22->last_msgid_rcvd);
1062 if (msgid) 1062 if (msgid)
1063 jep22->last_msgid_rcvd = g_strdup(msgid); 1063 xep22->last_msgid_rcvd = g_strdup(msgid);
1064 else 1064 else
1065 jep22->last_msgid_rcvd = NULL; 1065 xep22->last_msgid_rcvd = NULL;
1066 1066
1067 if (lm_message_node_get_child(state_ns, "delivered")) { 1067 if (lm_message_node_get_child(state_ns, "delivered")) {
1068 jep22->last_state_rcvd |= ROSTER_EVENT_DELIVERED; 1068 xep22->last_state_rcvd |= ROSTER_EVENT_DELIVERED;
1069 1069
1070 // Do we have to send back an ACK? 1070 // Do we have to send back an ACK?
1071 if (body) 1071 if (body)
1072 xmpp_send_jep22_event(from, ROSTER_EVENT_DELIVERED); 1072 xmpp_send_xep22_event(from, ROSTER_EVENT_DELIVERED);
1073 } 1073 }
1074 #endif 1074 #endif
1075 } 1075 }
1076 1076
1077 buddy_resource_setevents(sl_buddy->data, rname, events); 1077 buddy_resource_setevents(sl_buddy->data, rname, events);