mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Merge branch 'master' into osx-functional
This commit is contained in:
commit
646d625a78
@ -1158,7 +1158,7 @@ _who_room(ProfWin *window, const char *const command, gchar **args)
|
||||
|
||||
// no arg, show all contacts
|
||||
if ((presence == NULL) || (g_strcmp0(presence, "any") == 0)) {
|
||||
mucwin_roster(mucwin->roomjid, occupants, NULL);
|
||||
mucwin_roster(mucwin, occupants, NULL);
|
||||
|
||||
// available
|
||||
} else if (strcmp("available", presence) == 0) {
|
||||
@ -1172,7 +1172,7 @@ _who_room(ProfWin *window, const char *const command, gchar **args)
|
||||
occupants = g_list_next(occupants);
|
||||
}
|
||||
|
||||
mucwin_roster(mucwin->roomjid, filtered, "available");
|
||||
mucwin_roster(mucwin, filtered, "available");
|
||||
|
||||
// unavailable
|
||||
} else if (strcmp("unavailable", presence) == 0) {
|
||||
@ -1186,7 +1186,7 @@ _who_room(ProfWin *window, const char *const command, gchar **args)
|
||||
occupants = g_list_next(occupants);
|
||||
}
|
||||
|
||||
mucwin_roster(mucwin->roomjid, filtered, "unavailable");
|
||||
mucwin_roster(mucwin, filtered, "unavailable");
|
||||
|
||||
// show specific status
|
||||
} else {
|
||||
@ -1201,7 +1201,7 @@ _who_room(ProfWin *window, const char *const command, gchar **args)
|
||||
occupants = g_list_next(occupants);
|
||||
}
|
||||
|
||||
mucwin_roster(mucwin->roomjid, filtered, presence);
|
||||
mucwin_roster(mucwin, filtered, presence);
|
||||
}
|
||||
|
||||
g_list_free(occupants);
|
||||
@ -3171,16 +3171,16 @@ cmd_occupants(ProfWin *window, const char *const command, gchar **args)
|
||||
if (g_strcmp0(args[0], "show") == 0) {
|
||||
if (g_strcmp0(args[1], "jid") == 0) {
|
||||
mucwin->showjid = TRUE;
|
||||
mucwin_update_occupants(mucwin->roomjid);
|
||||
mucwin_update_occupants(mucwin);
|
||||
} else {
|
||||
mucwin_show_occupants(mucwin->roomjid);
|
||||
mucwin_show_occupants(mucwin);
|
||||
}
|
||||
} else if (g_strcmp0(args[0], "hide") == 0) {
|
||||
if (g_strcmp0(args[1], "jid") == 0) {
|
||||
mucwin->showjid = FALSE;
|
||||
mucwin_update_occupants(mucwin->roomjid);
|
||||
mucwin_update_occupants(mucwin);
|
||||
} else {
|
||||
mucwin_hide_occupants(mucwin->roomjid);
|
||||
mucwin_hide_occupants(mucwin);
|
||||
}
|
||||
} else {
|
||||
cons_bad_cmd_usage(command);
|
||||
|
@ -136,7 +136,10 @@ void
|
||||
sv_ev_room_broadcast(const char *const room_jid, const char *const message)
|
||||
{
|
||||
if (muc_roster_complete(room_jid)) {
|
||||
mucwin_broadcast(room_jid, message);
|
||||
ProfMucWin *mucwin = wins_get_muc(room_jid);
|
||||
if (mucwin) {
|
||||
mucwin_broadcast(mucwin, message);
|
||||
}
|
||||
} else {
|
||||
muc_pending_broadcasts_add(room_jid, message);
|
||||
}
|
||||
@ -146,8 +149,9 @@ void
|
||||
sv_ev_room_subject(const char *const room, const char *const nick, const char *const subject)
|
||||
{
|
||||
muc_set_subject(room, subject);
|
||||
if (muc_roster_complete(room)) {
|
||||
mucwin_subject(room, nick, subject);
|
||||
ProfMucWin *mucwin = wins_get_muc(room);
|
||||
if (mucwin && muc_roster_complete(room)) {
|
||||
mucwin_subject(mucwin, nick, subject);
|
||||
}
|
||||
}
|
||||
|
||||
@ -155,14 +159,20 @@ void
|
||||
sv_ev_room_history(const char *const room_jid, const char *const nick,
|
||||
GDateTime *timestamp, const char *const message)
|
||||
{
|
||||
mucwin_history(room_jid, nick, timestamp, message);
|
||||
ProfMucWin *mucwin = wins_get_muc(room_jid);
|
||||
if (mucwin) {
|
||||
mucwin_history(mucwin, nick, timestamp, message);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
sv_ev_room_message(const char *const room_jid, const char *const nick,
|
||||
const char *const message)
|
||||
{
|
||||
mucwin_message(room_jid, nick, message);
|
||||
ProfMucWin *mucwin = wins_get_muc(room_jid);
|
||||
if (mucwin) {
|
||||
mucwin_message(mucwin, nick, message);
|
||||
}
|
||||
|
||||
if (prefs_get_boolean(PREF_GRLOG)) {
|
||||
Jid *jid = jid_create(jabber_get_fulljid());
|
||||
@ -485,8 +495,9 @@ sv_ev_room_occupant_offline(const char *const room, const char *const nick,
|
||||
muc_roster_remove(room, nick);
|
||||
|
||||
char *muc_status_pref = prefs_get_string(PREF_STATUSES_MUC);
|
||||
if (g_strcmp0(muc_status_pref, "none") != 0) {
|
||||
mucwin_occupant_offline(room, nick);
|
||||
ProfMucWin *mucwin = wins_get_muc(room);
|
||||
if (mucwin && (g_strcmp0(muc_status_pref, "none") != 0)) {
|
||||
mucwin_occupant_offline(mucwin, nick);
|
||||
}
|
||||
prefs_free_string(muc_status_pref);
|
||||
occupantswin_occupants(room);
|
||||
@ -497,7 +508,10 @@ sv_ev_room_occupent_kicked(const char *const room, const char *const nick, const
|
||||
const char *const reason)
|
||||
{
|
||||
muc_roster_remove(room, nick);
|
||||
mucwin_occupant_kicked(room, nick, actor, reason);
|
||||
ProfMucWin *mucwin = wins_get_muc(room);
|
||||
if (mucwin) {
|
||||
mucwin_occupant_kicked(mucwin, nick, actor, reason);
|
||||
}
|
||||
occupantswin_occupants(room);
|
||||
}
|
||||
|
||||
@ -506,7 +520,10 @@ sv_ev_room_occupent_banned(const char *const room, const char *const nick, const
|
||||
const char *const reason)
|
||||
{
|
||||
muc_roster_remove(room, nick);
|
||||
mucwin_occupant_banned(room, nick, actor, reason);
|
||||
ProfMucWin *mucwin = wins_get_muc(room);
|
||||
if (mucwin) {
|
||||
mucwin_occupant_banned(mucwin, nick, actor, reason);
|
||||
}
|
||||
occupantswin_occupants(room);
|
||||
}
|
||||
|
||||
@ -541,7 +558,10 @@ sv_ev_muc_self_online(const char *const room, const char *const nick, gboolean c
|
||||
// handle self nick change
|
||||
if (muc_nick_change_pending(room)) {
|
||||
muc_nick_change_complete(room, nick);
|
||||
mucwin_nick_change(room, nick);
|
||||
ProfMucWin *mucwin = wins_get_muc(room);
|
||||
if (mucwin) {
|
||||
mucwin_nick_change(mucwin, nick);
|
||||
}
|
||||
|
||||
// handle roster complete
|
||||
} else if (!muc_roster_complete(room)) {
|
||||
@ -557,22 +577,23 @@ sv_ev_muc_self_online(const char *const room, const char *const nick, gboolean c
|
||||
muc_roster_set_complete(room);
|
||||
|
||||
// show roster if occupants list disabled by default
|
||||
if (!prefs_get_boolean(PREF_OCCUPANTS)) {
|
||||
ProfMucWin *mucwin = wins_get_muc(room);
|
||||
if (mucwin && !prefs_get_boolean(PREF_OCCUPANTS)) {
|
||||
GList *occupants = muc_roster(room);
|
||||
mucwin_roster(room, occupants, NULL);
|
||||
mucwin_roster(mucwin, occupants, NULL);
|
||||
g_list_free(occupants);
|
||||
}
|
||||
|
||||
char *subject = muc_subject(room);
|
||||
if (subject) {
|
||||
mucwin_subject(room, NULL, subject);
|
||||
if (mucwin && subject) {
|
||||
mucwin_subject(mucwin, NULL, subject);
|
||||
}
|
||||
|
||||
GList *pending_broadcasts = muc_pending_broadcasts(room);
|
||||
if (pending_broadcasts) {
|
||||
if (mucwin && pending_broadcasts) {
|
||||
GList *curr = pending_broadcasts;
|
||||
while (curr) {
|
||||
mucwin_broadcast(room, curr->data);
|
||||
mucwin_broadcast(mucwin, curr->data);
|
||||
curr = g_list_next(curr);
|
||||
}
|
||||
}
|
||||
@ -580,23 +601,26 @@ sv_ev_muc_self_online(const char *const room, const char *const nick, gboolean c
|
||||
// room configuration required
|
||||
if (config_required) {
|
||||
muc_set_requires_config(room, TRUE);
|
||||
mucwin_requires_config(room);
|
||||
if (mucwin) {
|
||||
mucwin_requires_config(mucwin);
|
||||
}
|
||||
}
|
||||
|
||||
// check for change in role/affiliation
|
||||
} else {
|
||||
if (prefs_get_boolean(PREF_MUC_PRIVILEGES)) {
|
||||
ProfMucWin *mucwin = wins_get_muc(room);
|
||||
if (mucwin && prefs_get_boolean(PREF_MUC_PRIVILEGES)) {
|
||||
// both changed
|
||||
if ((g_strcmp0(role, old_role) != 0) && (g_strcmp0(affiliation, old_affiliation) != 0)) {
|
||||
mucwin_role_and_affiliation_change(room, role, affiliation, actor, reason);
|
||||
mucwin_role_and_affiliation_change(mucwin, role, affiliation, actor, reason);
|
||||
|
||||
// role changed
|
||||
} else if (g_strcmp0(role, old_role) != 0) {
|
||||
mucwin_role_change(room, role, actor, reason);
|
||||
mucwin_role_change(mucwin, role, actor, reason);
|
||||
|
||||
// affiliation changed
|
||||
} else if (g_strcmp0(affiliation, old_affiliation) != 0) {
|
||||
mucwin_affiliation_change(room, affiliation, actor, reason);
|
||||
mucwin_affiliation_change(mucwin, affiliation, actor, reason);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -628,7 +652,10 @@ sv_ev_muc_occupant_online(const char *const room, const char *const nick, const
|
||||
// handle nickname change
|
||||
char *old_nick = muc_roster_nick_change_complete(room, nick);
|
||||
if (old_nick) {
|
||||
mucwin_occupant_nick_change(room, old_nick, nick);
|
||||
ProfMucWin *mucwin = wins_get_muc(room);
|
||||
if (mucwin) {
|
||||
mucwin_occupant_nick_change(mucwin, old_nick, nick);
|
||||
}
|
||||
free(old_nick);
|
||||
occupantswin_occupants(room);
|
||||
return;
|
||||
@ -637,8 +664,9 @@ sv_ev_muc_occupant_online(const char *const room, const char *const nick, const
|
||||
// joined room
|
||||
if (!occupant) {
|
||||
char *muc_status_pref = prefs_get_string(PREF_STATUSES_MUC);
|
||||
if (g_strcmp0(muc_status_pref, "none") != 0) {
|
||||
mucwin_occupant_online(room, nick, role, affiliation, show, status);
|
||||
ProfMucWin *mucwin = wins_get_muc(room);
|
||||
if (mucwin && g_strcmp0(muc_status_pref, "none") != 0) {
|
||||
mucwin_occupant_online(mucwin, nick, role, affiliation, show, status);
|
||||
}
|
||||
prefs_free_string(muc_status_pref);
|
||||
occupantswin_occupants(room);
|
||||
@ -648,26 +676,28 @@ sv_ev_muc_occupant_online(const char *const room, const char *const nick, const
|
||||
// presence updated
|
||||
if (updated) {
|
||||
char *muc_status_pref = prefs_get_string(PREF_STATUSES_MUC);
|
||||
if (g_strcmp0(muc_status_pref, "all") == 0) {
|
||||
mucwin_occupant_presence(room, nick, show, status);
|
||||
ProfMucWin *mucwin = wins_get_muc(room);
|
||||
if (mucwin && (g_strcmp0(muc_status_pref, "all") == 0)) {
|
||||
mucwin_occupant_presence(mucwin, nick, show, status);
|
||||
}
|
||||
prefs_free_string(muc_status_pref);
|
||||
occupantswin_occupants(room);
|
||||
|
||||
// presence unchanged, check for role/affiliation change
|
||||
} else {
|
||||
if (prefs_get_boolean(PREF_MUC_PRIVILEGES)) {
|
||||
ProfMucWin *mucwin = wins_get_muc(room);
|
||||
if (mucwin && prefs_get_boolean(PREF_MUC_PRIVILEGES)) {
|
||||
// both changed
|
||||
if ((g_strcmp0(role, old_role) != 0) && (g_strcmp0(affiliation, old_affiliation) != 0)) {
|
||||
mucwin_occupant_role_and_affiliation_change(room, nick, role, affiliation, actor, reason);
|
||||
mucwin_occupant_role_and_affiliation_change(mucwin, nick, role, affiliation, actor, reason);
|
||||
|
||||
// role changed
|
||||
} else if (g_strcmp0(role, old_role) != 0) {
|
||||
mucwin_occupant_role_change(room, nick, role, actor, reason);
|
||||
mucwin_occupant_role_change(mucwin, nick, role, actor, reason);
|
||||
|
||||
// affiliation changed
|
||||
} else if (g_strcmp0(affiliation, old_affiliation) != 0) {
|
||||
mucwin_occupant_affiliation_change(room, nick, affiliation, actor, reason);
|
||||
mucwin_occupant_affiliation_change(mucwin, nick, affiliation, actor, reason);
|
||||
}
|
||||
}
|
||||
occupantswin_occupants(room);
|
||||
|
@ -647,7 +647,7 @@ ui_hide_all_room_rosters(void)
|
||||
if (window->type == WIN_MUC && win_has_active_subwin(window)) {
|
||||
ProfMucWin *mucwin = (ProfMucWin*)window;
|
||||
assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
|
||||
mucwin_hide_occupants(mucwin->roomjid);
|
||||
mucwin_hide_occupants(mucwin);
|
||||
}
|
||||
curr = g_list_next(curr);
|
||||
}
|
||||
@ -668,7 +668,7 @@ ui_show_all_room_rosters(void)
|
||||
if (window->type == WIN_MUC && !win_has_active_subwin(window)) {
|
||||
ProfMucWin *mucwin = (ProfMucWin*)window;
|
||||
assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
|
||||
mucwin_show_occupants(mucwin->roomjid);
|
||||
mucwin_show_occupants(mucwin);
|
||||
}
|
||||
curr = g_list_next(curr);
|
||||
}
|
||||
|
678
src/ui/mucwin.c
678
src/ui/mucwin.c
@ -32,6 +32,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "ui/win_types.h"
|
||||
#include "window_list.h"
|
||||
#include "log.h"
|
||||
@ -39,10 +41,11 @@
|
||||
#include "ui/window.h"
|
||||
|
||||
void
|
||||
mucwin_role_change(const char *const roomjid, const char *const role, const char *const actor,
|
||||
const char *const reason)
|
||||
mucwin_role_change(ProfMucWin *mucwin, const char *const role, const char *const actor, const char *const reason)
|
||||
{
|
||||
ProfWin *window = (ProfWin*)wins_get_muc(roomjid);
|
||||
assert(mucwin != NULL);
|
||||
|
||||
ProfWin *window = (ProfWin*)mucwin;
|
||||
win_vprint(window, '!', 0, NULL, NO_EOL, THEME_ROOMINFO, "", "Your role has been changed to: %s", role);
|
||||
if (actor) {
|
||||
win_vprint(window, '!', 0, NULL, NO_DATE | NO_EOL, THEME_ROOMINFO, "", ", by: %s", actor);
|
||||
@ -54,10 +57,12 @@ mucwin_role_change(const char *const roomjid, const char *const role, const char
|
||||
}
|
||||
|
||||
void
|
||||
mucwin_affiliation_change(const char *const roomjid, const char *const affiliation, const char *const actor,
|
||||
mucwin_affiliation_change(ProfMucWin *mucwin, const char *const affiliation, const char *const actor,
|
||||
const char *const reason)
|
||||
{
|
||||
ProfWin *window = (ProfWin*)wins_get_muc(roomjid);
|
||||
assert(mucwin != NULL);
|
||||
|
||||
ProfWin *window = (ProfWin*)mucwin;
|
||||
win_vprint(window, '!', 0, NULL, NO_EOL, THEME_ROOMINFO, "", "Your affiliation has been changed to: %s", affiliation);
|
||||
if (actor) {
|
||||
win_vprint(window, '!', 0, NULL, NO_DATE | NO_EOL, THEME_ROOMINFO, "", ", by: %s", actor);
|
||||
@ -69,10 +74,12 @@ mucwin_affiliation_change(const char *const roomjid, const char *const affiliati
|
||||
}
|
||||
|
||||
void
|
||||
mucwin_role_and_affiliation_change(const char *const roomjid, const char *const role, const char *const affiliation,
|
||||
mucwin_role_and_affiliation_change(ProfMucWin *mucwin, const char *const role, const char *const affiliation,
|
||||
const char *const actor, const char *const reason)
|
||||
{
|
||||
ProfWin *window = (ProfWin*)wins_get_muc(roomjid);
|
||||
assert(mucwin != NULL);
|
||||
|
||||
ProfWin *window = (ProfWin*)mucwin;
|
||||
win_vprint(window, '!', 0, NULL, NO_EOL, THEME_ROOMINFO, "", "Your role and affiliation have been changed, role: %s, affiliation: %s", role, affiliation);
|
||||
if (actor) {
|
||||
win_vprint(window, '!', 0, NULL, NO_DATE | NO_EOL, THEME_ROOMINFO, "", ", by: %s", actor);
|
||||
@ -85,10 +92,12 @@ mucwin_role_and_affiliation_change(const char *const roomjid, const char *const
|
||||
|
||||
|
||||
void
|
||||
mucwin_occupant_role_change(const char *const roomjid, const char *const nick, const char *const role,
|
||||
mucwin_occupant_role_change(ProfMucWin *mucwin, const char *const nick, const char *const role,
|
||||
const char *const actor, const char *const reason)
|
||||
{
|
||||
ProfWin *window = (ProfWin*)wins_get_muc(roomjid);
|
||||
assert(mucwin != NULL);
|
||||
|
||||
ProfWin *window = (ProfWin*)mucwin;
|
||||
win_vprint(window, '!', 0, NULL, NO_EOL, THEME_ROOMINFO, "", "%s's role has been changed to: %s", nick, role);
|
||||
if (actor) {
|
||||
win_vprint(window, '!', 0, NULL, NO_DATE | NO_EOL, THEME_ROOMINFO, "", ", by: %s", actor);
|
||||
@ -100,10 +109,12 @@ mucwin_occupant_role_change(const char *const roomjid, const char *const nick, c
|
||||
}
|
||||
|
||||
void
|
||||
mucwin_occupant_affiliation_change(const char *const roomjid, const char *const nick, const char *const affiliation,
|
||||
mucwin_occupant_affiliation_change(ProfMucWin *mucwin, const char *const nick, const char *const affiliation,
|
||||
const char *const actor, const char *const reason)
|
||||
{
|
||||
ProfWin *window = (ProfWin*)wins_get_muc(roomjid);
|
||||
assert(mucwin != NULL);
|
||||
|
||||
ProfWin *window = (ProfWin*)mucwin;
|
||||
win_vprint(window, '!', 0, NULL, NO_EOL, THEME_ROOMINFO, "", "%s's affiliation has been changed to: %s", nick, affiliation);
|
||||
if (actor) {
|
||||
win_vprint(window, '!', 0, NULL, NO_DATE | NO_EOL, THEME_ROOMINFO, "", ", by: %s", actor);
|
||||
@ -115,10 +126,12 @@ mucwin_occupant_affiliation_change(const char *const roomjid, const char *const
|
||||
}
|
||||
|
||||
void
|
||||
mucwin_occupant_role_and_affiliation_change(const char *const roomjid, const char *const nick, const char *const role,
|
||||
mucwin_occupant_role_and_affiliation_change(ProfMucWin *mucwin, const char *const nick, const char *const role,
|
||||
const char *const affiliation, const char *const actor, const char *const reason)
|
||||
{
|
||||
ProfWin *window = (ProfWin*)wins_get_muc(roomjid);
|
||||
assert(mucwin != NULL);
|
||||
|
||||
ProfWin *window = (ProfWin*)mucwin;
|
||||
win_vprint(window, '!', 0, NULL, NO_EOL, THEME_ROOMINFO, "", "%s's role and affiliation have been changed, role: %s, affiliation: %s", nick, role, affiliation);
|
||||
if (actor) {
|
||||
win_vprint(window, '!', 0, NULL, NO_DATE | NO_EOL, THEME_ROOMINFO, "", ", by: %s", actor);
|
||||
@ -130,250 +143,225 @@ mucwin_occupant_role_and_affiliation_change(const char *const roomjid, const cha
|
||||
}
|
||||
|
||||
void
|
||||
mucwin_room_info_error(const char *const roomjid, const char *const error)
|
||||
mucwin_room_info_error(ProfMucWin *mucwin, const char *const error)
|
||||
{
|
||||
ProfWin *window = (ProfWin*)wins_get_muc(roomjid);
|
||||
if (window) {
|
||||
win_vprint(window, '!', 0, NULL, 0, 0, "", "Room info request failed: %s", error);
|
||||
assert(mucwin != NULL);
|
||||
|
||||
ProfWin *window = (ProfWin*)mucwin;
|
||||
win_vprint(window, '!', 0, NULL, 0, 0, "", "Room info request failed: %s", error);
|
||||
win_print(window, '-', 0, NULL, 0, 0, "", "");
|
||||
}
|
||||
|
||||
void
|
||||
mucwin_room_disco_info(ProfMucWin *mucwin, GSList *identities, GSList *features)
|
||||
{
|
||||
assert(mucwin != NULL);
|
||||
|
||||
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, "", "");
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
mucwin_room_disco_info(const char *const roomjid, GSList *identities, GSList *features)
|
||||
mucwin_roster(ProfMucWin *mucwin, GList *roster, const char *const presence)
|
||||
{
|
||||
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, "", "");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
mucwin_roster(const char *const roomjid, GList *roster, const char *const presence)
|
||||
{
|
||||
ProfWin *window = (ProfWin*)wins_get_muc(roomjid);
|
||||
if (window == NULL) {
|
||||
log_error("Received room roster but no window open for %s.", roomjid);
|
||||
} else {
|
||||
if ((roster == NULL) || (g_list_length(roster) == 0)) {
|
||||
if (presence == NULL) {
|
||||
win_print(window, '!', 0, NULL, 0, THEME_ROOMINFO, "", "Room is empty.");
|
||||
} else {
|
||||
win_vprint(window, '!', 0, NULL, 0, THEME_ROOMINFO, "", "No occupants %s.", presence);
|
||||
}
|
||||
ProfWin *window = (ProfWin*)mucwin;
|
||||
if ((roster == NULL) || (g_list_length(roster) == 0)) {
|
||||
if (presence == NULL) {
|
||||
win_print(window, '!', 0, NULL, 0, THEME_ROOMINFO, "", "Room is empty.");
|
||||
} else {
|
||||
int length = g_list_length(roster);
|
||||
if (presence == NULL) {
|
||||
win_vprint(window, '!', 0, NULL, NO_EOL, THEME_ROOMINFO, "", "%d occupants: ", length);
|
||||
} else {
|
||||
win_vprint(window, '!', 0, NULL, NO_EOL, THEME_ROOMINFO, "", "%d %s: ", length, presence);
|
||||
win_vprint(window, '!', 0, NULL, 0, THEME_ROOMINFO, "", "No occupants %s.", presence);
|
||||
}
|
||||
} else {
|
||||
int length = g_list_length(roster);
|
||||
if (presence == NULL) {
|
||||
win_vprint(window, '!', 0, NULL, NO_EOL, THEME_ROOMINFO, "", "%d occupants: ", length);
|
||||
} else {
|
||||
win_vprint(window, '!', 0, NULL, NO_EOL, THEME_ROOMINFO, "", "%d %s: ", length, presence);
|
||||
}
|
||||
|
||||
while (roster) {
|
||||
Occupant *occupant = roster->data;
|
||||
const char *presence_str = string_from_resource_presence(occupant->presence);
|
||||
|
||||
theme_item_t presence_colour = theme_main_presence_attrs(presence_str);
|
||||
win_vprint(window, '!', 0, NULL, NO_DATE | NO_EOL, presence_colour, "", "%s", occupant->nick);
|
||||
|
||||
if (roster->next) {
|
||||
win_print(window, '!', 0, NULL, NO_DATE | NO_EOL, 0, "", ", ");
|
||||
}
|
||||
|
||||
while (roster) {
|
||||
Occupant *occupant = roster->data;
|
||||
const char *presence_str = string_from_resource_presence(occupant->presence);
|
||||
|
||||
theme_item_t presence_colour = theme_main_presence_attrs(presence_str);
|
||||
win_vprint(window, '!', 0, NULL, NO_DATE | NO_EOL, presence_colour, "", "%s", occupant->nick);
|
||||
|
||||
if (roster->next) {
|
||||
win_print(window, '!', 0, NULL, NO_DATE | NO_EOL, 0, "", ", ");
|
||||
}
|
||||
|
||||
roster = g_list_next(roster);
|
||||
}
|
||||
win_print(window, '!', 0, NULL, NO_DATE, THEME_ONLINE, "", "");
|
||||
|
||||
roster = g_list_next(roster);
|
||||
}
|
||||
win_print(window, '!', 0, NULL, NO_DATE, THEME_ONLINE, "", "");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
mucwin_occupant_offline(const char *const roomjid, const char *const nick)
|
||||
mucwin_occupant_offline(ProfMucWin *mucwin, const char *const nick)
|
||||
{
|
||||
ProfWin *window = (ProfWin*)wins_get_muc(roomjid);
|
||||
if (window == NULL) {
|
||||
log_error("Received offline presence for room participant %s, but no window open for %s.", nick, roomjid);
|
||||
} else {
|
||||
win_vprint(window, '!', 0, NULL, 0, THEME_OFFLINE, "", "<- %s has left the room.", nick);
|
||||
}
|
||||
assert(mucwin != NULL);
|
||||
|
||||
ProfWin *window = (ProfWin*)mucwin;
|
||||
win_vprint(window, '!', 0, NULL, 0, THEME_OFFLINE, "", "<- %s has left the room.", nick);
|
||||
}
|
||||
|
||||
void
|
||||
mucwin_occupant_kicked(const char *const roomjid, const char *const nick, const char *const actor,
|
||||
mucwin_occupant_kicked(ProfMucWin *mucwin, const char *const nick, const char *const actor,
|
||||
const char *const reason)
|
||||
{
|
||||
ProfWin *window = (ProfWin*)wins_get_muc(roomjid);
|
||||
if (window == NULL) {
|
||||
log_error("Received kick for room participant %s, but no window open for %s.", nick, roomjid);
|
||||
} else {
|
||||
GString *message = g_string_new(nick);
|
||||
g_string_append(message, " has been kicked from the room");
|
||||
if (actor) {
|
||||
g_string_append(message, " by ");
|
||||
g_string_append(message, actor);
|
||||
}
|
||||
if (reason) {
|
||||
g_string_append(message, ", reason: ");
|
||||
g_string_append(message, reason);
|
||||
}
|
||||
assert(mucwin != NULL);
|
||||
|
||||
win_vprint(window, '!', 0, NULL, 0, THEME_OFFLINE, "", "<- %s", message->str);
|
||||
g_string_free(message, TRUE);
|
||||
ProfWin *window = (ProfWin*)mucwin;
|
||||
GString *message = g_string_new(nick);
|
||||
g_string_append(message, " has been kicked from the room");
|
||||
if (actor) {
|
||||
g_string_append(message, " by ");
|
||||
g_string_append(message, actor);
|
||||
}
|
||||
if (reason) {
|
||||
g_string_append(message, ", reason: ");
|
||||
g_string_append(message, reason);
|
||||
}
|
||||
|
||||
win_vprint(window, '!', 0, NULL, 0, THEME_OFFLINE, "", "<- %s", message->str);
|
||||
g_string_free(message, TRUE);
|
||||
}
|
||||
|
||||
void
|
||||
mucwin_occupant_banned(const char *const roomjid, const char *const nick, const char *const actor,
|
||||
mucwin_occupant_banned(ProfMucWin *mucwin, const char *const nick, const char *const actor,
|
||||
const char *const reason)
|
||||
{
|
||||
ProfWin *window = (ProfWin*)wins_get_muc(roomjid);
|
||||
if (window == NULL) {
|
||||
log_error("Received ban for room participant %s, but no window open for %s.", nick, roomjid);
|
||||
} else {
|
||||
GString *message = g_string_new(nick);
|
||||
g_string_append(message, " has been banned from the room");
|
||||
if (actor) {
|
||||
g_string_append(message, " by ");
|
||||
g_string_append(message, actor);
|
||||
}
|
||||
if (reason) {
|
||||
g_string_append(message, ", reason: ");
|
||||
g_string_append(message, reason);
|
||||
}
|
||||
assert(mucwin != NULL);
|
||||
|
||||
win_vprint(window, '!', 0, NULL, 0, THEME_OFFLINE, "", "<- %s", message->str);
|
||||
g_string_free(message, TRUE);
|
||||
ProfWin *window = (ProfWin*)mucwin;
|
||||
GString *message = g_string_new(nick);
|
||||
g_string_append(message, " has been banned from the room");
|
||||
if (actor) {
|
||||
g_string_append(message, " by ");
|
||||
g_string_append(message, actor);
|
||||
}
|
||||
if (reason) {
|
||||
g_string_append(message, ", reason: ");
|
||||
g_string_append(message, reason);
|
||||
}
|
||||
|
||||
win_vprint(window, '!', 0, NULL, 0, THEME_OFFLINE, "", "<- %s", message->str);
|
||||
g_string_free(message, TRUE);
|
||||
}
|
||||
|
||||
void
|
||||
mucwin_occupant_online(const char *const roomjid, const char *const nick, const char *const role,
|
||||
mucwin_occupant_online(ProfMucWin *mucwin, const char *const nick, const char *const role,
|
||||
const char *const affiliation, const char *const show, const char *const status)
|
||||
{
|
||||
ProfWin *window = (ProfWin*)wins_get_muc(roomjid);
|
||||
if (window == NULL) {
|
||||
log_error("Received online presence for room participant %s, but no window open for %s.", nick, roomjid);
|
||||
} else {
|
||||
win_vprint(window, '!', 0, NULL, NO_EOL, THEME_ONLINE, "", "-> %s has joined the room", nick);
|
||||
if (prefs_get_boolean(PREF_MUC_PRIVILEGES)) {
|
||||
if (role) {
|
||||
win_vprint(window, '!', 0, NULL, NO_DATE | NO_EOL, THEME_ONLINE, "", ", role: %s", role);
|
||||
}
|
||||
if (affiliation) {
|
||||
win_vprint(window, '!', 0, NULL, NO_DATE | NO_EOL, THEME_ONLINE, "", ", affiliation: %s", affiliation);
|
||||
}
|
||||
assert(mucwin != NULL);
|
||||
|
||||
ProfWin *window = (ProfWin*)mucwin;
|
||||
win_vprint(window, '!', 0, NULL, NO_EOL, THEME_ONLINE, "", "-> %s has joined the room", nick);
|
||||
if (prefs_get_boolean(PREF_MUC_PRIVILEGES)) {
|
||||
if (role) {
|
||||
win_vprint(window, '!', 0, NULL, NO_DATE | NO_EOL, THEME_ONLINE, "", ", role: %s", role);
|
||||
}
|
||||
if (affiliation) {
|
||||
win_vprint(window, '!', 0, NULL, NO_DATE | NO_EOL, THEME_ONLINE, "", ", affiliation: %s", affiliation);
|
||||
}
|
||||
win_print(window, '!', 0, NULL, NO_DATE, THEME_ROOMINFO, "", "");
|
||||
}
|
||||
win_print(window, '!', 0, NULL, NO_DATE, THEME_ROOMINFO, "", "");
|
||||
}
|
||||
|
||||
void
|
||||
mucwin_occupant_presence(const char *const roomjid, const char *const nick,
|
||||
mucwin_occupant_presence(ProfMucWin *mucwin, const char *const nick,
|
||||
const char *const show, const char *const status)
|
||||
{
|
||||
ProfWin *window = (ProfWin*)wins_get_muc(roomjid);
|
||||
if (window == NULL) {
|
||||
log_error("Received presence for room participant %s, but no window open for %s.", nick, roomjid);
|
||||
} else {
|
||||
win_show_status_string(window, nick, show, status, NULL, "++", "online");
|
||||
}
|
||||
assert(mucwin != NULL);
|
||||
|
||||
ProfWin *window = (ProfWin*)mucwin;
|
||||
win_show_status_string(window, nick, show, status, NULL, "++", "online");
|
||||
}
|
||||
|
||||
void
|
||||
mucwin_occupant_nick_change(const char *const roomjid,
|
||||
const char *const old_nick, const char *const nick)
|
||||
mucwin_occupant_nick_change(ProfMucWin *mucwin, const char *const old_nick, const char *const nick)
|
||||
{
|
||||
ProfWin *window = (ProfWin*)wins_get_muc(roomjid);
|
||||
if (window == NULL) {
|
||||
log_error("Received nick change for room participant %s, but no window open for %s.", old_nick, roomjid);
|
||||
} else {
|
||||
win_vprint(window, '!', 0, NULL, 0, THEME_THEM, "", "** %s is now known as %s", old_nick, nick);
|
||||
}
|
||||
assert(mucwin != NULL);
|
||||
|
||||
ProfWin *window = (ProfWin*)mucwin;
|
||||
win_vprint(window, '!', 0, NULL, 0, THEME_THEM, "", "** %s is now known as %s", old_nick, nick);
|
||||
}
|
||||
|
||||
void
|
||||
mucwin_nick_change(const char *const roomjid, const char *const nick)
|
||||
mucwin_nick_change(ProfMucWin *mucwin, const char *const nick)
|
||||
{
|
||||
ProfWin *window = (ProfWin*)wins_get_muc(roomjid);
|
||||
if (window == NULL) {
|
||||
log_error("Received self nick change %s, but no window open for %s.", nick, roomjid);
|
||||
} else {
|
||||
win_vprint(window, '!', 0, NULL, 0, THEME_ME, "", "** You are now known as %s", nick);
|
||||
}
|
||||
assert(mucwin != NULL);
|
||||
|
||||
ProfWin *window = (ProfWin*)mucwin;
|
||||
win_vprint(window, '!', 0, NULL, 0, THEME_ME, "", "** You are now known as %s", nick);
|
||||
}
|
||||
|
||||
void
|
||||
mucwin_history(const char *const roomjid, const char *const nick,
|
||||
GDateTime *timestamp, const char *const message)
|
||||
mucwin_history(ProfMucWin *mucwin, const char *const nick, GDateTime *timestamp, const char *const message)
|
||||
{
|
||||
ProfWin *window = (ProfWin*)wins_get_muc(roomjid);
|
||||
if (window == NULL) {
|
||||
log_error("Room history message received from %s, but no window open for %s", nick, roomjid);
|
||||
assert(mucwin != NULL);
|
||||
|
||||
ProfWin *window = (ProfWin*)mucwin;
|
||||
GString *line = g_string_new("");
|
||||
|
||||
if (strncmp(message, "/me ", 4) == 0) {
|
||||
g_string_append(line, "*");
|
||||
g_string_append(line, nick);
|
||||
g_string_append(line, " ");
|
||||
g_string_append(line, message + 4);
|
||||
} else {
|
||||
GString *line = g_string_new("");
|
||||
|
||||
if (strncmp(message, "/me ", 4) == 0) {
|
||||
g_string_append(line, "*");
|
||||
g_string_append(line, nick);
|
||||
g_string_append(line, " ");
|
||||
g_string_append(line, message + 4);
|
||||
} else {
|
||||
g_string_append(line, nick);
|
||||
g_string_append(line, ": ");
|
||||
g_string_append(line, message);
|
||||
}
|
||||
|
||||
win_print(window, '-', 0, timestamp, NO_COLOUR_DATE, 0, "", line->str);
|
||||
g_string_free(line, TRUE);
|
||||
g_string_append(line, nick);
|
||||
g_string_append(line, ": ");
|
||||
g_string_append(line, message);
|
||||
}
|
||||
|
||||
win_print(window, '-', 0, timestamp, NO_COLOUR_DATE, 0, "", line->str);
|
||||
g_string_free(line, TRUE);
|
||||
}
|
||||
|
||||
void
|
||||
mucwin_message(const char *const roomjid, const char *const nick,
|
||||
const char *const message)
|
||||
mucwin_message(ProfMucWin *mucwin, const char *const nick, const char *const message)
|
||||
{
|
||||
ProfMucWin *mucwin = wins_get_muc(roomjid);
|
||||
if (mucwin == NULL) {
|
||||
log_error("Room message received from %s, but no window open for %s", nick, roomjid);
|
||||
return;
|
||||
}
|
||||
assert(mucwin != NULL);
|
||||
|
||||
ProfWin *window = (ProfWin*) mucwin;
|
||||
ProfWin *window = (ProfWin*)mucwin;
|
||||
int num = wins_get_num(window);
|
||||
char *my_nick = muc_nick(roomjid);
|
||||
char *my_nick = muc_nick(mucwin->roomjid);
|
||||
|
||||
if (g_strcmp0(nick, my_nick) != 0) {
|
||||
if (g_strrstr(message, my_nick)) {
|
||||
@ -434,7 +422,7 @@ mucwin_message(const char *const roomjid, const char *const nick,
|
||||
if (notify) {
|
||||
gboolean is_current = wins_is_current(window);
|
||||
if ( !is_current || (is_current && prefs_get_boolean(PREF_NOTIFY_ROOM_CURRENT)) ) {
|
||||
Jid *jidp = jid_create(roomjid);
|
||||
Jid *jidp = jid_create(mucwin->roomjid);
|
||||
if (prefs_get_boolean(PREF_NOTIFY_ROOM_TEXT)) {
|
||||
notify_room_message(nick, jidp->localpart, ui_index, message);
|
||||
} else {
|
||||
@ -446,144 +434,134 @@ mucwin_message(const char *const roomjid, const char *const nick,
|
||||
}
|
||||
|
||||
void
|
||||
mucwin_requires_config(const char *const roomjid)
|
||||
mucwin_requires_config(ProfMucWin *mucwin)
|
||||
{
|
||||
ProfWin *window = (ProfWin*)wins_get_muc(roomjid);
|
||||
if (window == NULL) {
|
||||
log_error("Received room config request, but no window open for %s.", roomjid);
|
||||
assert(mucwin != NULL);
|
||||
|
||||
ProfWin *window = (ProfWin*)mucwin;
|
||||
int num = wins_get_num(window);
|
||||
int ui_index = num;
|
||||
if (ui_index == 10) {
|
||||
ui_index = 0;
|
||||
}
|
||||
|
||||
win_print(window, '-', 0, NULL, 0, 0, "", "");
|
||||
win_vprint(window, '!', 0, NULL, 0, THEME_ROOMINFO, "", "Room locked, requires configuration.");
|
||||
win_vprint(window, '!', 0, NULL, 0, THEME_ROOMINFO, "", "Use '/room accept' to accept the defaults");
|
||||
win_vprint(window, '!', 0, NULL, 0, THEME_ROOMINFO, "", "Use '/room destroy' to cancel and destroy the room");
|
||||
win_vprint(window, '!', 0, NULL, 0, THEME_ROOMINFO, "", "Use '/room config' to edit the room configuration");
|
||||
win_print(window, '-', 0, NULL, 0, 0, "", "");
|
||||
|
||||
// currently in groupchat window
|
||||
if (wins_is_current(window)) {
|
||||
status_bar_active(num);
|
||||
|
||||
// not currently on groupchat window
|
||||
} else {
|
||||
int num = wins_get_num(window);
|
||||
int ui_index = num;
|
||||
if (ui_index == 10) {
|
||||
ui_index = 0;
|
||||
}
|
||||
|
||||
win_print(window, '-', 0, NULL, 0, 0, "", "");
|
||||
win_vprint(window, '!', 0, NULL, 0, THEME_ROOMINFO, "",
|
||||
"Room locked, requires configuration.");
|
||||
win_vprint(window, '!', 0, NULL, 0, THEME_ROOMINFO, "",
|
||||
"Use '/room accept' to accept the defaults");
|
||||
win_vprint(window, '!', 0, NULL, 0, THEME_ROOMINFO, "",
|
||||
"Use '/room destroy' to cancel and destroy the room");
|
||||
win_vprint(window, '!', 0, NULL, 0, THEME_ROOMINFO, "",
|
||||
"Use '/room config' to edit the room configuration");
|
||||
win_print(window, '-', 0, NULL, 0, 0, "", "");
|
||||
|
||||
// currently in groupchat window
|
||||
if (wins_is_current(window)) {
|
||||
status_bar_active(num);
|
||||
|
||||
// not currently on groupchat window
|
||||
} else {
|
||||
status_bar_new(num);
|
||||
}
|
||||
status_bar_new(num);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
mucwin_subject(const char *const roomjid, const char *const nick, const char *const subject)
|
||||
mucwin_subject(ProfMucWin *mucwin, const char *const nick, const char *const subject)
|
||||
{
|
||||
ProfWin *window = (ProfWin*)wins_get_muc(roomjid);
|
||||
if (window == NULL) {
|
||||
log_error("Received room subject, but no window open for %s.", roomjid);
|
||||
assert(mucwin != NULL);
|
||||
|
||||
ProfWin *window = (ProfWin*)mucwin;
|
||||
int num = wins_get_num(window);
|
||||
|
||||
if (subject) {
|
||||
if (nick) {
|
||||
win_vprint(window, '!', 0, NULL, NO_EOL, THEME_ROOMINFO, "", "*%s has set the room subject: ", nick);
|
||||
win_vprint(window, '!', 0, NULL, NO_DATE, 0, "", "%s", subject);
|
||||
} else {
|
||||
win_vprint(window, '!', 0, NULL, NO_EOL, THEME_ROOMINFO, "", "Room subject: ");
|
||||
win_vprint(window, '!', 0, NULL, NO_DATE, 0, "", "%s", subject);
|
||||
}
|
||||
} else {
|
||||
int num = wins_get_num(window);
|
||||
|
||||
if (subject) {
|
||||
if (nick) {
|
||||
win_vprint(window, '!', 0, NULL, NO_EOL, THEME_ROOMINFO, "", "*%s has set the room subject: ", nick);
|
||||
win_vprint(window, '!', 0, NULL, NO_DATE, 0, "", "%s", subject);
|
||||
} else {
|
||||
win_vprint(window, '!', 0, NULL, NO_EOL, THEME_ROOMINFO, "", "Room subject: ");
|
||||
win_vprint(window, '!', 0, NULL, NO_DATE, 0, "", "%s", subject);
|
||||
}
|
||||
if (nick) {
|
||||
win_vprint(window, '!', 0, NULL, 0, THEME_ROOMINFO, "", "*%s has cleared the room subject.", nick);
|
||||
} else {
|
||||
if (nick) {
|
||||
win_vprint(window, '!', 0, NULL, 0, THEME_ROOMINFO, "", "*%s has cleared the room subject.", nick);
|
||||
} else {
|
||||
win_vprint(window, '!', 0, NULL, 0, THEME_ROOMINFO, "", "Room subject cleared");
|
||||
}
|
||||
win_vprint(window, '!', 0, NULL, 0, THEME_ROOMINFO, "", "Room subject cleared");
|
||||
}
|
||||
}
|
||||
|
||||
// currently in groupchat window
|
||||
if (wins_is_current(window)) {
|
||||
status_bar_active(num);
|
||||
// currently in groupchat window
|
||||
if (wins_is_current(window)) {
|
||||
status_bar_active(num);
|
||||
|
||||
// not currently on groupchat window
|
||||
} else {
|
||||
status_bar_active(num);
|
||||
}
|
||||
// not currently on groupchat window
|
||||
} else {
|
||||
status_bar_active(num);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
mucwin_kick_error(const char *const roomjid, const char *const nick, const char *const error)
|
||||
mucwin_kick_error(ProfMucWin *mucwin, const char *const nick, const char *const error)
|
||||
{
|
||||
ProfWin *window = (ProfWin*)wins_get_muc(roomjid);
|
||||
if (window == NULL) {
|
||||
log_error("Kick error received for %s, but no window open for %s.", nick, roomjid);
|
||||
assert(mucwin != NULL);
|
||||
|
||||
ProfWin *window = (ProfWin*)mucwin;
|
||||
win_vprint(window, '!', 0, NULL, 0, THEME_ERROR, "", "Error kicking %s: %s", nick, error);
|
||||
}
|
||||
|
||||
void
|
||||
mucwin_broadcast(ProfMucWin *mucwin, const char *const message)
|
||||
{
|
||||
assert(mucwin != NULL);
|
||||
|
||||
ProfWin *window = (ProfWin*)mucwin;
|
||||
int num = wins_get_num(window);
|
||||
|
||||
win_vprint(window, '!', 0, NULL, NO_EOL, THEME_ROOMINFO, "", "Room message: ");
|
||||
win_vprint(window, '!', 0, NULL, NO_DATE, 0, "", "%s", message);
|
||||
|
||||
// currently in groupchat window
|
||||
if (wins_is_current(window)) {
|
||||
status_bar_active(num);
|
||||
|
||||
// not currently on groupchat window
|
||||
} else {
|
||||
win_vprint(window, '!', 0, NULL, 0, THEME_ERROR, "", "Error kicking %s: %s", nick, error);
|
||||
status_bar_new(num);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
mucwin_broadcast(const char *const roomjid, const char *const message)
|
||||
{
|
||||
ProfWin *window = (ProfWin*)wins_get_muc(roomjid);
|
||||
if (window == NULL) {
|
||||
log_error("Received room broadcast, but no window open for %s.", roomjid);
|
||||
} else {
|
||||
int num = wins_get_num(window);
|
||||
|
||||
win_vprint(window, '!', 0, NULL, NO_EOL, THEME_ROOMINFO, "", "Room message: ");
|
||||
win_vprint(window, '!', 0, NULL, NO_DATE, 0, "", "%s", message);
|
||||
|
||||
// currently in groupchat window
|
||||
if (wins_is_current(window)) {
|
||||
status_bar_active(num);
|
||||
|
||||
// not currently on groupchat window
|
||||
} else {
|
||||
status_bar_new(num);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
mucwin_affiliation_list_error(const char *const roomjid, const char *const affiliation,
|
||||
mucwin_affiliation_list_error(ProfMucWin *mucwin, const char *const affiliation,
|
||||
const char *const error)
|
||||
{
|
||||
ProfWin *window = (ProfWin*)wins_get_muc(roomjid);
|
||||
if (window) {
|
||||
win_vprint(window, '!', 0, NULL, 0, THEME_ERROR, "", "Error retrieving %s list: %s", affiliation, error);
|
||||
}
|
||||
assert(mucwin != NULL);
|
||||
|
||||
ProfWin *window = (ProfWin*)mucwin;
|
||||
win_vprint(window, '!', 0, NULL, 0, THEME_ERROR, "", "Error retrieving %s list: %s", affiliation, error);
|
||||
}
|
||||
|
||||
void
|
||||
mucwin_handle_affiliation_list(const char *const roomjid, const char *const affiliation, GSList *jids)
|
||||
mucwin_handle_affiliation_list(ProfMucWin *mucwin, const char *const affiliation, GSList *jids)
|
||||
{
|
||||
ProfWin *window = (ProfWin*)wins_get_muc(roomjid);
|
||||
if (window) {
|
||||
if (jids) {
|
||||
win_vprint(window, '!', 0, NULL, 0, 0, "", "Affiliation: %s", affiliation);
|
||||
GSList *curr_jid = jids;
|
||||
while (curr_jid) {
|
||||
char *jid = curr_jid->data;
|
||||
win_vprint(window, '!', 0, NULL, 0, 0, "", " %s", jid);
|
||||
curr_jid = g_slist_next(curr_jid);
|
||||
}
|
||||
win_print(window, '!', 0, NULL, 0, 0, "", "");
|
||||
} else {
|
||||
win_vprint(window, '!', 0, NULL, 0, 0, "", "No users found with affiliation: %s", affiliation);
|
||||
win_print(window, '!', 0, NULL, 0, 0, "", "");
|
||||
assert(mucwin != NULL);
|
||||
|
||||
ProfWin *window = (ProfWin*)mucwin;
|
||||
if (jids) {
|
||||
win_vprint(window, '!', 0, NULL, 0, 0, "", "Affiliation: %s", affiliation);
|
||||
GSList *curr_jid = jids;
|
||||
while (curr_jid) {
|
||||
char *jid = curr_jid->data;
|
||||
win_vprint(window, '!', 0, NULL, 0, 0, "", " %s", jid);
|
||||
curr_jid = g_slist_next(curr_jid);
|
||||
}
|
||||
win_print(window, '!', 0, NULL, 0, 0, "", "");
|
||||
} else {
|
||||
win_vprint(window, '!', 0, NULL, 0, 0, "", "No users found with affiliation: %s", affiliation);
|
||||
win_print(window, '!', 0, NULL, 0, 0, "", "");
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
mucwin_show_affiliation_list(ProfMucWin *mucwin, muc_affiliation_t affiliation)
|
||||
{
|
||||
assert(mucwin != NULL);
|
||||
|
||||
ProfWin *window = (ProfWin*) mucwin;
|
||||
GSList *occupants = muc_occupants_by_affiliation(mucwin->roomjid, affiliation);
|
||||
|
||||
@ -642,48 +620,50 @@ mucwin_show_affiliation_list(ProfMucWin *mucwin, muc_affiliation_t affiliation)
|
||||
}
|
||||
|
||||
void
|
||||
mucwin_role_list_error(const char *const roomjid, const char *const role, const char *const error)
|
||||
mucwin_role_list_error(ProfMucWin *mucwin, const char *const role, const char *const error)
|
||||
{
|
||||
ProfWin *window = (ProfWin*)wins_get_muc(roomjid);
|
||||
if (window) {
|
||||
win_vprint(window, '!', 0, NULL, 0, THEME_ERROR, "", "Error retrieving %s list: %s", role, error);
|
||||
}
|
||||
assert(mucwin != NULL);
|
||||
|
||||
ProfWin *window = (ProfWin*)mucwin;
|
||||
win_vprint(window, '!', 0, NULL, 0, THEME_ERROR, "", "Error retrieving %s list: %s", role, error);
|
||||
}
|
||||
|
||||
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);
|
||||
if (window) {
|
||||
if (nicks) {
|
||||
win_vprint(window, '!', 0, NULL, 0, 0, "", "Role: %s", role);
|
||||
GSList *curr_nick = nicks;
|
||||
while (curr_nick) {
|
||||
char *nick = curr_nick->data;
|
||||
Occupant *occupant = muc_roster_item(roomjid, nick);
|
||||
if (occupant) {
|
||||
if (occupant->jid) {
|
||||
win_vprint(window, '!', 0, NULL, 0, 0, "", " %s (%s)", nick, occupant->jid);
|
||||
} else {
|
||||
win_vprint(window, '!', 0, NULL, 0, 0, "", " %s", nick);
|
||||
}
|
||||
assert(mucwin != NULL);
|
||||
|
||||
ProfWin *window = (ProfWin*)mucwin;
|
||||
if (nicks) {
|
||||
win_vprint(window, '!', 0, NULL, 0, 0, "", "Role: %s", role);
|
||||
GSList *curr_nick = nicks;
|
||||
while (curr_nick) {
|
||||
char *nick = curr_nick->data;
|
||||
Occupant *occupant = muc_roster_item(mucwin->roomjid, nick);
|
||||
if (occupant) {
|
||||
if (occupant->jid) {
|
||||
win_vprint(window, '!', 0, NULL, 0, 0, "", " %s (%s)", nick, occupant->jid);
|
||||
} else {
|
||||
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, "", "");
|
||||
} else {
|
||||
win_vprint(window, '!', 0, NULL, 0, 0, "", "No occupants found with role: %s", role);
|
||||
win_print(window, '!', 0, NULL, 0, 0, "", "");
|
||||
curr_nick = g_slist_next(curr_nick);
|
||||
}
|
||||
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, "", "");
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
mucwin_show_role_list(ProfMucWin *mucwin, muc_role_t role)
|
||||
{
|
||||
ProfWin *window = (ProfWin*) mucwin;
|
||||
assert(mucwin != NULL);
|
||||
|
||||
ProfWin *window = (ProfWin*)mucwin;
|
||||
GSList *occupants = muc_occupants_by_role(mucwin->roomjid, role);
|
||||
|
||||
if (!occupants) {
|
||||
@ -735,28 +715,30 @@ mucwin_show_role_list(ProfMucWin *mucwin, muc_role_t role)
|
||||
}
|
||||
|
||||
void
|
||||
mucwin_affiliation_set_error(const char *const roomjid, const char *const jid, const char *const affiliation,
|
||||
mucwin_affiliation_set_error(ProfMucWin *mucwin, const char *const jid, const char *const affiliation,
|
||||
const char *const error)
|
||||
{
|
||||
ProfWin *window = (ProfWin*)wins_get_muc(roomjid);
|
||||
if (window) {
|
||||
win_vprint(window, '!', 0, NULL, 0, THEME_ERROR, "", "Error setting %s affiliation for %s: %s", affiliation, jid, error);
|
||||
}
|
||||
assert(mucwin != NULL);
|
||||
|
||||
ProfWin *window = (ProfWin*)mucwin;
|
||||
win_vprint(window, '!', 0, NULL, 0, THEME_ERROR, "", "Error setting %s affiliation for %s: %s", affiliation, jid, error);
|
||||
}
|
||||
|
||||
void
|
||||
mucwin_role_set_error(const char *const roomjid, const char *const nick, const char *const role,
|
||||
mucwin_role_set_error(ProfMucWin *mucwin, const char *const nick, const char *const role,
|
||||
const char *const error)
|
||||
{
|
||||
ProfWin *window = (ProfWin*)wins_get_muc(roomjid);
|
||||
if (window) {
|
||||
win_vprint(window, '!', 0, NULL, 0, THEME_ERROR, "", "Error setting %s role for %s: %s", role, nick, error);
|
||||
}
|
||||
assert(mucwin != NULL);
|
||||
|
||||
ProfWin *window = (ProfWin*)mucwin;
|
||||
win_vprint(window, '!', 0, NULL, 0, THEME_ERROR, "", "Error setting %s role for %s: %s", role, nick, error);
|
||||
}
|
||||
|
||||
void
|
||||
mucwin_info(ProfMucWin *mucwin)
|
||||
{
|
||||
assert(mucwin != NULL);
|
||||
|
||||
char *role = muc_role_str(mucwin->roomjid);
|
||||
char *affiliation = muc_affiliation_str(mucwin->roomjid);
|
||||
|
||||
@ -768,29 +750,35 @@ mucwin_info(ProfMucWin *mucwin)
|
||||
}
|
||||
|
||||
void
|
||||
mucwin_update_occupants(const char *const roomjid)
|
||||
mucwin_update_occupants(ProfMucWin *mucwin)
|
||||
{
|
||||
ProfWin *window = (ProfWin*)wins_get_muc(roomjid);
|
||||
if (window && win_has_active_subwin(window)) {
|
||||
occupantswin_occupants(roomjid);
|
||||
assert(mucwin != NULL);
|
||||
|
||||
ProfWin *window = (ProfWin*)mucwin;
|
||||
if (win_has_active_subwin(window)) {
|
||||
occupantswin_occupants(mucwin->roomjid);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
mucwin_show_occupants(const char *const roomjid)
|
||||
mucwin_show_occupants(ProfMucWin *mucwin)
|
||||
{
|
||||
ProfWin *window = (ProfWin*)wins_get_muc(roomjid);
|
||||
if (window && !win_has_active_subwin(window)) {
|
||||
assert(mucwin != NULL);
|
||||
|
||||
ProfWin *window = (ProfWin*)mucwin;
|
||||
if (!win_has_active_subwin(window)) {
|
||||
wins_show_subwin(window);
|
||||
occupantswin_occupants(roomjid);
|
||||
occupantswin_occupants(mucwin->roomjid);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
mucwin_hide_occupants(const char *const roomjid)
|
||||
mucwin_hide_occupants(ProfMucWin *mucwin)
|
||||
{
|
||||
ProfWin *window = (ProfWin*)wins_get_muc(roomjid);
|
||||
if (window && win_has_active_subwin(window)) {
|
||||
assert(mucwin != NULL);
|
||||
|
||||
ProfWin *window = (ProfWin*)mucwin;
|
||||
if (win_has_active_subwin(window)) {
|
||||
wins_hide_subwin(window);
|
||||
}
|
||||
}
|
||||
|
66
src/ui/ui.h
66
src/ui/ui.h
@ -161,54 +161,50 @@ void chatwin_otr_smp_event(ProfChatWin *chatwin, prof_otr_smp_event_t event, voi
|
||||
#endif
|
||||
|
||||
// MUC window
|
||||
void mucwin_role_change(const char *const roomjid, const char *const role, const char *const actor,
|
||||
void mucwin_role_change(ProfMucWin *mucwin, const char *const role, const char *const actor, const char *const reason);
|
||||
void mucwin_affiliation_change(ProfMucWin *mucwin, const char *const affiliation, const char *const actor,
|
||||
const char *const reason);
|
||||
void mucwin_affiliation_change(const char *const roomjid, const char *const affiliation, const char *const actor,
|
||||
const char *const reason);
|
||||
void mucwin_role_and_affiliation_change(const char *const roomjid, const char *const role,
|
||||
void mucwin_role_and_affiliation_change(ProfMucWin *mucwin, const char *const role,
|
||||
const char *const affiliation, const char *const actor, const char *const reason);
|
||||
void mucwin_occupant_role_change(const char *const roomjid, const char *const nick, const char *const role,
|
||||
void mucwin_occupant_role_change(ProfMucWin *mucwin, const char *const nick, const char *const role,
|
||||
const char *const actor, const char *const reason);
|
||||
void mucwin_occupant_affiliation_change(const char *const roomjid, const char *const nick,
|
||||
void mucwin_occupant_affiliation_change(ProfMucWin *mucwin, const char *const nick,
|
||||
const char *const affiliation, const char *const actor, const char *const reason);
|
||||
void mucwin_occupant_role_and_affiliation_change(const char *const roomjid, const char *const nick,
|
||||
void mucwin_occupant_role_and_affiliation_change(ProfMucWin *mucwin, const char *const nick,
|
||||
const char *const role, const char *const affiliation, const char *const actor, const char *const reason);
|
||||
void mucwin_roster(const char *const roomjid, GList *occupants, const char *const presence);
|
||||
void mucwin_history(const char *const roomjid, const char *const nick, GDateTime *timestamp,
|
||||
const char *const message);
|
||||
void mucwin_message(const char *const roomjid, const char *const nick, const char *const message);
|
||||
void mucwin_subject(const char *const roomjid, const char *const nick, const char *const subject);
|
||||
void mucwin_requires_config(const char *const roomjid);
|
||||
void mucwin_roster(ProfMucWin *mucwin, GList *occupants, const char *const presence);
|
||||
void mucwin_history(ProfMucWin *mucwin, const char *const nick, GDateTime *timestamp, const char *const message);
|
||||
void mucwin_message(ProfMucWin *mucwin, const char *const nick, const char *const message);
|
||||
void mucwin_subject(ProfMucWin *mucwin, const char *const nick, const char *const subject);
|
||||
void mucwin_requires_config(ProfMucWin *mucwin);
|
||||
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(const char *const roomjid, const char *const error);
|
||||
void mucwin_room_disco_info(const char *const roomjid, GSList *identities, GSList *features);
|
||||
void mucwin_occupant_kicked(const char *const roomjid, const char *const nick, const char *const actor,
|
||||
void mucwin_room_info_error(ProfMucWin *mucwin, const char *const error);
|
||||
void mucwin_room_disco_info(ProfMucWin *mucwin, GSList *identities, GSList *features);
|
||||
void mucwin_occupant_kicked(ProfMucWin *mucwin, 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,
|
||||
void mucwin_occupant_banned(ProfMucWin *mucwin, const char *const nick, const char *const actor,
|
||||
const char *const reason);
|
||||
void mucwin_broadcast(const char *const roomjid, const char *const message);
|
||||
void mucwin_occupant_offline(const char *const roomjid, const char *const nick);
|
||||
void mucwin_occupant_online(const char *const roomjid, const char *const nick, const char *const roles,
|
||||
void mucwin_broadcast(ProfMucWin *mucwin, const char *const message);
|
||||
void mucwin_occupant_offline(ProfMucWin *mucwin, const char *const nick);
|
||||
void mucwin_occupant_online(ProfMucWin *mucwin, const char *const nick, const char *const roles,
|
||||
const char *const affiliation, const char *const show, const char *const status);
|
||||
void mucwin_occupant_nick_change(const char *const roomjid, const char *const old_nick, const char *const nick);
|
||||
void mucwin_nick_change(const char *const roomjid, const char *const nick);
|
||||
void mucwin_occupant_presence(const char *const roomjid, const char *const nick, const char *const show,
|
||||
void mucwin_occupant_nick_change(ProfMucWin *mucwin, const char *const old_nick, const char *const nick);
|
||||
void mucwin_nick_change(ProfMucWin *mucwin, const char *const nick);
|
||||
void mucwin_occupant_presence(ProfMucWin *mucwin, const char *const nick, const char *const show,
|
||||
const char *const status);
|
||||
void mucwin_update_occupants(const char *const roomjid);
|
||||
void mucwin_show_occupants(const char *const roomjid);
|
||||
void mucwin_hide_occupants(const char *const roomjid);
|
||||
void mucwin_affiliation_list_error(const char *const roomjid, const char *const affiliation,
|
||||
void mucwin_update_occupants(ProfMucWin *mucwin);
|
||||
void mucwin_show_occupants(ProfMucWin *mucwin);
|
||||
void mucwin_hide_occupants(ProfMucWin *mucwin);
|
||||
void mucwin_affiliation_list_error(ProfMucWin *mucwin, const char *const affiliation, const char *const error);
|
||||
void mucwin_handle_affiliation_list(ProfMucWin *mucwin, const char *const affiliation, GSList *jids);
|
||||
void mucwin_affiliation_set_error(ProfMucWin *mucwin, const char *const jid, const char *const affiliation,
|
||||
const char *const error);
|
||||
void mucwin_handle_affiliation_list(const char *const roomjid, const char *const affiliation, GSList *jids);
|
||||
void mucwin_affiliation_set_error(const char *const roomjid, const char *const jid,
|
||||
const char *const affiliation, const char *const error);
|
||||
void mucwin_role_set_error(const char *const roomjid, const char *const nick, const char *const role,
|
||||
const char *const error);
|
||||
void mucwin_role_list_error(const char *const roomjid, 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_kick_error(const char *const roomjid, const char *const nick, const char *const error);
|
||||
void mucwin_role_set_error(ProfMucWin *mucwin, const char *const nick, 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(ProfMucWin *mucwin, const char *const role, GSList *nicks);
|
||||
void mucwin_kick_error(ProfMucWin *mucwin, const char *const nick, const char *const error);
|
||||
|
||||
// xml console
|
||||
void xmlwin_show(ProfXMLWin *xmlwin, const char *const msg);
|
||||
|
@ -54,6 +54,7 @@
|
||||
#include "muc.h"
|
||||
#include "profanity.h"
|
||||
#include "ui/ui.h"
|
||||
#include "window_list.h"
|
||||
#include "config/preferences.h"
|
||||
#include "event/server_events.h"
|
||||
#include "xmpp/capabilities.h"
|
||||
@ -1283,7 +1284,10 @@ _room_affiliation_set_result_handler(xmpp_conn_t *const conn, xmpp_stanza_t *con
|
||||
if (g_strcmp0(type, STANZA_TYPE_ERROR) == 0) {
|
||||
char *error_message = stanza_get_error_message(stanza);
|
||||
log_debug("Error setting affiliation %s list for room %s, user %s: %s", affiliation_set->privilege, from, affiliation_set->item, error_message);
|
||||
mucwin_affiliation_set_error(from, affiliation_set->item, affiliation_set->privilege, error_message);
|
||||
ProfMucWin *mucwin = wins_get_muc(from);
|
||||
if (mucwin) {
|
||||
mucwin_affiliation_set_error(mucwin, affiliation_set->item, affiliation_set->privilege, error_message);
|
||||
}
|
||||
free(error_message);
|
||||
}
|
||||
|
||||
@ -1313,7 +1317,10 @@ _room_role_set_result_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stan
|
||||
if (g_strcmp0(type, STANZA_TYPE_ERROR) == 0) {
|
||||
char *error_message = stanza_get_error_message(stanza);
|
||||
log_debug("Error setting role %s list for room %s, user %s: %s", role_set->privilege, from, role_set->item, error_message);
|
||||
mucwin_role_set_error(from, role_set->item, role_set->privilege, error_message);
|
||||
ProfMucWin *mucwin = wins_get_muc(from);
|
||||
if (mucwin) {
|
||||
mucwin_role_set_error(mucwin, role_set->item, role_set->privilege, error_message);
|
||||
}
|
||||
free(error_message);
|
||||
}
|
||||
|
||||
@ -1342,7 +1349,10 @@ _room_affiliation_list_result_handler(xmpp_conn_t *const conn, xmpp_stanza_t *co
|
||||
if (g_strcmp0(type, STANZA_TYPE_ERROR) == 0) {
|
||||
char *error_message = stanza_get_error_message(stanza);
|
||||
log_debug("Error retrieving %s list for room %s: %s", affiliation, from, error_message);
|
||||
mucwin_affiliation_list_error(from, affiliation, error_message);
|
||||
ProfMucWin *mucwin = wins_get_muc(from);
|
||||
if (mucwin) {
|
||||
mucwin_affiliation_list_error(mucwin, affiliation, error_message);
|
||||
}
|
||||
free(error_message);
|
||||
free(affiliation);
|
||||
return 0;
|
||||
@ -1365,7 +1375,10 @@ _room_affiliation_list_result_handler(xmpp_conn_t *const conn, xmpp_stanza_t *co
|
||||
}
|
||||
|
||||
muc_jid_autocomplete_add_all(from, jids);
|
||||
mucwin_handle_affiliation_list(from, affiliation, jids);
|
||||
ProfMucWin *mucwin = wins_get_muc(from);
|
||||
if (mucwin) {
|
||||
mucwin_handle_affiliation_list(mucwin, affiliation, jids);
|
||||
}
|
||||
free(affiliation);
|
||||
g_slist_free(jids);
|
||||
|
||||
@ -1390,7 +1403,10 @@ _room_role_list_result_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const sta
|
||||
if (g_strcmp0(type, STANZA_TYPE_ERROR) == 0) {
|
||||
char *error_message = stanza_get_error_message(stanza);
|
||||
log_debug("Error retrieving %s list for room %s: %s", role, from, error_message);
|
||||
mucwin_role_list_error(from, role, error_message);
|
||||
ProfMucWin *mucwin = wins_get_muc(from);
|
||||
if (mucwin) {
|
||||
mucwin_role_list_error(mucwin, role, error_message);
|
||||
}
|
||||
free(error_message);
|
||||
free(role);
|
||||
return 0;
|
||||
@ -1412,7 +1428,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);
|
||||
g_slist_free(nicks);
|
||||
|
||||
@ -1461,12 +1480,11 @@ _room_kick_result_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza,
|
||||
}
|
||||
|
||||
// handle error responses
|
||||
if (g_strcmp0(type, STANZA_TYPE_ERROR) == 0) {
|
||||
ProfMucWin *mucwin = wins_get_muc(from);
|
||||
if (mucwin && (g_strcmp0(type, STANZA_TYPE_ERROR) == 0)) {
|
||||
char *error_message = stanza_get_error_message(stanza);
|
||||
mucwin_kick_error(from, nick, error_message);
|
||||
mucwin_kick_error(mucwin, nick, error_message);
|
||||
free(error_message);
|
||||
free(nick);
|
||||
return 0;
|
||||
}
|
||||
|
||||
free(nick);
|
||||
@ -1505,9 +1523,10 @@ _room_info_response_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza
|
||||
|
||||
// handle error responses
|
||||
if (g_strcmp0(type, STANZA_TYPE_ERROR) == 0) {
|
||||
if (cb_data->display) {
|
||||
ProfMucWin *mucwin = wins_get_muc(cb_data->room);
|
||||
if (mucwin && cb_data->display) {
|
||||
char *error_message = stanza_get_error_message(stanza);
|
||||
mucwin_room_info_error(cb_data->room, error_message);
|
||||
mucwin_room_info_error(mucwin, error_message);
|
||||
free(error_message);
|
||||
}
|
||||
free(cb_data->room);
|
||||
@ -1560,8 +1579,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);
|
||||
|
@ -191,53 +191,49 @@ void ui_outgoing_private_msg(ProfPrivateWin *privwin, const char * const message
|
||||
void ui_room_join(const char * const roomjid, gboolean focus) {}
|
||||
void ui_switch_to_room(const char * const roomjid) {}
|
||||
|
||||
void mucwin_role_change(const char * const roomjid, const char * const role, const char * const actor,
|
||||
void mucwin_role_change(ProfMucWin *mucwin, const char * const role, const char * const actor,
|
||||
const char * const reason) {}
|
||||
void mucwin_affiliation_change(const char * const roomjid, const char * const affiliation, const char * const actor,
|
||||
void mucwin_affiliation_change(ProfMucWin *mucwin, const char * const affiliation, const char * const actor,
|
||||
const char * const reason) {}
|
||||
void mucwin_role_and_affiliation_change(const char * const roomjid, const char * const role,
|
||||
void mucwin_role_and_affiliation_change(ProfMucWin *mucwin, const char * const role,
|
||||
const char * const affiliation, const char * const actor, const char * const reason) {}
|
||||
void mucwin_occupant_role_change(const char * const roomjid, const char * const nick, const char * const role,
|
||||
void mucwin_occupant_role_change(ProfMucWin *mucwin, const char * const nick, const char * const role,
|
||||
const char * const actor, const char * const reason) {}
|
||||
void mucwin_occupant_affiliation_change(const char * const roomjid, const char * const nick, const char * const affiliation,
|
||||
void mucwin_occupant_affiliation_change(ProfMucWin *mucwin, const char * const nick, const char * const affiliation,
|
||||
const char * const actor, const char * const reason) {}
|
||||
void mucwin_occupant_role_and_affiliation_change(const char * const roomjid, const char * const nick, const char * const role,
|
||||
void mucwin_occupant_role_and_affiliation_change(ProfMucWin *mucwin, const char * const nick, const char * const role,
|
||||
const char * const affiliation, const char * const actor, const char * const reason) {}
|
||||
void mucwin_roster(const char * const roomjid, GList *occupants, const char * const presence) {}
|
||||
void mucwin_history(const char * const roomjid, const char * const nick,
|
||||
GDateTime *timestamp, const char * const message) {}
|
||||
void mucwin_message(const char * const roomjid, const char * const nick,
|
||||
const char * const message) {}
|
||||
void mucwin_subject(const char * const roomjid, const char * const nick, const char * const subject) {}
|
||||
void mucwin_requires_config(const char * const roomjid) {}
|
||||
void mucwin_roster(ProfMucWin *mucwin, GList *occupants, const char * const presence) {}
|
||||
void mucwin_history(ProfMucWin *mucwin, const char * const nick, GDateTime *timestamp, const char * const message) {}
|
||||
void mucwin_message(ProfMucWin *mucwin, const char * const nick, const char * const message) {}
|
||||
void mucwin_subject(ProfMucWin *mucwin, const char * const nick, const char * const subject) {}
|
||||
void mucwin_requires_config(ProfMucWin *mucwin) {}
|
||||
void ui_room_destroy(const char * const roomjid) {}
|
||||
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(const char * const roomjid, const char * const error) {}
|
||||
void mucwin_room_disco_info(const char * const roomjid, GSList *identities, GSList *features) {}
|
||||
void mucwin_room_info_error(ProfMucWin *mucwin, const char * const error) {}
|
||||
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) {}
|
||||
void mucwin_occupant_kicked(const char * const roomjid, const char * const nick, const char * const actor,
|
||||
void mucwin_occupant_kicked(ProfMucWin *mucwin, const char * const nick, const char * const actor,
|
||||
const char * const reason) {}
|
||||
void ui_room_banned(const char * const roomjid, const char * const actor, const char * const reason) {}
|
||||
void mucwin_occupant_banned(const char * const roomjid, const char * const nick, const char * const actor,
|
||||
void mucwin_occupant_banned(ProfMucWin *mucwin, const char * const nick, const char * const actor,
|
||||
const char * const reason) {}
|
||||
void ui_leave_room(const char * const roomjid) {}
|
||||
void mucwin_broadcast(const char * const roomjid,
|
||||
const char * const message) {}
|
||||
void mucwin_occupant_offline(const char * const roomjid, const char * const nick) {}
|
||||
void mucwin_occupant_online(const char * const roomjid, const char * const nick, const char * const roles,
|
||||
void mucwin_broadcast(ProfMucWin *mucwin, const char * const message) {}
|
||||
void mucwin_occupant_offline(ProfMucWin *mucwin, const char * const nick) {}
|
||||
void mucwin_occupant_online(ProfMucWin *mucwin, const char * const nick, const char * const roles,
|
||||
const char * const affiliation, const char * const show, const char * const status) {}
|
||||
void mucwin_occupant_nick_change(const char * const roomjid,
|
||||
const char * const old_nick, const char * const nick) {}
|
||||
void mucwin_nick_change(const char * const roomjid, const char * const nick) {}
|
||||
void mucwin_occupant_presence(const char * const roomjid,
|
||||
const char * const nick, const char * const show, const char * const status) {}
|
||||
void mucwin_update_occupants(const char * const roomjid) {}
|
||||
void mucwin_show_occupants(const char * const roomjid) {}
|
||||
void mucwin_hide_occupants(const char * const roomjid) {}
|
||||
void mucwin_occupant_nick_change(ProfMucWin *mucwin, const char * const old_nick, const char * const nick) {}
|
||||
void mucwin_nick_change(ProfMucWin *mucwin, const char * const nick) {}
|
||||
void mucwin_occupant_presence(ProfMucWin *mucwin, const char * const nick, const char * const show,
|
||||
const char * const status) {}
|
||||
void mucwin_update_occupants(ProfMucWin *mucwin) {}
|
||||
void mucwin_show_occupants(ProfMucWin *mucwin) {}
|
||||
void mucwin_hide_occupants(ProfMucWin *mucwin) {}
|
||||
void ui_show_roster(void) {}
|
||||
void ui_hide_roster(void) {}
|
||||
void ui_roster_add(const char * const barejid, const char * const name) {}
|
||||
@ -275,16 +271,15 @@ void ui_handle_room_configuration(const char * const roomjid, DataForm *form) {}
|
||||
void ui_handle_room_configuration_form_error(const char * const roomjid, const char * const message) {}
|
||||
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,
|
||||
void mucwin_affiliation_list_error(ProfMucWin *mucwin, const char * const affiliation, const char * const error) {}
|
||||
void mucwin_handle_affiliation_list(ProfMucWin *mucwin, const char * const affiliation, GSList *jids) {}
|
||||
void mucwin_affiliation_set_error(ProfMucWin *mucwin, const char * const jid, const char * const affiliation,
|
||||
const char * const error) {}
|
||||
void mucwin_handle_affiliation_list(const char * const roomjid, const char * const affiliation, GSList *jids) {}
|
||||
void mucwin_affiliation_set_error(const char * const roomjid, const char * const jid,
|
||||
const char * const affiliation, const char * const error) {}
|
||||
void mucwin_role_set_error(const char * const roomjid, const char * const nick, const char * const role,
|
||||
void mucwin_role_set_error(ProfMucWin *mucwin, const char * const nick, const char * const role,
|
||||
const char * const error) {}
|
||||
void mucwin_role_list_error(const char * const roomjid, 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_kick_error(const char * const roomjid, const char * const nick, const char * const error) {}
|
||||
void mucwin_role_list_error(ProfMucWin *mucwin, const char * const role, const char * const error) {}
|
||||
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 ui_show_form(ProfMucConfWin *confwin) {}
|
||||
void ui_show_form_field(ProfWin *window, DataForm *form, char *tag) {}
|
||||
void ui_show_form_help(ProfMucConfWin *confwin) {}
|
||||
|
Loading…
Reference in New Issue
Block a user