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:
parent
d8eb97eec8
commit
0e18b10b8e
@ -670,8 +670,11 @@ handle_ping_error_result(const char * const from, const char * const error)
|
|||||||
|
|
||||||
void
|
void
|
||||||
handle_muc_self_online(const char * const room, const char * const nick, gboolean config_required,
|
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
|
// handle self nick change
|
||||||
if (muc_nick_change_pending(room)) {
|
if (muc_nick_change_pending(room)) {
|
||||||
muc_nick_change_complete(room, nick);
|
muc_nick_change_complete(room, nick);
|
||||||
|
@ -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(const char * const room);
|
||||||
void handle_room_config_submit_result_error(const char * const room, const char * const message);
|
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,
|
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,
|
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 role, const char * const affiliation, const char * const show_str,
|
||||||
const char * const status_str);
|
const char * const status_str);
|
||||||
|
@ -1449,10 +1449,7 @@ _ui_room_roster(const char * const room, GList *roster, const char * const prese
|
|||||||
} else {
|
} else {
|
||||||
int length = g_list_length(roster);
|
int length = g_list_length(roster);
|
||||||
if (presence == NULL) {
|
if (presence == NULL) {
|
||||||
length++;
|
|
||||||
win_save_vprint(window, '!', NULL, NO_EOL, COLOUR_ROOMINFO, "", "%d occupants: ", 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 {
|
} else {
|
||||||
win_save_vprint(window, '!', NULL, NO_EOL, COLOUR_ROOMINFO, "", "%d %s: ", length, presence);
|
win_save_vprint(window, '!', NULL, NO_EOL, COLOUR_ROOMINFO, "", "%d %s: ", length, presence);
|
||||||
}
|
}
|
||||||
|
@ -694,6 +694,9 @@ _muc_user_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void *
|
|||||||
char *room = from_jid->barejid;
|
char *room = from_jid->barejid;
|
||||||
char *nick = from_jid->resourcepart;
|
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 *jid = NULL;
|
||||||
char *role = NULL;
|
char *role = NULL;
|
||||||
char *affiliation = NULL;
|
char *affiliation = NULL;
|
||||||
@ -756,13 +759,12 @@ _muc_user_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void *
|
|||||||
// self online
|
// self online
|
||||||
} else {
|
} else {
|
||||||
gboolean config_required = stanza_muc_requires_config(stanza);
|
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
|
// handle presence from room members
|
||||||
} else {
|
} else {
|
||||||
log_debug("Room presence received from %s", from_jid->fulljid);
|
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) {
|
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);
|
_handle_caps(stanza);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *show_str = stanza_get_show(stanza, "online");
|
|
||||||
handle_muc_occupant_online(room, nick, jid, role, affiliation, show_str, status_str);
|
handle_muc_occupant_online(room, nick, jid, role, affiliation, show_str, status_str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
free(show_str);
|
free(show_str);
|
||||||
}
|
|
||||||
|
|
||||||
free(status_str);
|
free(status_str);
|
||||||
}
|
|
||||||
|
|
||||||
jid_destroy(from_jid);
|
jid_destroy(from_jid);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user