2015-11-01 15:05:43 -05:00
|
|
|
/*
|
|
|
|
* mucwin.c
|
2019-11-13 06:11:05 -05:00
|
|
|
* vim: expandtab:ts=4:sts=4:sw=4
|
2015-11-01 15:05:43 -05:00
|
|
|
*
|
2019-01-22 05:31:45 -05:00
|
|
|
* Copyright (C) 2012 - 2019 James Booth <boothj5@gmail.com>
|
2023-01-10 04:37:25 -05:00
|
|
|
* Copyright (C) 2019 - 2023 Michael Vetter <jubalh@iodoru.org>
|
2015-11-01 15:05:43 -05:00
|
|
|
*
|
|
|
|
* This file is part of Profanity.
|
|
|
|
*
|
|
|
|
* Profanity is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* Profanity is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2016-07-23 20:14:49 -04:00
|
|
|
* along with Profanity. If not, see <https://www.gnu.org/licenses/>.
|
2015-11-01 15:05:43 -05:00
|
|
|
*
|
|
|
|
* In addition, as a special exception, the copyright holders give permission to
|
|
|
|
* link the code of portions of this program with the OpenSSL library under
|
|
|
|
* certain conditions as described in each individual source file, and
|
|
|
|
* distribute linked combinations including the two.
|
|
|
|
*
|
|
|
|
* You must obey the GNU General Public License in all respects for all of the
|
|
|
|
* code used other than OpenSSL. If you modify file(s) with this exception, you
|
|
|
|
* may extend this exception to your version of the file(s), but you are not
|
|
|
|
* obligated to do so. If you do not wish to do so, delete this exception
|
|
|
|
* statement from your version. If you delete this exception statement from all
|
|
|
|
* source files in the program, then also delete it here.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2021-03-26 14:51:46 -04:00
|
|
|
#include "config.h"
|
|
|
|
|
2021-03-05 07:29:36 -05:00
|
|
|
#include "ui.h"
|
2016-02-28 14:05:26 -05:00
|
|
|
|
2020-07-07 07:53:30 -04:00
|
|
|
#include <string.h>
|
2015-11-01 17:42:31 -05:00
|
|
|
#include <assert.h>
|
2016-02-23 19:59:28 -05:00
|
|
|
#include <stdlib.h>
|
2015-11-01 17:42:31 -05:00
|
|
|
|
2015-11-01 15:05:43 -05:00
|
|
|
#include "log.h"
|
2020-07-07 07:53:30 -04:00
|
|
|
#include "config/preferences.h"
|
2016-04-07 19:11:33 -04:00
|
|
|
#include "plugins/plugins.h"
|
2016-07-24 10:43:51 -04:00
|
|
|
#include "ui/window.h"
|
2020-07-07 07:53:30 -04:00
|
|
|
#include "ui/win_types.h"
|
2016-07-24 10:43:51 -04:00
|
|
|
#include "ui/window_list.h"
|
2019-04-15 16:09:47 -04:00
|
|
|
#ifdef HAVE_OMEMO
|
|
|
|
#include "omemo/omemo.h"
|
|
|
|
#endif
|
|
|
|
|
2020-07-07 08:18:57 -04:00
|
|
|
static void _mucwin_set_last_message(ProfMucWin* mucwin, const char* const id, const char* const message);
|
2020-02-12 08:06:00 -05:00
|
|
|
|
2019-04-15 16:09:47 -04:00
|
|
|
ProfMucWin*
|
2020-07-07 08:18:57 -04:00
|
|
|
mucwin_new(const char* const barejid)
|
2019-04-15 16:09:47 -04:00
|
|
|
{
|
2020-07-07 08:18:57 -04:00
|
|
|
ProfWin* window = wins_new_muc(barejid);
|
|
|
|
ProfMucWin* mucwin = (ProfMucWin*)window;
|
2019-04-15 16:09:47 -04:00
|
|
|
|
2019-06-11 00:35:03 -04:00
|
|
|
mucwin->last_msg_timestamp = NULL;
|
|
|
|
|
2019-04-15 16:09:47 -04:00
|
|
|
#ifdef HAVE_OMEMO
|
2019-04-17 06:41:19 -04:00
|
|
|
if (muc_anonymity_type(mucwin->roomjid) == MUC_ANONYMITY_TYPE_NONANONYMOUS && omemo_automatic_start(barejid)) {
|
2019-04-15 16:09:47 -04:00
|
|
|
omemo_start_muc_sessions(barejid);
|
|
|
|
mucwin->is_omemo = TRUE;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2021-03-05 07:29:36 -05:00
|
|
|
// Force redraw here to show correct offline users; before this point muc_members returns a wrong list
|
|
|
|
ui_redraw_all_room_rosters();
|
2019-04-15 16:09:47 -04:00
|
|
|
return mucwin;
|
|
|
|
}
|
2015-11-01 15:05:43 -05:00
|
|
|
|
|
|
|
void
|
2020-07-07 08:18:57 -04:00
|
|
|
mucwin_role_change(ProfMucWin* mucwin, const char* const role, const char* const actor, const char* const reason)
|
2015-11-01 15:05:43 -05:00
|
|
|
{
|
2015-11-01 17:42:31 -05:00
|
|
|
assert(mucwin != NULL);
|
|
|
|
|
2020-07-07 08:18:57 -04:00
|
|
|
ProfWin* window = (ProfWin*)mucwin;
|
2020-02-20 12:11:08 -05:00
|
|
|
win_print(window, THEME_ROOMINFO, "!", "Your role has been changed to: %s", role);
|
2015-11-01 15:05:43 -05:00
|
|
|
if (actor) {
|
2016-10-15 14:53:49 -04:00
|
|
|
win_append(window, THEME_ROOMINFO, ", by: %s", actor);
|
2015-11-01 15:05:43 -05:00
|
|
|
}
|
|
|
|
if (reason) {
|
2016-10-15 14:53:49 -04:00
|
|
|
win_append(window, THEME_ROOMINFO, ", reason: %s", reason);
|
2015-11-01 15:05:43 -05:00
|
|
|
}
|
2016-10-15 14:19:44 -04:00
|
|
|
win_appendln(window, THEME_ROOMINFO, "");
|
2015-11-01 15:05:43 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2020-07-07 08:18:57 -04:00
|
|
|
mucwin_affiliation_change(ProfMucWin* mucwin, const char* const affiliation, const char* const actor,
|
|
|
|
const char* const reason)
|
2015-11-01 15:05:43 -05:00
|
|
|
{
|
2015-11-01 17:46:24 -05:00
|
|
|
assert(mucwin != NULL);
|
|
|
|
|
2020-07-07 08:18:57 -04:00
|
|
|
ProfWin* window = (ProfWin*)mucwin;
|
2020-02-20 12:11:08 -05:00
|
|
|
win_print(window, THEME_ROOMINFO, "!", "Your affiliation has been changed to: %s", affiliation);
|
2015-11-01 15:05:43 -05:00
|
|
|
if (actor) {
|
2016-10-15 14:53:49 -04:00
|
|
|
win_append(window, THEME_ROOMINFO, ", by: %s", actor);
|
2015-11-01 15:05:43 -05:00
|
|
|
}
|
|
|
|
if (reason) {
|
2016-10-15 14:53:49 -04:00
|
|
|
win_append(window, THEME_ROOMINFO, ", reason: %s", reason);
|
2015-11-01 15:05:43 -05:00
|
|
|
}
|
2016-10-15 14:19:44 -04:00
|
|
|
win_appendln(window, THEME_ROOMINFO, "");
|
2015-11-01 15:05:43 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2020-07-07 08:18:57 -04:00
|
|
|
mucwin_role_and_affiliation_change(ProfMucWin* mucwin, const char* const role, const char* const affiliation,
|
|
|
|
const char* const actor, const char* const reason)
|
2015-11-01 15:05:43 -05:00
|
|
|
{
|
2015-11-01 18:08:02 -05:00
|
|
|
assert(mucwin != NULL);
|
|
|
|
|
2020-07-07 08:18:57 -04:00
|
|
|
ProfWin* window = (ProfWin*)mucwin;
|
2020-02-20 12:11:08 -05:00
|
|
|
win_print(window, THEME_ROOMINFO, "!", "Your role and affiliation have been changed, role: %s, affiliation: %s", role, affiliation);
|
2015-11-01 15:05:43 -05:00
|
|
|
if (actor) {
|
2016-10-15 14:53:49 -04:00
|
|
|
win_append(window, THEME_ROOMINFO, ", by: %s", actor);
|
2015-11-01 15:05:43 -05:00
|
|
|
}
|
|
|
|
if (reason) {
|
2016-10-15 14:53:49 -04:00
|
|
|
win_append(window, THEME_ROOMINFO, ", reason: %s", reason);
|
2015-11-01 15:05:43 -05:00
|
|
|
}
|
2016-10-15 14:19:44 -04:00
|
|
|
win_appendln(window, THEME_ROOMINFO, "");
|
2015-11-01 15:05:43 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2020-07-07 08:18:57 -04:00
|
|
|
mucwin_occupant_role_change(ProfMucWin* mucwin, const char* const nick, const char* const role,
|
|
|
|
const char* const actor, const char* const reason)
|
2015-11-01 15:05:43 -05:00
|
|
|
{
|
2015-11-01 18:12:35 -05:00
|
|
|
assert(mucwin != NULL);
|
|
|
|
|
2020-07-07 08:18:57 -04:00
|
|
|
ProfWin* window = (ProfWin*)mucwin;
|
2020-02-20 12:11:08 -05:00
|
|
|
win_print(window, THEME_ROOMINFO, "!", "%s's role has been changed to: %s", nick, role);
|
2015-11-01 15:05:43 -05:00
|
|
|
if (actor) {
|
2016-10-15 14:53:49 -04:00
|
|
|
win_append(window, THEME_ROOMINFO, ", by: %s", actor);
|
2015-11-01 15:05:43 -05:00
|
|
|
}
|
|
|
|
if (reason) {
|
2016-10-15 14:53:49 -04:00
|
|
|
win_append(window, THEME_ROOMINFO, ", reason: %s", reason);
|
2015-11-01 15:05:43 -05:00
|
|
|
}
|
2016-10-15 14:19:44 -04:00
|
|
|
win_appendln(window, THEME_ROOMINFO, "");
|
2015-11-01 15:05:43 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2020-07-07 08:18:57 -04:00
|
|
|
mucwin_occupant_affiliation_change(ProfMucWin* mucwin, const char* const nick, const char* const affiliation,
|
|
|
|
const char* const actor, const char* const reason)
|
2015-11-01 15:05:43 -05:00
|
|
|
{
|
2015-11-01 18:14:27 -05:00
|
|
|
assert(mucwin != NULL);
|
|
|
|
|
2020-07-07 08:18:57 -04:00
|
|
|
ProfWin* window = (ProfWin*)mucwin;
|
2020-02-20 12:11:08 -05:00
|
|
|
win_print(window, THEME_ROOMINFO, "!", "%s's affiliation has been changed to: %s", nick, affiliation);
|
2015-11-01 15:05:43 -05:00
|
|
|
if (actor) {
|
2016-10-15 14:53:49 -04:00
|
|
|
win_append(window, THEME_ROOMINFO, ", by: %s", actor);
|
2015-11-01 15:05:43 -05:00
|
|
|
}
|
|
|
|
if (reason) {
|
2016-10-15 14:53:49 -04:00
|
|
|
win_append(window, THEME_ROOMINFO, ", reason: %s", reason);
|
2015-11-01 15:05:43 -05:00
|
|
|
}
|
2016-10-15 14:19:44 -04:00
|
|
|
win_appendln(window, THEME_ROOMINFO, "");
|
2015-11-01 15:05:43 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2020-07-07 08:18:57 -04:00
|
|
|
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)
|
2015-11-01 15:05:43 -05:00
|
|
|
{
|
2015-11-01 18:15:49 -05:00
|
|
|
assert(mucwin != NULL);
|
|
|
|
|
2020-07-07 08:18:57 -04:00
|
|
|
ProfWin* window = (ProfWin*)mucwin;
|
2020-02-20 12:11:08 -05:00
|
|
|
win_print(window, THEME_ROOMINFO, "!", "%s's role and affiliation have been changed, role: %s, affiliation: %s", nick, role, affiliation);
|
2015-11-01 15:05:43 -05:00
|
|
|
if (actor) {
|
2016-10-15 14:53:49 -04:00
|
|
|
win_append(window, THEME_ROOMINFO, ", by: %s", actor);
|
2015-11-01 15:05:43 -05:00
|
|
|
}
|
|
|
|
if (reason) {
|
2016-10-15 14:53:49 -04:00
|
|
|
win_append(window, THEME_ROOMINFO, ", reason: %s", reason);
|
2015-11-01 15:05:43 -05:00
|
|
|
}
|
2016-10-15 14:19:44 -04:00
|
|
|
win_appendln(window, THEME_ROOMINFO, "");
|
2015-11-01 15:05:43 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2020-07-07 08:18:57 -04:00
|
|
|
mucwin_room_info_error(ProfMucWin* mucwin, const char* const error)
|
2015-11-01 15:05:43 -05:00
|
|
|
{
|
2015-11-01 18:30:44 -05:00
|
|
|
assert(mucwin != NULL);
|
|
|
|
|
2020-07-07 08:18:57 -04:00
|
|
|
ProfWin* window = (ProfWin*)mucwin;
|
2020-02-20 12:11:08 -05:00
|
|
|
win_println(window, THEME_DEFAULT, "!", "Room info request failed: %s", error);
|
|
|
|
win_println(window, THEME_DEFAULT, "-", "");
|
2015-11-01 15:05:43 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2020-07-07 08:18:57 -04:00
|
|
|
mucwin_room_disco_info(ProfMucWin* mucwin, GSList* identities, GSList* features)
|
2015-11-01 15:05:43 -05:00
|
|
|
{
|
2015-11-01 18:33:50 -05:00
|
|
|
assert(mucwin != NULL);
|
2015-11-01 15:05:43 -05:00
|
|
|
|
2020-07-07 08:18:57 -04:00
|
|
|
ProfWin* window = (ProfWin*)mucwin;
|
|
|
|
if ((identities && (g_slist_length(identities) > 0)) || (features && (g_slist_length(features) > 0))) {
|
2015-11-01 18:33:50 -05:00
|
|
|
if (identities) {
|
2020-02-20 12:11:08 -05:00
|
|
|
win_println(window, THEME_DEFAULT, "!", "Identities:");
|
2015-11-01 18:33:50 -05:00
|
|
|
}
|
|
|
|
while (identities) {
|
2023-04-03 11:27:37 -04:00
|
|
|
DiscoIdentity* identity = identities->data; // name, type, category
|
2020-07-07 08:18:57 -04:00
|
|
|
GString* identity_str = g_string_new(" ");
|
2015-11-01 18:33:50 -05:00
|
|
|
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, " ");
|
2015-11-01 15:05:43 -05:00
|
|
|
}
|
2015-11-01 18:33:50 -05:00
|
|
|
if (identity->category) {
|
|
|
|
identity_str = g_string_append(identity_str, identity->category);
|
2015-11-01 15:05:43 -05:00
|
|
|
}
|
2020-02-20 12:11:08 -05:00
|
|
|
win_println(window, THEME_DEFAULT, "!", "%s", identity_str->str);
|
2015-11-01 18:33:50 -05:00
|
|
|
g_string_free(identity_str, TRUE);
|
|
|
|
identities = g_slist_next(identities);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (features) {
|
2020-02-20 12:11:08 -05:00
|
|
|
win_println(window, THEME_DEFAULT, "!", "Features:");
|
2015-11-01 18:33:50 -05:00
|
|
|
}
|
|
|
|
while (features) {
|
2020-02-20 12:11:08 -05:00
|
|
|
win_println(window, THEME_DEFAULT, "!", " %s", features->data);
|
2015-11-01 18:33:50 -05:00
|
|
|
features = g_slist_next(features);
|
2015-11-01 15:05:43 -05:00
|
|
|
}
|
2020-02-20 12:11:08 -05:00
|
|
|
win_println(window, THEME_DEFAULT, "-", "");
|
2015-11-01 15:05:43 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2020-07-07 08:18:57 -04:00
|
|
|
mucwin_roster(ProfMucWin* mucwin, GList* roster, const char* const presence)
|
2015-11-01 15:05:43 -05:00
|
|
|
{
|
2015-11-01 18:41:45 -05:00
|
|
|
assert(mucwin != NULL);
|
|
|
|
|
2020-07-07 08:18:57 -04:00
|
|
|
ProfWin* window = (ProfWin*)mucwin;
|
2015-11-01 18:41:45 -05:00
|
|
|
if ((roster == NULL) || (g_list_length(roster) == 0)) {
|
|
|
|
if (presence == NULL) {
|
2020-02-20 12:11:08 -05:00
|
|
|
win_println(window, THEME_ROOMINFO, "!", "Room is empty.");
|
2015-11-01 18:41:45 -05:00
|
|
|
} else {
|
2020-02-20 12:11:08 -05:00
|
|
|
win_println(window, THEME_ROOMINFO, "!", "No occupants %s.", presence);
|
2015-11-01 18:41:45 -05:00
|
|
|
}
|
2015-11-01 15:05:43 -05:00
|
|
|
} else {
|
2015-11-01 18:41:45 -05:00
|
|
|
int length = g_list_length(roster);
|
|
|
|
if (presence == NULL) {
|
2020-02-20 12:11:08 -05:00
|
|
|
win_print(window, THEME_ROOMINFO, "!", "%d occupants: ", length);
|
2015-11-01 15:05:43 -05:00
|
|
|
} else {
|
2020-02-20 12:11:08 -05:00
|
|
|
win_print(window, THEME_ROOMINFO, "!", "%d %s: ", length, presence);
|
2015-11-01 18:41:45 -05:00
|
|
|
}
|
2015-11-01 15:05:43 -05:00
|
|
|
|
2015-11-01 18:41:45 -05:00
|
|
|
while (roster) {
|
2020-07-07 08:18:57 -04:00
|
|
|
Occupant* occupant = roster->data;
|
|
|
|
const char* presence_str = string_from_resource_presence(occupant->presence);
|
2015-11-01 15:05:43 -05:00
|
|
|
|
2015-11-01 18:41:45 -05:00
|
|
|
theme_item_t presence_colour = theme_main_presence_attrs(presence_str);
|
2016-10-15 14:53:49 -04:00
|
|
|
win_append(window, presence_colour, "%s", occupant->nick);
|
2015-11-01 15:05:43 -05:00
|
|
|
|
2015-11-01 18:41:45 -05:00
|
|
|
if (roster->next) {
|
2016-10-15 14:53:49 -04:00
|
|
|
win_append(window, THEME_DEFAULT, ", ");
|
2015-11-01 15:05:43 -05:00
|
|
|
}
|
|
|
|
|
2015-11-01 18:41:45 -05:00
|
|
|
roster = g_list_next(roster);
|
2015-11-01 15:05:43 -05:00
|
|
|
}
|
2016-10-15 14:19:44 -04:00
|
|
|
win_appendln(window, THEME_ONLINE, "");
|
2015-11-01 15:05:43 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2020-07-07 08:18:57 -04:00
|
|
|
mucwin_occupant_offline(ProfMucWin* mucwin, const char* const nick)
|
2015-11-01 15:05:43 -05:00
|
|
|
{
|
2015-11-01 18:45:54 -05:00
|
|
|
assert(mucwin != NULL);
|
|
|
|
|
2020-07-07 08:18:57 -04:00
|
|
|
ProfWin* window = (ProfWin*)mucwin;
|
2020-02-20 12:11:08 -05:00
|
|
|
win_println(window, THEME_OFFLINE, "!", "<- %s has left the room.", nick);
|
2015-11-01 15:05:43 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2020-07-07 08:18:57 -04:00
|
|
|
mucwin_occupant_kicked(ProfMucWin* mucwin, const char* const nick, const char* const actor,
|
|
|
|
const char* const reason)
|
2015-11-01 15:05:43 -05:00
|
|
|
{
|
2015-11-01 18:47:59 -05:00
|
|
|
assert(mucwin != NULL);
|
2015-11-01 15:05:43 -05:00
|
|
|
|
2020-07-07 08:18:57 -04:00
|
|
|
ProfWin* window = (ProfWin*)mucwin;
|
|
|
|
GString* message = g_string_new(nick);
|
2015-11-01 18:47:59 -05:00
|
|
|
g_string_append(message, " has been kicked from the room");
|
|
|
|
if (actor) {
|
|
|
|
g_string_append(message, " by ");
|
|
|
|
g_string_append(message, actor);
|
2015-11-01 15:05:43 -05:00
|
|
|
}
|
2015-11-01 18:47:59 -05:00
|
|
|
if (reason) {
|
|
|
|
g_string_append(message, ", reason: ");
|
|
|
|
g_string_append(message, reason);
|
|
|
|
}
|
|
|
|
|
2020-02-20 12:11:08 -05:00
|
|
|
win_println(window, THEME_OFFLINE, "!", "<- %s", message->str);
|
2015-11-01 18:47:59 -05:00
|
|
|
g_string_free(message, TRUE);
|
2015-11-01 15:05:43 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2020-07-07 08:18:57 -04:00
|
|
|
mucwin_occupant_banned(ProfMucWin* mucwin, const char* const nick, const char* const actor,
|
|
|
|
const char* const reason)
|
2015-11-01 15:05:43 -05:00
|
|
|
{
|
2015-11-01 18:49:45 -05:00
|
|
|
assert(mucwin != NULL);
|
2015-11-01 15:05:43 -05:00
|
|
|
|
2020-07-07 08:18:57 -04:00
|
|
|
ProfWin* window = (ProfWin*)mucwin;
|
|
|
|
GString* message = g_string_new(nick);
|
2015-11-01 18:49:45 -05:00
|
|
|
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);
|
2015-11-01 15:05:43 -05:00
|
|
|
}
|
2015-11-01 18:49:45 -05:00
|
|
|
|
2020-02-20 12:11:08 -05:00
|
|
|
win_println(window, THEME_OFFLINE, "!", "<- %s", message->str);
|
2015-11-01 18:49:45 -05:00
|
|
|
g_string_free(message, TRUE);
|
2015-11-01 15:05:43 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2020-07-07 08:18:57 -04:00
|
|
|
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)
|
2015-11-01 15:05:43 -05:00
|
|
|
{
|
2015-11-01 18:52:16 -05:00
|
|
|
assert(mucwin != NULL);
|
|
|
|
|
2020-07-07 08:18:57 -04:00
|
|
|
ProfWin* window = (ProfWin*)mucwin;
|
2020-02-20 12:11:08 -05:00
|
|
|
win_print(window, THEME_ONLINE, "!", "-> %s has joined the room", nick);
|
2015-11-01 18:52:16 -05:00
|
|
|
if (prefs_get_boolean(PREF_MUC_PRIVILEGES)) {
|
|
|
|
if (role) {
|
2016-10-15 14:53:49 -04:00
|
|
|
win_append(window, THEME_ONLINE, ", role: %s", role);
|
2015-11-01 18:52:16 -05:00
|
|
|
}
|
|
|
|
if (affiliation) {
|
2016-10-15 14:53:49 -04:00
|
|
|
win_append(window, THEME_ONLINE, ", affiliation: %s", affiliation);
|
2015-11-01 15:05:43 -05:00
|
|
|
}
|
|
|
|
}
|
2016-10-15 14:19:44 -04:00
|
|
|
win_appendln(window, THEME_ROOMINFO, "");
|
2015-11-01 15:05:43 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2020-07-07 08:18:57 -04:00
|
|
|
mucwin_occupant_presence(ProfMucWin* mucwin, const char* const nick,
|
|
|
|
const char* const show, const char* const status)
|
2015-11-01 15:05:43 -05:00
|
|
|
{
|
2015-11-01 19:14:16 -05:00
|
|
|
assert(mucwin != NULL);
|
|
|
|
|
2020-07-07 08:18:57 -04:00
|
|
|
ProfWin* window = (ProfWin*)mucwin;
|
2015-11-01 19:14:16 -05:00
|
|
|
win_show_status_string(window, nick, show, status, NULL, "++", "online");
|
2015-11-01 15:05:43 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2020-07-07 08:18:57 -04:00
|
|
|
mucwin_occupant_nick_change(ProfMucWin* mucwin, const char* const old_nick, const char* const nick)
|
2015-11-01 15:05:43 -05:00
|
|
|
{
|
2015-11-01 19:16:01 -05:00
|
|
|
assert(mucwin != NULL);
|
|
|
|
|
2020-07-07 08:18:57 -04:00
|
|
|
ProfWin* window = (ProfWin*)mucwin;
|
2020-02-20 12:11:08 -05:00
|
|
|
win_println(window, THEME_THEM, "!", "** %s is now known as %s", old_nick, nick);
|
2015-11-01 15:05:43 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2020-07-07 08:18:57 -04:00
|
|
|
mucwin_nick_change(ProfMucWin* mucwin, const char* const nick)
|
2015-11-01 15:05:43 -05:00
|
|
|
{
|
2015-11-01 19:17:46 -05:00
|
|
|
assert(mucwin != NULL);
|
|
|
|
|
2020-07-07 08:18:57 -04:00
|
|
|
ProfWin* window = (ProfWin*)mucwin;
|
2020-02-20 12:11:08 -05:00
|
|
|
win_println(window, THEME_ME, "!", "** You are now known as %s", nick);
|
2015-11-01 15:05:43 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2020-07-07 08:18:57 -04:00
|
|
|
mucwin_history(ProfMucWin* mucwin, const ProfMessage* const message)
|
2015-11-01 15:05:43 -05:00
|
|
|
{
|
2015-11-01 19:19:46 -05:00
|
|
|
assert(mucwin != NULL);
|
2015-11-01 15:05:43 -05:00
|
|
|
|
2020-07-07 08:18:57 -04:00
|
|
|
char* nick = message->from_jid->resourcepart;
|
|
|
|
char* mynick = muc_nick(mucwin->roomjid);
|
|
|
|
GSList* mentions = get_mentions(prefs_get_boolean(PREF_NOTIFY_MENTION_WHOLE_WORD), prefs_get_boolean(PREF_NOTIFY_MENTION_CASE_SENSITIVE), message->plain, mynick);
|
|
|
|
GList* triggers = prefs_message_get_triggers(message->plain);
|
2015-11-01 15:05:43 -05:00
|
|
|
|
2020-04-25 11:13:22 -04:00
|
|
|
mucwin_incoming_msg(mucwin, message, mentions, triggers, FALSE);
|
2020-02-20 02:11:58 -05:00
|
|
|
|
2020-04-25 11:13:22 -04:00
|
|
|
g_slist_free(mentions);
|
|
|
|
g_list_free_full(triggers, free);
|
2020-02-20 04:17:17 -05:00
|
|
|
|
2020-02-19 10:57:37 -05:00
|
|
|
plugins_on_room_history_message(mucwin->roomjid, nick, message->plain, message->timestamp);
|
2015-11-01 15:05:43 -05:00
|
|
|
}
|
|
|
|
|
2016-02-10 18:03:23 -05:00
|
|
|
static void
|
2020-07-07 08:18:57 -04:00
|
|
|
_mucwin_print_mention(ProfWin* window, const char* const message, const char* const from, const char* const mynick, GSList* mentions, const char* const ch, int flags)
|
2016-02-10 18:03:23 -05:00
|
|
|
{
|
2016-04-06 20:01:27 -04:00
|
|
|
int last_pos = 0;
|
2020-04-20 10:02:19 -04:00
|
|
|
int pos;
|
2020-07-07 08:18:57 -04:00
|
|
|
GSList* curr = mentions;
|
2021-07-17 12:36:31 -04:00
|
|
|
glong mynick_len = g_utf8_strlen(mynick, -1);
|
|
|
|
|
2016-04-06 20:01:27 -04:00
|
|
|
while (curr) {
|
|
|
|
pos = GPOINTER_TO_INT(curr->data);
|
2016-02-10 18:03:23 -05:00
|
|
|
|
2023-04-18 20:44:19 -04:00
|
|
|
auto_gchar gchar* before_str = g_utf8_substring(message, last_pos, pos);
|
2021-06-08 13:42:41 -04:00
|
|
|
|
2021-07-17 12:36:31 -04:00
|
|
|
if (last_pos == 0 && strncmp(before_str, "/me ", 4) == 0) {
|
2020-02-20 12:11:08 -05:00
|
|
|
win_print_them(window, THEME_ROOMMENTION, ch, flags, "");
|
2019-02-26 06:02:32 -05:00
|
|
|
win_append_highlight(window, THEME_ROOMMENTION, "*%s ", from);
|
|
|
|
win_append_highlight(window, THEME_ROOMMENTION, "%s", before_str + 4);
|
|
|
|
} else {
|
2021-06-08 14:34:24 -04:00
|
|
|
// print time and nick only once at beginning of the line
|
|
|
|
if (last_pos == 0) {
|
|
|
|
win_print_them(window, THEME_ROOMMENTION, ch, flags, from);
|
|
|
|
}
|
2019-02-26 06:02:32 -05:00
|
|
|
win_append_highlight(window, THEME_ROOMMENTION, "%s", before_str);
|
|
|
|
}
|
2021-06-08 13:42:41 -04:00
|
|
|
|
2023-04-18 20:44:19 -04:00
|
|
|
auto_gchar gchar* mynick_str = g_utf8_substring(message, pos, pos + mynick_len);
|
2019-02-26 06:02:32 -05:00
|
|
|
win_append_highlight(window, THEME_ROOMMENTION_TERM, "%s", mynick_str);
|
2016-02-10 18:03:23 -05:00
|
|
|
|
2021-06-08 13:42:41 -04:00
|
|
|
last_pos = pos + mynick_len;
|
2016-02-10 18:03:23 -05:00
|
|
|
|
2016-04-06 20:01:27 -04:00
|
|
|
curr = g_slist_next(curr);
|
|
|
|
}
|
2021-06-08 13:42:41 -04:00
|
|
|
|
|
|
|
glong message_len = g_utf8_strlen(message, -1);
|
|
|
|
if (last_pos < message_len) {
|
2021-07-17 12:33:28 -04:00
|
|
|
// get tail without allocating a new string
|
2023-04-18 20:44:19 -04:00
|
|
|
gchar* rest = g_utf8_offset_to_pointer(message, last_pos);
|
2021-06-08 13:42:41 -04:00
|
|
|
win_appendln_highlight(window, THEME_ROOMMENTION, "%s", rest);
|
2016-02-10 18:03:23 -05:00
|
|
|
} else {
|
2016-10-15 17:12:07 -04:00
|
|
|
win_appendln_highlight(window, THEME_ROOMMENTION, "");
|
2016-02-10 18:03:23 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-02-13 17:55:57 -05:00
|
|
|
gint
|
|
|
|
_cmp_trigger_weight(gconstpointer a, gconstpointer b)
|
|
|
|
{
|
|
|
|
int alen = strlen((char*)a);
|
|
|
|
int blen = strlen((char*)b);
|
|
|
|
|
2020-07-07 08:18:57 -04:00
|
|
|
if (alen > blen)
|
|
|
|
return -1;
|
|
|
|
if (alen < blen)
|
|
|
|
return 1;
|
2016-02-13 17:55:57 -05:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2016-02-13 17:46:25 -05:00
|
|
|
static void
|
2020-07-07 08:18:57 -04:00
|
|
|
_mucwin_print_triggers(ProfWin* window, const char* const message, GList* triggers)
|
2016-02-13 17:46:25 -05:00
|
|
|
{
|
2020-07-07 08:18:57 -04:00
|
|
|
GList* weighted_triggers = NULL;
|
|
|
|
GList* curr = triggers;
|
2016-02-13 17:55:57 -05:00
|
|
|
while (curr) {
|
|
|
|
weighted_triggers = g_list_insert_sorted(weighted_triggers, curr->data, (GCompareFunc)_cmp_trigger_weight);
|
|
|
|
curr = g_list_next(curr);
|
|
|
|
}
|
|
|
|
|
2023-04-18 20:44:19 -04:00
|
|
|
auto_gchar gchar* message_lower = g_utf8_strdown(message, -1);
|
2016-02-13 17:46:25 -05:00
|
|
|
|
|
|
|
// find earliest trigger in message
|
|
|
|
int first_trigger_pos = -1;
|
|
|
|
int first_trigger_len = -1;
|
2016-02-13 17:55:57 -05:00
|
|
|
curr = weighted_triggers;
|
2016-02-13 17:46:25 -05:00
|
|
|
while (curr) {
|
2023-04-18 20:44:19 -04:00
|
|
|
auto_gchar gchar* trigger_lower = g_utf8_strdown(curr->data, -1);
|
|
|
|
gchar* trigger_ptr = g_strstr_len(message_lower, -1, trigger_lower);
|
2016-02-13 17:46:25 -05:00
|
|
|
|
|
|
|
// not found, try next
|
|
|
|
if (trigger_ptr == NULL) {
|
|
|
|
curr = g_list_next(curr);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2020-12-10 03:24:32 -05:00
|
|
|
// found, replace vars if earlier than previous
|
2016-02-13 17:46:25 -05:00
|
|
|
int trigger_pos = trigger_ptr - message_lower;
|
|
|
|
if (first_trigger_pos == -1 || trigger_pos < first_trigger_pos) {
|
|
|
|
first_trigger_pos = trigger_pos;
|
|
|
|
first_trigger_len = strlen(trigger_lower);
|
|
|
|
}
|
|
|
|
|
|
|
|
curr = g_list_next(curr);
|
|
|
|
}
|
|
|
|
|
2016-02-13 17:55:57 -05:00
|
|
|
g_list_free(weighted_triggers);
|
2016-02-13 17:46:25 -05:00
|
|
|
|
|
|
|
// no triggers found
|
|
|
|
if (first_trigger_pos == -1) {
|
2016-10-15 17:12:07 -04:00
|
|
|
win_appendln_highlight(window, THEME_ROOMTRIGGER, "%s", message);
|
2016-02-13 17:46:25 -05:00
|
|
|
} else {
|
|
|
|
if (first_trigger_pos > 0) {
|
|
|
|
char message_section[strlen(message) + 1];
|
|
|
|
int i = 0;
|
|
|
|
while (i < first_trigger_pos) {
|
|
|
|
message_section[i] = message[i];
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
message_section[i] = '\0';
|
2016-10-15 17:12:07 -04:00
|
|
|
win_append_highlight(window, THEME_ROOMTRIGGER, "%s", message_section);
|
2016-02-13 17:46:25 -05:00
|
|
|
}
|
|
|
|
char trigger_section[first_trigger_len + 1];
|
|
|
|
int i = 0;
|
|
|
|
while (i < first_trigger_len) {
|
|
|
|
trigger_section[i] = message[first_trigger_pos + i];
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
trigger_section[i] = '\0';
|
|
|
|
|
|
|
|
if (first_trigger_pos + first_trigger_len < strlen(message)) {
|
2016-10-15 17:12:07 -04:00
|
|
|
win_append_highlight(window, THEME_ROOMTRIGGER_TERM, "%s", trigger_section);
|
2016-02-13 17:46:25 -05:00
|
|
|
_mucwin_print_triggers(window, &message[first_trigger_pos + first_trigger_len], triggers);
|
|
|
|
} else {
|
2016-10-15 17:12:07 -04:00
|
|
|
win_appendln_highlight(window, THEME_ROOMTRIGGER_TERM, "%s", trigger_section);
|
2016-02-13 17:46:25 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-11-01 15:05:43 -05:00
|
|
|
void
|
2020-07-07 08:18:57 -04:00
|
|
|
mucwin_outgoing_msg(ProfMucWin* mucwin, const char* const message, const char* const id, prof_enc_t enc_mode, const char* const replace_id)
|
2015-11-01 15:05:43 -05:00
|
|
|
{
|
2015-11-01 19:24:19 -05:00
|
|
|
assert(mucwin != NULL);
|
2015-11-01 15:05:43 -05:00
|
|
|
|
2020-07-07 08:18:57 -04:00
|
|
|
ProfWin* window = (ProfWin*)mucwin;
|
|
|
|
char* mynick = muc_nick(mucwin->roomjid);
|
2015-11-01 15:05:43 -05:00
|
|
|
|
2020-06-21 03:43:42 -04:00
|
|
|
// displayed message char
|
2020-07-07 08:18:57 -04:00
|
|
|
char* ch;
|
2017-01-20 18:26:14 -05:00
|
|
|
if (mucwin->message_char) {
|
2020-02-20 12:11:08 -05:00
|
|
|
ch = strdup(mucwin->message_char);
|
2019-06-17 00:23:40 -04:00
|
|
|
} else if (enc_mode == PROF_MSG_ENC_OTR) {
|
2019-03-18 14:50:28 -04:00
|
|
|
ch = prefs_get_otr_char();
|
2019-06-17 00:23:40 -04:00
|
|
|
} else if (enc_mode == PROF_MSG_ENC_PGP) {
|
2019-03-18 14:50:28 -04:00
|
|
|
ch = prefs_get_pgp_char();
|
2019-06-17 00:23:40 -04:00
|
|
|
} else if (enc_mode == PROF_MSG_ENC_OMEMO) {
|
2019-03-18 14:50:28 -04:00
|
|
|
ch = prefs_get_omemo_char();
|
2020-06-21 03:43:42 -04:00
|
|
|
} else if (enc_mode == PROF_MSG_ENC_OX) {
|
|
|
|
ch = prefs_get_omemo_char();
|
2020-02-20 12:11:08 -05:00
|
|
|
} else {
|
|
|
|
ch = strdup("-");
|
2017-01-20 18:26:14 -05:00
|
|
|
}
|
|
|
|
|
2020-02-17 06:03:23 -05:00
|
|
|
win_print_outgoing_muc_msg(window, ch, mynick, id, replace_id, message);
|
2020-02-20 12:11:08 -05:00
|
|
|
free(ch);
|
2020-02-12 08:06:00 -05:00
|
|
|
|
|
|
|
// save last id and message for LMC
|
|
|
|
if (id) {
|
|
|
|
_mucwin_set_last_message(mucwin, id, message);
|
|
|
|
}
|
2022-03-20 18:10:07 -04:00
|
|
|
|
2023-02-13 16:40:58 -05:00
|
|
|
wins_add_quotes_ac(window, message, FALSE);
|
2019-03-18 14:50:28 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2020-07-07 08:18:57 -04:00
|
|
|
mucwin_incoming_msg(ProfMucWin* mucwin, const ProfMessage* const message, GSList* mentions, GList* triggers, gboolean filter_reflection)
|
2019-03-18 14:50:28 -04:00
|
|
|
{
|
|
|
|
assert(mucwin != NULL);
|
2019-06-17 00:23:40 -04:00
|
|
|
int flags = 0;
|
2019-03-18 14:50:28 -04:00
|
|
|
|
2022-07-04 10:45:18 -04:00
|
|
|
if (message->plain == NULL) {
|
|
|
|
log_error("mucwin_incoming_msg: Message with no plain field from: %s", message->from_jid);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-02-21 12:46:09 -05:00
|
|
|
if (filter_reflection && message_is_sent_by_us(message, TRUE)) {
|
2019-04-01 13:19:39 -04:00
|
|
|
/* Ignore reflection messages */
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2019-06-17 00:23:40 -04:00
|
|
|
if (!message->trusted) {
|
2019-06-18 00:23:06 -04:00
|
|
|
flags |= UNTRUSTED;
|
2019-06-17 00:23:40 -04:00
|
|
|
}
|
|
|
|
|
2020-07-07 08:18:57 -04:00
|
|
|
ProfWin* window = (ProfWin*)mucwin;
|
|
|
|
char* mynick = muc_nick(mucwin->roomjid);
|
2019-03-18 14:50:28 -04:00
|
|
|
|
2020-07-07 08:18:57 -04:00
|
|
|
char* ch;
|
2019-03-18 14:50:28 -04:00
|
|
|
if (mucwin->message_char) {
|
2020-02-20 12:11:08 -05:00
|
|
|
ch = strdup(mucwin->message_char);
|
2019-06-17 00:23:40 -04:00
|
|
|
} else if (message->enc == PROF_MSG_ENC_OTR) {
|
2019-03-18 14:50:28 -04:00
|
|
|
ch = prefs_get_otr_char();
|
2019-06-17 00:23:40 -04:00
|
|
|
} else if (message->enc == PROF_MSG_ENC_PGP) {
|
2019-03-18 14:50:28 -04:00
|
|
|
ch = prefs_get_pgp_char();
|
2019-06-17 00:23:40 -04:00
|
|
|
} else if (message->enc == PROF_MSG_ENC_OMEMO) {
|
2019-03-18 14:50:28 -04:00
|
|
|
ch = prefs_get_omemo_char();
|
2020-02-20 12:11:08 -05:00
|
|
|
} else {
|
|
|
|
ch = strdup("-");
|
2019-03-18 14:50:28 -04:00
|
|
|
}
|
|
|
|
|
2019-12-13 07:13:02 -05:00
|
|
|
win_insert_last_read_position_marker((ProfWin*)mucwin, mucwin->roomjid);
|
2023-02-13 16:40:58 -05:00
|
|
|
wins_add_urls_ac(window, message, FALSE);
|
|
|
|
wins_add_quotes_ac(window, message->plain, FALSE);
|
2019-12-13 07:13:02 -05:00
|
|
|
|
2019-03-18 14:50:28 -04:00
|
|
|
if (g_slist_length(mentions) > 0) {
|
2020-04-11 11:11:53 -04:00
|
|
|
_mucwin_print_mention(window, message->plain, message->from_jid->resourcepart, mynick, mentions, ch, flags);
|
2019-03-18 14:50:28 -04:00
|
|
|
} else if (triggers) {
|
2020-04-11 11:11:53 -04:00
|
|
|
win_print_them(window, THEME_ROOMTRIGGER, ch, flags, message->from_jid->resourcepart);
|
2019-06-17 00:23:40 -04:00
|
|
|
_mucwin_print_triggers(window, message->plain, triggers);
|
2015-11-01 15:05:43 -05:00
|
|
|
} else {
|
2020-03-09 07:00:15 -04:00
|
|
|
win_println_incoming_muc_msg(window, ch, flags, message);
|
2015-11-01 15:05:43 -05:00
|
|
|
}
|
2020-02-20 12:11:08 -05:00
|
|
|
|
|
|
|
free(ch);
|
2015-11-01 15:05:43 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2020-07-07 08:18:57 -04:00
|
|
|
mucwin_requires_config(ProfMucWin* mucwin)
|
2015-11-01 15:05:43 -05:00
|
|
|
{
|
2015-11-01 19:26:56 -05:00
|
|
|
assert(mucwin != NULL);
|
2015-11-01 15:05:43 -05:00
|
|
|
|
2020-07-07 08:18:57 -04:00
|
|
|
ProfWin* window = (ProfWin*)mucwin;
|
2015-11-01 19:26:56 -05:00
|
|
|
int num = wins_get_num(window);
|
2015-11-01 15:05:43 -05:00
|
|
|
|
2020-02-20 12:11:08 -05:00
|
|
|
win_println(window, THEME_DEFAULT, "-", "");
|
|
|
|
win_println(window, THEME_ROOMINFO, "!", "Room locked, requires configuration.");
|
|
|
|
win_println(window, THEME_ROOMINFO, "!", "Use '/room accept' to accept the defaults");
|
|
|
|
win_println(window, THEME_ROOMINFO, "!", "Use '/room destroy' to cancel and destroy the room");
|
|
|
|
win_println(window, THEME_ROOMINFO, "!", "Use '/room config' to edit the room configuration");
|
|
|
|
win_println(window, THEME_DEFAULT, "-", "");
|
2015-11-01 15:05:43 -05:00
|
|
|
|
2015-11-01 19:26:56 -05:00
|
|
|
// currently in groupchat window
|
|
|
|
if (wins_is_current(window)) {
|
2018-03-09 16:11:59 -05:00
|
|
|
status_bar_active(num, WIN_MUC, mucwin->roomjid);
|
2015-11-01 19:26:56 -05:00
|
|
|
|
2020-07-07 08:18:57 -04:00
|
|
|
// not currently on groupchat window
|
2015-11-01 19:26:56 -05:00
|
|
|
} else {
|
2018-03-09 16:11:59 -05:00
|
|
|
status_bar_new(num, WIN_MUC, mucwin->roomjid);
|
2015-11-01 15:05:43 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2020-07-07 08:18:57 -04:00
|
|
|
mucwin_subject(ProfMucWin* mucwin, const char* const nick, const char* const subject)
|
2015-11-01 15:05:43 -05:00
|
|
|
{
|
2015-11-01 19:29:35 -05:00
|
|
|
assert(mucwin != NULL);
|
2015-11-01 15:05:43 -05:00
|
|
|
|
2020-07-07 08:18:57 -04:00
|
|
|
ProfWin* window = (ProfWin*)mucwin;
|
2015-11-01 19:29:35 -05:00
|
|
|
if (subject) {
|
|
|
|
if (nick) {
|
2020-02-20 12:11:08 -05:00
|
|
|
win_print(window, THEME_ROOMINFO, "!", "*%s has set the room subject: ", nick);
|
2016-10-15 14:19:44 -04:00
|
|
|
win_appendln(window, THEME_DEFAULT, "%s", subject);
|
2015-11-01 15:05:43 -05:00
|
|
|
} else {
|
2020-02-20 12:11:08 -05:00
|
|
|
win_print(window, THEME_ROOMINFO, "!", "Room subject: ");
|
2016-10-15 14:19:44 -04:00
|
|
|
win_appendln(window, THEME_DEFAULT, "%s", subject);
|
2015-11-01 15:05:43 -05:00
|
|
|
}
|
2015-11-01 19:29:35 -05:00
|
|
|
} else {
|
|
|
|
if (nick) {
|
2020-02-20 12:11:08 -05:00
|
|
|
win_println(window, THEME_ROOMINFO, "!", "*%s has cleared the room subject.", nick);
|
2015-11-01 15:05:43 -05:00
|
|
|
} else {
|
2020-02-20 12:11:08 -05:00
|
|
|
win_println(window, THEME_ROOMINFO, "!", "Room subject cleared");
|
2015-11-01 15:05:43 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2020-07-07 08:18:57 -04:00
|
|
|
mucwin_kick_error(ProfMucWin* mucwin, const char* const nick, const char* const error)
|
2015-11-01 15:05:43 -05:00
|
|
|
{
|
2015-11-01 19:33:31 -05:00
|
|
|
assert(mucwin != NULL);
|
|
|
|
|
2020-07-07 08:18:57 -04:00
|
|
|
ProfWin* window = (ProfWin*)mucwin;
|
2020-02-20 12:11:08 -05:00
|
|
|
win_println(window, THEME_ERROR, "!", "Error kicking %s: %s", nick, error);
|
2015-11-01 15:05:43 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2020-07-07 08:18:57 -04:00
|
|
|
mucwin_broadcast(ProfMucWin* mucwin, const char* const message)
|
2015-11-01 15:05:43 -05:00
|
|
|
{
|
2015-11-01 19:36:25 -05:00
|
|
|
assert(mucwin != NULL);
|
2015-11-01 15:05:43 -05:00
|
|
|
|
2020-07-07 08:18:57 -04:00
|
|
|
ProfWin* window = (ProfWin*)mucwin;
|
2015-11-01 19:36:25 -05:00
|
|
|
int num = wins_get_num(window);
|
2015-11-01 15:05:43 -05:00
|
|
|
|
2020-02-20 12:11:08 -05:00
|
|
|
win_print(window, THEME_ROOMINFO, "!", "Room message: ");
|
2016-10-15 14:19:44 -04:00
|
|
|
win_appendln(window, THEME_DEFAULT, "%s", message);
|
2015-11-01 15:05:43 -05:00
|
|
|
|
2015-11-01 19:36:25 -05:00
|
|
|
// currently in groupchat window
|
|
|
|
if (wins_is_current(window)) {
|
2018-03-09 16:11:59 -05:00
|
|
|
status_bar_active(num, WIN_MUC, mucwin->roomjid);
|
2015-11-01 19:36:25 -05:00
|
|
|
|
2020-07-07 08:18:57 -04:00
|
|
|
// not currently on groupchat window
|
2015-11-01 19:36:25 -05:00
|
|
|
} else {
|
2018-03-09 16:11:59 -05:00
|
|
|
status_bar_new(num, WIN_MUC, mucwin->roomjid);
|
2015-11-01 15:05:43 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2020-07-07 08:18:57 -04:00
|
|
|
mucwin_affiliation_list_error(ProfMucWin* mucwin, const char* const affiliation,
|
|
|
|
const char* const error)
|
2015-11-01 15:05:43 -05:00
|
|
|
{
|
2015-11-01 19:38:26 -05:00
|
|
|
assert(mucwin != NULL);
|
|
|
|
|
2020-07-07 08:18:57 -04:00
|
|
|
ProfWin* window = (ProfWin*)mucwin;
|
2020-02-20 12:11:08 -05:00
|
|
|
win_println(window, THEME_ERROR, "!", "Error retrieving %s list: %s", affiliation, error);
|
2015-11-01 15:05:43 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2020-07-07 08:18:57 -04:00
|
|
|
mucwin_handle_affiliation_list(ProfMucWin* mucwin, const char* const affiliation, GSList* jids)
|
2015-11-01 15:05:43 -05:00
|
|
|
{
|
2015-11-01 19:40:23 -05:00
|
|
|
assert(mucwin != NULL);
|
|
|
|
|
2020-07-07 08:18:57 -04:00
|
|
|
ProfWin* window = (ProfWin*)mucwin;
|
2015-11-01 19:40:23 -05:00
|
|
|
if (jids) {
|
2020-02-20 12:11:08 -05:00
|
|
|
win_println(window, THEME_DEFAULT, "!", "Affiliation: %s", affiliation);
|
2020-07-07 08:18:57 -04:00
|
|
|
GSList* curr_jid = jids;
|
2015-11-01 19:40:23 -05:00
|
|
|
while (curr_jid) {
|
2020-07-07 08:18:57 -04:00
|
|
|
const char* jid = curr_jid->data;
|
2020-02-20 12:11:08 -05:00
|
|
|
win_println(window, THEME_DEFAULT, "!", " %s", jid);
|
2015-11-01 19:40:23 -05:00
|
|
|
curr_jid = g_slist_next(curr_jid);
|
2015-11-01 15:05:43 -05:00
|
|
|
}
|
2020-02-20 12:11:08 -05:00
|
|
|
win_println(window, THEME_DEFAULT, "!", "");
|
2015-11-01 19:40:23 -05:00
|
|
|
} else {
|
2020-02-20 12:11:08 -05:00
|
|
|
win_println(window, THEME_DEFAULT, "!", "No users found with affiliation: %s", affiliation);
|
|
|
|
win_println(window, THEME_DEFAULT, "!", "");
|
2015-11-01 15:05:43 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-11-01 16:45:59 -05:00
|
|
|
void
|
2020-07-07 08:18:57 -04:00
|
|
|
mucwin_show_affiliation_list(ProfMucWin* mucwin, muc_affiliation_t affiliation)
|
2015-11-01 16:45:59 -05:00
|
|
|
{
|
2015-11-01 19:41:52 -05:00
|
|
|
assert(mucwin != NULL);
|
|
|
|
|
2020-07-07 08:18:57 -04:00
|
|
|
ProfWin* window = (ProfWin*)mucwin;
|
|
|
|
GSList* occupants = muc_occupants_by_affiliation(mucwin->roomjid, affiliation);
|
2015-11-01 16:45:59 -05:00
|
|
|
|
|
|
|
if (!occupants) {
|
|
|
|
switch (affiliation) {
|
2020-07-07 08:18:57 -04:00
|
|
|
case MUC_AFFILIATION_OWNER:
|
|
|
|
win_println(window, THEME_DEFAULT, "!", "No owners found.");
|
|
|
|
break;
|
|
|
|
case MUC_AFFILIATION_ADMIN:
|
|
|
|
win_println(window, THEME_DEFAULT, "!", "No admins found.");
|
|
|
|
break;
|
|
|
|
case MUC_AFFILIATION_MEMBER:
|
|
|
|
win_println(window, THEME_DEFAULT, "!", "No members found.");
|
|
|
|
break;
|
|
|
|
case MUC_AFFILIATION_OUTCAST:
|
|
|
|
win_println(window, THEME_DEFAULT, "!", "No outcasts found.");
|
|
|
|
break;
|
2022-03-27 09:06:29 -04:00
|
|
|
case MUC_AFFILIATION_NONE:
|
|
|
|
win_println(window, THEME_DEFAULT, "!", "No nones found.");
|
|
|
|
break;
|
2020-07-07 08:18:57 -04:00
|
|
|
default:
|
|
|
|
break;
|
2015-11-01 16:45:59 -05:00
|
|
|
}
|
2020-02-20 12:11:08 -05:00
|
|
|
win_println(window, THEME_DEFAULT, "-", "");
|
2015-11-01 16:45:59 -05:00
|
|
|
} else {
|
|
|
|
switch (affiliation) {
|
2020-07-07 08:18:57 -04:00
|
|
|
case MUC_AFFILIATION_OWNER:
|
|
|
|
win_println(window, THEME_DEFAULT, "!", "Owners:");
|
|
|
|
break;
|
|
|
|
case MUC_AFFILIATION_ADMIN:
|
|
|
|
win_println(window, THEME_DEFAULT, "!", "Admins:");
|
|
|
|
break;
|
|
|
|
case MUC_AFFILIATION_MEMBER:
|
|
|
|
win_println(window, THEME_DEFAULT, "!", "Members:");
|
|
|
|
break;
|
|
|
|
case MUC_AFFILIATION_OUTCAST:
|
|
|
|
win_println(window, THEME_DEFAULT, "!", "Outcasts:");
|
|
|
|
break;
|
2022-03-27 09:06:29 -04:00
|
|
|
case MUC_AFFILIATION_NONE:
|
|
|
|
win_println(window, THEME_DEFAULT, "!", "Nones:");
|
|
|
|
break;
|
2020-07-07 08:18:57 -04:00
|
|
|
default:
|
|
|
|
break;
|
2015-11-01 16:45:59 -05:00
|
|
|
}
|
|
|
|
|
2020-07-07 08:18:57 -04:00
|
|
|
GSList* curr_occupant = occupants;
|
|
|
|
while (curr_occupant) {
|
|
|
|
Occupant* occupant = curr_occupant->data;
|
2015-11-01 16:45:59 -05:00
|
|
|
if (occupant->affiliation == affiliation) {
|
|
|
|
if (occupant->jid) {
|
2020-02-20 12:11:08 -05:00
|
|
|
win_println(window, THEME_DEFAULT, "!", " %s (%s)", occupant->nick, occupant->jid);
|
2015-11-01 16:45:59 -05:00
|
|
|
} else {
|
2020-02-20 12:11:08 -05:00
|
|
|
win_println(window, THEME_DEFAULT, "!", " %s", occupant->nick);
|
2015-11-01 16:45:59 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
curr_occupant = g_slist_next(curr_occupant);
|
|
|
|
}
|
|
|
|
|
2020-02-20 12:11:08 -05:00
|
|
|
win_println(window, THEME_DEFAULT, "-", "");
|
2015-11-01 16:45:59 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-11-01 15:05:43 -05:00
|
|
|
void
|
2020-07-07 08:18:57 -04:00
|
|
|
mucwin_role_list_error(ProfMucWin* mucwin, const char* const role, const char* const error)
|
2015-11-01 15:05:43 -05:00
|
|
|
{
|
2015-11-01 19:44:33 -05:00
|
|
|
assert(mucwin != NULL);
|
|
|
|
|
2020-07-07 08:18:57 -04:00
|
|
|
ProfWin* window = (ProfWin*)mucwin;
|
2020-02-20 12:11:08 -05:00
|
|
|
win_println(window, THEME_ERROR, "!", "Error retrieving %s list: %s", role, error);
|
2015-11-01 15:05:43 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2020-07-07 08:18:57 -04:00
|
|
|
mucwin_handle_role_list(ProfMucWin* mucwin, const char* const role, GSList* nicks)
|
2015-11-01 15:05:43 -05:00
|
|
|
{
|
2015-11-01 19:47:43 -05:00
|
|
|
assert(mucwin != NULL);
|
|
|
|
|
2020-07-07 08:18:57 -04:00
|
|
|
ProfWin* window = (ProfWin*)mucwin;
|
2015-11-01 19:47:43 -05:00
|
|
|
if (nicks) {
|
2020-02-20 12:11:08 -05:00
|
|
|
win_println(window, THEME_DEFAULT, "!", "Role: %s", role);
|
2020-07-07 08:18:57 -04:00
|
|
|
GSList* curr_nick = nicks;
|
2015-11-01 19:47:43 -05:00
|
|
|
while (curr_nick) {
|
2020-07-07 08:18:57 -04:00
|
|
|
const char* nick = curr_nick->data;
|
|
|
|
Occupant* occupant = muc_roster_item(mucwin->roomjid, nick);
|
2015-11-01 19:47:43 -05:00
|
|
|
if (occupant) {
|
|
|
|
if (occupant->jid) {
|
2020-02-20 12:11:08 -05:00
|
|
|
win_println(window, THEME_DEFAULT, "!", " %s (%s)", nick, occupant->jid);
|
2015-11-01 15:05:43 -05:00
|
|
|
} else {
|
2020-02-20 12:11:08 -05:00
|
|
|
win_println(window, THEME_DEFAULT, "!", " %s", nick);
|
2015-11-01 15:05:43 -05:00
|
|
|
}
|
2015-11-01 19:47:43 -05:00
|
|
|
} else {
|
2020-02-20 12:11:08 -05:00
|
|
|
win_println(window, THEME_DEFAULT, "!", " %s", nick);
|
2015-11-01 15:05:43 -05:00
|
|
|
}
|
2015-11-01 19:47:43 -05:00
|
|
|
curr_nick = g_slist_next(curr_nick);
|
2015-11-01 15:05:43 -05:00
|
|
|
}
|
2020-02-20 12:11:08 -05:00
|
|
|
win_println(window, THEME_DEFAULT, "!", "");
|
2015-11-01 19:47:43 -05:00
|
|
|
} else {
|
2020-02-20 12:11:08 -05:00
|
|
|
win_println(window, THEME_DEFAULT, "!", "No occupants found with role: %s", role);
|
|
|
|
win_println(window, THEME_DEFAULT, "!", "");
|
2015-11-01 15:05:43 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2020-07-07 08:18:57 -04:00
|
|
|
mucwin_show_role_list(ProfMucWin* mucwin, muc_role_t role)
|
2015-11-01 15:05:43 -05:00
|
|
|
{
|
2015-11-01 19:49:05 -05:00
|
|
|
assert(mucwin != NULL);
|
|
|
|
|
2020-07-07 08:18:57 -04:00
|
|
|
ProfWin* window = (ProfWin*)mucwin;
|
|
|
|
GSList* occupants = muc_occupants_by_role(mucwin->roomjid, role);
|
2015-11-01 15:05:43 -05:00
|
|
|
|
|
|
|
if (!occupants) {
|
|
|
|
switch (role) {
|
2020-07-07 08:18:57 -04:00
|
|
|
case MUC_ROLE_MODERATOR:
|
|
|
|
win_println(window, THEME_DEFAULT, "!", "No moderators found.");
|
|
|
|
break;
|
|
|
|
case MUC_ROLE_PARTICIPANT:
|
|
|
|
win_println(window, THEME_DEFAULT, "!", "No participants found.");
|
|
|
|
break;
|
|
|
|
case MUC_ROLE_VISITOR:
|
|
|
|
win_println(window, THEME_DEFAULT, "!", "No visitors found.");
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
2015-11-01 15:05:43 -05:00
|
|
|
}
|
2020-02-20 12:11:08 -05:00
|
|
|
win_println(window, THEME_DEFAULT, "-", "");
|
2015-11-01 15:05:43 -05:00
|
|
|
} else {
|
|
|
|
switch (role) {
|
2020-07-07 08:18:57 -04:00
|
|
|
case MUC_ROLE_MODERATOR:
|
|
|
|
win_println(window, THEME_DEFAULT, "!", "Moderators:");
|
|
|
|
break;
|
|
|
|
case MUC_ROLE_PARTICIPANT:
|
|
|
|
win_println(window, THEME_DEFAULT, "!", "Participants:");
|
|
|
|
break;
|
|
|
|
case MUC_ROLE_VISITOR:
|
|
|
|
win_println(window, THEME_DEFAULT, "!", "Visitors:");
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
2015-11-01 15:05:43 -05:00
|
|
|
}
|
|
|
|
|
2020-07-07 08:18:57 -04:00
|
|
|
GSList* curr_occupant = occupants;
|
|
|
|
while (curr_occupant) {
|
|
|
|
Occupant* occupant = curr_occupant->data;
|
2015-11-01 15:05:43 -05:00
|
|
|
if (occupant->role == role) {
|
|
|
|
if (occupant->jid) {
|
2020-02-20 12:11:08 -05:00
|
|
|
win_println(window, THEME_DEFAULT, "!", " %s (%s)", occupant->nick, occupant->jid);
|
2015-11-01 15:05:43 -05:00
|
|
|
} else {
|
2020-02-20 12:11:08 -05:00
|
|
|
win_println(window, THEME_DEFAULT, "!", " %s", occupant->nick);
|
2015-11-01 15:05:43 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
curr_occupant = g_slist_next(curr_occupant);
|
|
|
|
}
|
|
|
|
|
2020-02-20 12:11:08 -05:00
|
|
|
win_println(window, THEME_DEFAULT, "-", "");
|
2015-11-01 15:05:43 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-11-01 16:50:32 -05:00
|
|
|
void
|
2020-07-07 08:18:57 -04:00
|
|
|
mucwin_affiliation_set_error(ProfMucWin* mucwin, const char* const jid, const char* const affiliation,
|
|
|
|
const char* const error)
|
2015-11-01 16:50:32 -05:00
|
|
|
{
|
2015-11-01 19:51:12 -05:00
|
|
|
assert(mucwin != NULL);
|
|
|
|
|
2020-07-07 08:18:57 -04:00
|
|
|
ProfWin* window = (ProfWin*)mucwin;
|
2020-02-20 12:11:08 -05:00
|
|
|
win_println(window, THEME_ERROR, "!", "Error setting %s affiliation for %s: %s", affiliation, jid, error);
|
2015-11-01 16:50:32 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2020-07-07 08:18:57 -04:00
|
|
|
mucwin_role_set_error(ProfMucWin* mucwin, const char* const nick, const char* const role,
|
|
|
|
const char* const error)
|
2015-11-01 16:50:32 -05:00
|
|
|
{
|
2015-11-01 19:52:50 -05:00
|
|
|
assert(mucwin != NULL);
|
|
|
|
|
2020-07-07 08:18:57 -04:00
|
|
|
ProfWin* window = (ProfWin*)mucwin;
|
2020-02-20 12:11:08 -05:00
|
|
|
win_println(window, THEME_ERROR, "!", "Error setting %s role for %s: %s", role, nick, error);
|
2015-11-01 16:50:32 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2020-07-07 08:18:57 -04:00
|
|
|
mucwin_info(ProfMucWin* mucwin)
|
2015-11-01 16:50:32 -05:00
|
|
|
{
|
2015-11-01 19:53:54 -05:00
|
|
|
assert(mucwin != NULL);
|
|
|
|
|
2020-07-07 08:18:57 -04:00
|
|
|
char* role = muc_role_str(mucwin->roomjid);
|
|
|
|
char* affiliation = muc_affiliation_str(mucwin->roomjid);
|
2015-11-01 16:50:32 -05:00
|
|
|
|
2020-07-07 08:18:57 -04:00
|
|
|
ProfWin* window = (ProfWin*)mucwin;
|
2020-02-20 12:11:08 -05:00
|
|
|
win_println(window, THEME_DEFAULT, "!", "Room: %s", mucwin->roomjid);
|
|
|
|
win_println(window, THEME_DEFAULT, "!", "Affiliation: %s", affiliation);
|
|
|
|
win_println(window, THEME_DEFAULT, "!", "Role: %s", role);
|
|
|
|
win_println(window, THEME_DEFAULT, "-", "");
|
2015-11-01 16:50:32 -05:00
|
|
|
}
|
|
|
|
|
2015-11-01 15:05:43 -05:00
|
|
|
void
|
2020-07-07 08:18:57 -04:00
|
|
|
mucwin_update_occupants(ProfMucWin* mucwin)
|
2015-11-01 15:05:43 -05:00
|
|
|
{
|
2015-11-01 19:57:13 -05:00
|
|
|
assert(mucwin != NULL);
|
|
|
|
|
2020-07-07 08:18:57 -04:00
|
|
|
ProfWin* window = (ProfWin*)mucwin;
|
2015-11-01 19:57:13 -05:00
|
|
|
if (win_has_active_subwin(window)) {
|
|
|
|
occupantswin_occupants(mucwin->roomjid);
|
2015-11-01 15:05:43 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2020-07-07 08:18:57 -04:00
|
|
|
mucwin_show_occupants(ProfMucWin* mucwin)
|
2015-11-01 15:05:43 -05:00
|
|
|
{
|
2015-11-01 19:59:27 -05:00
|
|
|
assert(mucwin != NULL);
|
|
|
|
|
2020-07-07 08:18:57 -04:00
|
|
|
ProfWin* window = (ProfWin*)mucwin;
|
2015-11-01 19:59:27 -05:00
|
|
|
if (!win_has_active_subwin(window)) {
|
2015-11-01 15:05:43 -05:00
|
|
|
wins_show_subwin(window);
|
2015-11-01 19:59:27 -05:00
|
|
|
occupantswin_occupants(mucwin->roomjid);
|
2015-11-01 15:05:43 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2020-07-07 08:18:57 -04:00
|
|
|
mucwin_hide_occupants(ProfMucWin* mucwin)
|
2015-11-01 15:05:43 -05:00
|
|
|
{
|
2015-11-01 20:01:37 -05:00
|
|
|
assert(mucwin != NULL);
|
|
|
|
|
2020-07-07 08:18:57 -04:00
|
|
|
ProfWin* window = (ProfWin*)mucwin;
|
2015-11-01 20:01:37 -05:00
|
|
|
if (win_has_active_subwin(window)) {
|
2015-11-01 15:05:43 -05:00
|
|
|
wins_hide_subwin(window);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-11-29 18:58:52 -05:00
|
|
|
char*
|
2020-07-07 08:18:57 -04:00
|
|
|
mucwin_get_string(ProfMucWin* mucwin)
|
2015-11-29 18:58:52 -05:00
|
|
|
{
|
|
|
|
assert(mucwin != NULL);
|
|
|
|
|
|
|
|
if (mucwin->unread > 0) {
|
2023-03-23 05:23:51 -04:00
|
|
|
return g_strdup_printf("Room %s, %d unread", mucwin->roomjid, mucwin->unread);
|
|
|
|
} else {
|
|
|
|
return g_strdup_printf("Room %s", mucwin->roomjid);
|
2015-11-29 18:58:52 -05:00
|
|
|
}
|
|
|
|
}
|
2017-01-20 18:26:14 -05:00
|
|
|
|
|
|
|
void
|
2020-07-07 08:18:57 -04:00
|
|
|
mucwin_set_enctext(ProfMucWin* mucwin, const char* const enctext)
|
2017-01-20 18:26:14 -05:00
|
|
|
{
|
|
|
|
if (mucwin->enctext) {
|
|
|
|
free(mucwin->enctext);
|
|
|
|
}
|
|
|
|
mucwin->enctext = strdup(enctext);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2020-07-07 08:18:57 -04:00
|
|
|
mucwin_unset_enctext(ProfMucWin* mucwin)
|
2017-01-20 18:26:14 -05:00
|
|
|
{
|
|
|
|
if (mucwin->enctext) {
|
|
|
|
free(mucwin->enctext);
|
|
|
|
mucwin->enctext = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2020-07-07 08:18:57 -04:00
|
|
|
mucwin_set_message_char(ProfMucWin* mucwin, const char* const ch)
|
2017-01-20 18:26:14 -05:00
|
|
|
{
|
|
|
|
if (mucwin->message_char) {
|
|
|
|
free(mucwin->message_char);
|
|
|
|
}
|
|
|
|
mucwin->message_char = strdup(ch);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2020-07-07 08:18:57 -04:00
|
|
|
mucwin_unset_message_char(ProfMucWin* mucwin)
|
2017-01-20 18:26:14 -05:00
|
|
|
{
|
|
|
|
if (mucwin->message_char) {
|
|
|
|
free(mucwin->message_char);
|
|
|
|
mucwin->message_char = NULL;
|
|
|
|
}
|
|
|
|
}
|
2020-02-12 08:06:00 -05:00
|
|
|
|
|
|
|
static void
|
2020-07-07 08:18:57 -04:00
|
|
|
_mucwin_set_last_message(ProfMucWin* mucwin, const char* const id, const char* const message)
|
2020-02-12 08:06:00 -05:00
|
|
|
{
|
|
|
|
free(mucwin->last_message);
|
|
|
|
mucwin->last_message = strdup(message);
|
|
|
|
|
|
|
|
free(mucwin->last_msg_id);
|
|
|
|
mucwin->last_msg_id = strdup(id);
|
|
|
|
}
|