1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Include self in room roster

This commit is contained in:
James Booth 2014-10-07 01:16:46 +01:00
parent d8eb97eec8
commit 0e18b10b8e
4 changed files with 12 additions and 12 deletions

View File

@ -670,8 +670,11 @@ handle_ping_error_result(const char * const from, const char * const error)
void
handle_muc_self_online(const char * const room, const char * const nick, gboolean config_required,
const char * const role, const char * const affiliation)
const char * const role, const char * const affiliation, const char * const jid, const char * const show,
const char * const status)
{
muc_roster_add(room, nick, jid, role, affiliation, show, status);
// handle self nick change
if (muc_nick_change_pending(room)) {
muc_nick_change_complete(room, nick);

View File

@ -112,7 +112,8 @@ void handle_room_configuration_form_error(const char * const from, const char *
void handle_room_config_submit_result(const char * const room);
void handle_room_config_submit_result_error(const char * const room, const char * const message);
void handle_muc_self_online(const char * const room, const char * const nick, gboolean config_required,
const char * const role, const char * const affiliation);
const char * const role, const char * const affiliation, const char * const jid, const char * const show,
const char * const status);
void handle_muc_occupant_online(const char * const room, const char * const nick, const char * const jid,
const char * const role, const char * const affiliation, const char * const show_str,
const char * const status_str);

View File

@ -1449,10 +1449,7 @@ _ui_room_roster(const char * const room, GList *roster, const char * const prese
} else {
int length = g_list_length(roster);
if (presence == NULL) {
length++;
win_save_vprint(window, '!', NULL, NO_EOL, COLOUR_ROOMINFO, "", "%d occupants: ", length);
win_save_vprint(window, '!', NULL, NO_DATE | NO_EOL, COLOUR_ONLINE, "", "%s", muc_nick(room));
win_save_print(window, '!', NULL, NO_DATE | NO_EOL, 0, "", ", ");
} else {
win_save_vprint(window, '!', NULL, NO_EOL, COLOUR_ROOMINFO, "", "%d %s: ", length, presence);
}

View File

@ -694,6 +694,9 @@ _muc_user_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void *
char *room = from_jid->barejid;
char *nick = from_jid->resourcepart;
char *show_str = stanza_get_show(stanza, "online");
char *status_str = stanza_get_status(stanza, NULL);
char *jid = NULL;
char *role = NULL;
char *affiliation = NULL;
@ -756,13 +759,12 @@ _muc_user_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void *
// self online
} else {
gboolean config_required = stanza_muc_requires_config(stanza);
handle_muc_self_online(room, nick, config_required, role, affiliation);
handle_muc_self_online(room, nick, config_required, role, affiliation, jid, show_str, status_str);
}
// handle presence from room members
} else {
log_debug("Room presence received from %s", from_jid->fulljid);
char *status_str = stanza_get_status(stanza, NULL);
if (g_strcmp0(type, STANZA_TYPE_UNAVAILABLE) == 0) {
@ -803,15 +805,12 @@ _muc_user_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void *
_handle_caps(stanza);
}
char *show_str = stanza_get_show(stanza, "online");
handle_muc_occupant_online(room, nick, jid, role, affiliation, show_str, status_str);
}
}
free(show_str);
}
free(status_str);
}
jid_destroy(from_jid);
return 1;