static int _version_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata) { char *id = xmpp_stanza_get_id(stanza); if (id != NULL) { log_debug("IQ version result handler fired, id: %s.", id); } else { log_debug("IQ version result handler fired."); } const char *jid = xmpp_stanza_get_attribute(stanza, "from"); xmpp_stanza_t *query = xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_QUERY); if (query == NULL) { return 1; } char *ns = xmpp_stanza_get_ns(query); if (g_strcmp0(ns, STANZA_NS_VERSION) != 0) { return 1; } char *name_str = NULL; char *version_str = NULL; char *os_str = NULL; xmpp_stanza_t *name = xmpp_stanza_get_child_by_name(query, "name"); xmpp_stanza_t *version = xmpp_stanza_get_child_by_name(query, "version"); xmpp_stanza_t *os = xmpp_stanza_get_child_by_name(query, "os"); if (name != NULL) { name_str = xmpp_stanza_get_text(name); } if (version != NULL) { version_str = xmpp_stanza_get_text(version); } if (os != NULL) { os_str = xmpp_stanza_get_text(os); } PContact contact; Jid *jidp = jid_create(jid); if (muc_room_is_active(jidp->barejid)) { contact = muc_get_participant(jidp->barejid, jidp->resourcepart); } else { contact = roster_get_contact(jidp->barejid); } Resource *resource = p_contact_get_resource(contact, jidp->resourcepart); const char *presence = string_from_resource_presence(resource->presence); handle_software_version_result(jid, presence, name_str, version_str, os_str); jid_destroy(jidp); return 1; }
void ui_status_room(const char * const contact) { PContact pcontact = muc_get_participant(ui_current_recipient(), contact); ProfWin *current = wins_get_current(); if (pcontact != NULL) { win_show_contact(current, pcontact); } else { ui_current_print_line("No such participant \"%s\" in room.", contact); } }
void ui_status_private(void) { Jid *jid = jid_create(ui_current_recipient()); PContact pcontact = muc_get_participant(jid->barejid, jid->resourcepart); ProfWin *current = wins_get_current(); if (pcontact != NULL) { win_show_contact(current, pcontact); } else { ui_current_print_line("Error getting contact info."); } jid_destroy(jid); }