1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-11-03 19:37:16 -05:00

mucwin_handle_role_list takes ProfMucWin

This commit is contained in:
James Booth 2015-11-02 00:47:43 +00:00
parent 1aa3c0ea4f
commit 7bedb6c294
4 changed files with 26 additions and 23 deletions

View File

@ -629,32 +629,32 @@ mucwin_role_list_error(ProfMucWin *mucwin, const char *const role, const char *c
} }
void void
mucwin_handle_role_list(const char *const roomjid, const char *const role, GSList *nicks) mucwin_handle_role_list(ProfMucWin *mucwin, const char *const role, GSList *nicks)
{ {
ProfWin *window = (ProfWin*)wins_get_muc(roomjid); assert(mucwin != NULL);
if (window) {
if (nicks) { ProfWin *window = (ProfWin*)mucwin;
win_vprint(window, '!', 0, NULL, 0, 0, "", "Role: %s", role); if (nicks) {
GSList *curr_nick = nicks; win_vprint(window, '!', 0, NULL, 0, 0, "", "Role: %s", role);
while (curr_nick) { GSList *curr_nick = nicks;
char *nick = curr_nick->data; while (curr_nick) {
Occupant *occupant = muc_roster_item(roomjid, nick); char *nick = curr_nick->data;
if (occupant) { Occupant *occupant = muc_roster_item(mucwin->roomjid, nick);
if (occupant->jid) { if (occupant) {
win_vprint(window, '!', 0, NULL, 0, 0, "", " %s (%s)", nick, occupant->jid); if (occupant->jid) {
} else { win_vprint(window, '!', 0, NULL, 0, 0, "", " %s (%s)", nick, occupant->jid);
win_vprint(window, '!', 0, NULL, 0, 0, "", " %s", nick);
}
} else { } else {
win_vprint(window, '!', 0, NULL, 0, 0, "", " %s", nick); win_vprint(window, '!', 0, NULL, 0, 0, "", " %s", nick);
} }
curr_nick = g_slist_next(curr_nick); } else {
win_vprint(window, '!', 0, NULL, 0, 0, "", " %s", nick);
} }
win_print(window, '!', 0, NULL, 0, 0, "", ""); curr_nick = g_slist_next(curr_nick);
} else {
win_vprint(window, '!', 0, NULL, 0, 0, "", "No occupants found with role: %s", role);
win_print(window, '!', 0, NULL, 0, 0, "", "");
} }
win_print(window, '!', 0, NULL, 0, 0, "", "");
} else {
win_vprint(window, '!', 0, NULL, 0, 0, "", "No occupants found with role: %s", role);
win_print(window, '!', 0, NULL, 0, 0, "", "");
} }
} }

View File

@ -204,7 +204,7 @@ void mucwin_affiliation_set_error(const char *const roomjid, const char *const j
void mucwin_role_set_error(const char *const roomjid, const char *const nick, const char *const role, void mucwin_role_set_error(const char *const roomjid, const char *const nick, const char *const role,
const char *const error); const char *const error);
void mucwin_role_list_error(ProfMucWin *mucwin, const char *const role, const char *const error); void mucwin_role_list_error(ProfMucWin *mucwin, const char *const role, const char *const error);
void mucwin_handle_role_list(const char *const roomjid, const char *const role, GSList *nicks); void mucwin_handle_role_list(ProfMucWin *mucwin, const char *const role, GSList *nicks);
void mucwin_kick_error(ProfMucWin *mucwin, const char *const nick, const char *const error); void mucwin_kick_error(ProfMucWin *mucwin, const char *const nick, const char *const error);
// xml console // xml console

View File

@ -1422,7 +1422,10 @@ _room_role_list_result_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const sta
} }
} }
mucwin_handle_role_list(from, role, nicks); ProfMucWin *mucwin = wins_get_muc(from);
if (mucwin) {
mucwin_handle_role_list(mucwin, role, nicks);
}
free(role); free(role);
g_slist_free(nicks); g_slist_free(nicks);

View File

@ -278,7 +278,7 @@ void mucwin_affiliation_set_error(const char * const roomjid, const char * const
void mucwin_role_set_error(const char * const roomjid, const char * const nick, const char * const role, void mucwin_role_set_error(const char * const roomjid, const char * const nick, const char * const role,
const char * const error) {} const char * const error) {}
void mucwin_role_list_error(ProfMucWin *mucwin, const char * const role, const char * const error) {} void mucwin_role_list_error(ProfMucWin *mucwin, const char * const role, const char * const error) {}
void mucwin_handle_role_list(const char * const roomjid, const char * const role, GSList *nicks) {} void mucwin_handle_role_list(ProfMucWin *mucwin, const char * const role, GSList *nicks) {}
void mucwin_kick_error(ProfMucWin *mucwin, const char * const nick, const char * const error) {} void mucwin_kick_error(ProfMucWin *mucwin, const char * const nick, const char * const error) {}
void ui_show_form(ProfMucConfWin *confwin) {} void ui_show_form(ProfMucConfWin *confwin) {}
void ui_show_form_field(ProfWin *window, DataForm *form, char *tag) {} void ui_show_form_field(ProfWin *window, DataForm *form, char *tag) {}