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

mucwin_room_disco_info takes ProfMucWin

This commit is contained in:
James Booth 2015-11-01 23:33:50 +00:00
parent 363fda82c1
commit d21faa4609
4 changed files with 39 additions and 38 deletions

View File

@ -153,43 +153,43 @@ mucwin_room_info_error(ProfMucWin *mucwin, const char *const error)
}
void
mucwin_room_disco_info(const char *const roomjid, GSList *identities, GSList *features)
mucwin_room_disco_info(ProfMucWin *mucwin, GSList *identities, GSList *features)
{
ProfWin *window = (ProfWin*)wins_get_muc(roomjid);
if (window) {
if ((identities && (g_slist_length(identities) > 0)) ||
(features && (g_slist_length(features) > 0))) {
if (identities) {
win_print(window, '!', 0, NULL, 0, 0, "", "Identities:");
}
while (identities) {
DiscoIdentity *identity = identities->data; // anme trpe, cat
GString *identity_str = g_string_new(" ");
if (identity->name) {
identity_str = g_string_append(identity_str, identity->name);
identity_str = g_string_append(identity_str, " ");
}
if (identity->type) {
identity_str = g_string_append(identity_str, identity->type);
identity_str = g_string_append(identity_str, " ");
}
if (identity->category) {
identity_str = g_string_append(identity_str, identity->category);
}
win_print(window, '!', 0, NULL, 0, 0, "", identity_str->str);
g_string_free(identity_str, TRUE);
identities = g_slist_next(identities);
}
assert(mucwin != NULL);
if (features) {
win_print(window, '!', 0, NULL, 0, 0, "", "Features:");
}
while (features) {
win_vprint(window, '!', 0, NULL, 0, 0, "", " %s", features->data);
features = g_slist_next(features);
}
win_print(window, '-', 0, NULL, 0, 0, "", "");
ProfWin *window = (ProfWin*)mucwin;
if ((identities && (g_slist_length(identities) > 0)) ||
(features && (g_slist_length(features) > 0))) {
if (identities) {
win_print(window, '!', 0, NULL, 0, 0, "", "Identities:");
}
while (identities) {
DiscoIdentity *identity = identities->data; // anme trpe, cat
GString *identity_str = g_string_new(" ");
if (identity->name) {
identity_str = g_string_append(identity_str, identity->name);
identity_str = g_string_append(identity_str, " ");
}
if (identity->type) {
identity_str = g_string_append(identity_str, identity->type);
identity_str = g_string_append(identity_str, " ");
}
if (identity->category) {
identity_str = g_string_append(identity_str, identity->category);
}
win_print(window, '!', 0, NULL, 0, 0, "", identity_str->str);
g_string_free(identity_str, TRUE);
identities = g_slist_next(identities);
}
if (features) {
win_print(window, '!', 0, NULL, 0, 0, "", "Features:");
}
while (features) {
win_vprint(window, '!', 0, NULL, 0, 0, "", " %s", features->data);
features = g_slist_next(features);
}
win_print(window, '-', 0, NULL, 0, 0, "", "");
}
}

View File

@ -182,7 +182,7 @@ void mucwin_info(ProfMucWin *mucwin);
void mucwin_show_role_list(ProfMucWin *mucwin, muc_role_t role);
void mucwin_show_affiliation_list(ProfMucWin *mucwin, muc_affiliation_t affiliation);
void mucwin_room_info_error(ProfMucWin *mucwin, const char *const error);
void mucwin_room_disco_info(const char *const roomjid, GSList *identities, GSList *features);
void mucwin_room_disco_info(ProfMucWin *mucwin, GSList *identities, GSList *features);
void mucwin_occupant_kicked(const char *const roomjid, const char *const nick, const char *const actor,
const char *const reason);
void mucwin_occupant_banned(const char *const roomjid, const char *const nick, const char *const actor,

View File

@ -1562,8 +1562,9 @@ _room_info_response_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza
}
muc_set_features(cb_data->room, features);
if (cb_data->display) {
mucwin_room_disco_info(cb_data->room, identities, features);
ProfMucWin *mucwin = wins_get_muc(cb_data->room);
if (mucwin && cb_data->display) {
mucwin_room_disco_info(mucwin, identities, features);
}
g_slist_free_full(features, free);

View File

@ -215,7 +215,7 @@ void mucwin_info(ProfMucWin *mucwin) {}
void mucwin_show_role_list(ProfMucWin *mucwin, muc_role_t role) {}
void mucwin_show_affiliation_list(ProfMucWin *mucwin, muc_affiliation_t affiliation) {}
void mucwin_room_info_error(ProfMucWin *mucwin, const char * const error) {}
void mucwin_room_disco_info(const char * const roomjid, GSList *identities, GSList *features) {}
void mucwin_room_disco_info(ProfMucWin *mucwin, GSList *identities, GSList *features) {}
void ui_room_destroyed(const char * const roomjid, const char * const reason, const char * const new_jid,
const char * const password) {}
void ui_room_kicked(const char * const roomjid, const char * const actor, const char * const reason) {}