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

Renamed ui_handle_room_affiliation_list -> mucwin_handle_affiliation_list

This commit is contained in:
James Booth 2015-11-01 21:45:59 +00:00
parent 21d560f068
commit fa0ed64190
4 changed files with 64 additions and 64 deletions

View File

@ -561,7 +561,7 @@ mucwin_affiliation_list_error(const char *const roomjid, const char *const affil
}
void
ui_handle_room_affiliation_list(const char *const roomjid, const char *const affiliation, GSList *jids)
mucwin_handle_affiliation_list(const char *const roomjid, const char *const affiliation, GSList *jids)
{
ProfWin *window = (ProfWin*)wins_get_muc(roomjid);
if (window) {
@ -581,6 +581,66 @@ ui_handle_room_affiliation_list(const char *const roomjid, const char *const aff
}
}
void
ui_show_room_affiliation_list(ProfMucWin *mucwin, muc_affiliation_t affiliation)
{
ProfWin *window = (ProfWin*) mucwin;
GSList *occupants = muc_occupants_by_affiliation(mucwin->roomjid, affiliation);
if (!occupants) {
switch (affiliation) {
case MUC_AFFILIATION_OWNER:
win_print(window, '!', 0, NULL, 0, 0, "", "No owners found.");
break;
case MUC_AFFILIATION_ADMIN:
win_print(window, '!', 0, NULL, 0, 0, "", "No admins found.");
break;
case MUC_AFFILIATION_MEMBER:
win_print(window, '!', 0, NULL, 0, 0, "", "No members found.");
break;
case MUC_AFFILIATION_OUTCAST:
win_print(window, '!', 0, NULL, 0, 0, "", "No outcasts found.");
break;
default:
break;
}
win_print(window, '-', 0, NULL, 0, 0, "", "");
} else {
switch (affiliation) {
case MUC_AFFILIATION_OWNER:
win_print(window, '!', 0, NULL, 0, 0, "", "Owners:");
break;
case MUC_AFFILIATION_ADMIN:
win_print(window, '!', 0, NULL, 0, 0, "", "Admins:");
break;
case MUC_AFFILIATION_MEMBER:
win_print(window, '!', 0, NULL, 0, 0, "", "Members:");
break;
case MUC_AFFILIATION_OUTCAST:
win_print(window, '!', 0, NULL, 0, 0, "", "Outcasts:");
break;
default:
break;
}
GSList *curr_occupant = occupants;
while(curr_occupant) {
Occupant *occupant = curr_occupant->data;
if (occupant->affiliation == affiliation) {
if (occupant->jid) {
win_vprint(window, '!', 0, NULL, 0, 0, "", " %s (%s)", occupant->nick, occupant->jid);
} else {
win_vprint(window, '!', 0, NULL, 0, 0, "", " %s", occupant->nick);
}
}
curr_occupant = g_slist_next(curr_occupant);
}
win_print(window, '-', 0, NULL, 0, 0, "", "");
}
}
void
ui_handle_room_role_list_error(const char *const roomjid, const char *const role, const char *const error)
{
@ -707,66 +767,6 @@ ui_show_room_role_list(ProfMucWin *mucwin, muc_role_t role)
}
}
void
ui_show_room_affiliation_list(ProfMucWin *mucwin, muc_affiliation_t affiliation)
{
ProfWin *window = (ProfWin*) mucwin;
GSList *occupants = muc_occupants_by_affiliation(mucwin->roomjid, affiliation);
if (!occupants) {
switch (affiliation) {
case MUC_AFFILIATION_OWNER:
win_print(window, '!', 0, NULL, 0, 0, "", "No owners found.");
break;
case MUC_AFFILIATION_ADMIN:
win_print(window, '!', 0, NULL, 0, 0, "", "No admins found.");
break;
case MUC_AFFILIATION_MEMBER:
win_print(window, '!', 0, NULL, 0, 0, "", "No members found.");
break;
case MUC_AFFILIATION_OUTCAST:
win_print(window, '!', 0, NULL, 0, 0, "", "No outcasts found.");
break;
default:
break;
}
win_print(window, '-', 0, NULL, 0, 0, "", "");
} else {
switch (affiliation) {
case MUC_AFFILIATION_OWNER:
win_print(window, '!', 0, NULL, 0, 0, "", "Owners:");
break;
case MUC_AFFILIATION_ADMIN:
win_print(window, '!', 0, NULL, 0, 0, "", "Admins:");
break;
case MUC_AFFILIATION_MEMBER:
win_print(window, '!', 0, NULL, 0, 0, "", "Members:");
break;
case MUC_AFFILIATION_OUTCAST:
win_print(window, '!', 0, NULL, 0, 0, "", "Outcasts:");
break;
default:
break;
}
GSList *curr_occupant = occupants;
while(curr_occupant) {
Occupant *occupant = curr_occupant->data;
if (occupant->affiliation == affiliation) {
if (occupant->jid) {
win_vprint(window, '!', 0, NULL, 0, 0, "", " %s (%s)", occupant->nick, occupant->jid);
} else {
win_vprint(window, '!', 0, NULL, 0, 0, "", " %s", occupant->nick);
}
}
curr_occupant = g_slist_next(curr_occupant);
}
win_print(window, '-', 0, NULL, 0, 0, "", "");
}
}
void
ui_room_update_occupants(const char *const roomjid)
{

View File

@ -157,7 +157,7 @@ void ui_handle_room_config_submit_result(const char *const roomjid);
void ui_handle_room_config_submit_result_error(const char *const roomjid, const char *const message);
void mucwin_affiliation_list_error(const char *const roomjid, const char *const affiliation,
const char *const error);
void ui_handle_room_affiliation_list(const char *const roomjid, const char *const affiliation, GSList *jids);
void mucwin_handle_affiliation_list(const char *const roomjid, const char *const affiliation, GSList *jids);
void ui_handle_room_affiliation_set_error(const char *const roomjid, const char *const jid,
const char *const affiliation, const char *const error);
void ui_handle_room_role_set_error(const char *const roomjid, const char *const nick, const char *const role,

View File

@ -1365,7 +1365,7 @@ _room_affiliation_list_result_handler(xmpp_conn_t *const conn, xmpp_stanza_t *co
}
muc_jid_autocomplete_add_all(from, jids);
ui_handle_room_affiliation_list(from, affiliation, jids);
mucwin_handle_affiliation_list(from, affiliation, jids);
free(affiliation);
g_slist_free(jids);

View File

@ -277,7 +277,7 @@ void ui_handle_room_config_submit_result(const char * const roomjid) {}
void ui_handle_room_config_submit_result_error(const char * const roomjid, const char * const message) {}
void mucwin_affiliation_list_error(const char * const roomjid, const char * const affiliation,
const char * const error) {}
void ui_handle_room_affiliation_list(const char * const roomjid, const char * const affiliation, GSList *jids) {}
void mucwin_handle_affiliation_list(const char * const roomjid, const char * const affiliation, GSList *jids) {}
void ui_handle_room_affiliation_set_error(const char * const roomjid, const char * const jid,
const char * const affiliation, const char * const error) {}
void ui_handle_room_role_set_error(const char * const roomjid, const char * const nick, const char * const role,