mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Handle occupant kicked/banned in private chat wins
This commit is contained in:
parent
150015fa3d
commit
3ddef99dfe
@ -686,6 +686,14 @@ sv_ev_room_occupent_kicked(const char *const room, const char *const nick, const
|
|||||||
if (mucwin) {
|
if (mucwin) {
|
||||||
mucwin_occupant_kicked(mucwin, nick, actor, reason);
|
mucwin_occupant_kicked(mucwin, nick, actor, reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Jid *jidp = jid_create_from_bare_and_resource(room, nick);
|
||||||
|
ProfPrivateWin *privwin = wins_get_private(jidp->fulljid);
|
||||||
|
jid_destroy(jidp);
|
||||||
|
if (privwin != NULL) {
|
||||||
|
privwin_occupant_kicked(privwin, actor, reason);
|
||||||
|
}
|
||||||
|
|
||||||
occupantswin_occupants(room);
|
occupantswin_occupants(room);
|
||||||
rosterwin_roster();
|
rosterwin_roster();
|
||||||
}
|
}
|
||||||
@ -699,6 +707,14 @@ sv_ev_room_occupent_banned(const char *const room, const char *const nick, const
|
|||||||
if (mucwin) {
|
if (mucwin) {
|
||||||
mucwin_occupant_banned(mucwin, nick, actor, reason);
|
mucwin_occupant_banned(mucwin, nick, actor, reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Jid *jidp = jid_create_from_bare_and_resource(room, nick);
|
||||||
|
ProfPrivateWin *privwin = wins_get_private(jidp->fulljid);
|
||||||
|
jid_destroy(jidp);
|
||||||
|
if (privwin != NULL) {
|
||||||
|
privwin_occupant_banned(privwin, actor, reason);
|
||||||
|
}
|
||||||
|
|
||||||
occupantswin_occupants(room);
|
occupantswin_occupants(room);
|
||||||
rosterwin_roster();
|
rosterwin_roster();
|
||||||
}
|
}
|
||||||
|
@ -126,10 +126,56 @@ privwin_occupant_offline(ProfPrivateWin *privwin)
|
|||||||
|
|
||||||
privwin->occupant_offline = TRUE;
|
privwin->occupant_offline = TRUE;
|
||||||
Jid *jidp = jid_create(privwin->fulljid);
|
Jid *jidp = jid_create(privwin->fulljid);
|
||||||
win_vprint((ProfWin*)privwin, '-', 0, NULL, 0, THEME_OFFLINE, NULL, "-- %s has left the room.", jidp->resourcepart);
|
win_vprint((ProfWin*)privwin, '-', 0, NULL, 0, THEME_OFFLINE, NULL, "<- %s has left the room.", jidp->resourcepart);
|
||||||
jid_destroy(jidp);
|
jid_destroy(jidp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
privwin_occupant_kicked(ProfPrivateWin *privwin, const char *const actor, const char *const reason)
|
||||||
|
{
|
||||||
|
assert(privwin != NULL);
|
||||||
|
|
||||||
|
privwin->occupant_offline = TRUE;
|
||||||
|
Jid *jidp = jid_create(privwin->fulljid);
|
||||||
|
GString *message = g_string_new(jidp->resourcepart);
|
||||||
|
jid_destroy(jidp);
|
||||||
|
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((ProfWin*)privwin, '!', 0, NULL, 0, THEME_OFFLINE, NULL, "<- %s", message->str);
|
||||||
|
g_string_free(message, TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
privwin_occupant_banned(ProfPrivateWin *privwin, const char *const actor, const char *const reason)
|
||||||
|
{
|
||||||
|
assert(privwin != NULL);
|
||||||
|
|
||||||
|
privwin->occupant_offline = TRUE;
|
||||||
|
Jid *jidp = jid_create(privwin->fulljid);
|
||||||
|
GString *message = g_string_new(jidp->resourcepart);
|
||||||
|
jid_destroy(jidp);
|
||||||
|
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((ProfWin*)privwin, '!', 0, NULL, 0, THEME_OFFLINE, NULL, "<- %s", message->str);
|
||||||
|
g_string_free(message, TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
privwin_occupant_online(ProfPrivateWin *privwin)
|
privwin_occupant_online(ProfPrivateWin *privwin)
|
||||||
{
|
{
|
||||||
|
@ -198,6 +198,8 @@ void privwin_message_occupant_offline(ProfPrivateWin *privwin);
|
|||||||
|
|
||||||
char* privwin_get_string(ProfPrivateWin *privwin);
|
char* privwin_get_string(ProfPrivateWin *privwin);
|
||||||
void privwin_occupant_offline(ProfPrivateWin *privwin);
|
void privwin_occupant_offline(ProfPrivateWin *privwin);
|
||||||
|
void privwin_occupant_kicked(ProfPrivateWin *privwin, const char *const actor, const char *const reason);
|
||||||
|
void privwin_occupant_banned(ProfPrivateWin *privwin, const char *const actor, const char *const reason);
|
||||||
void privwin_occupant_online(ProfPrivateWin *privwin);
|
void privwin_occupant_online(ProfPrivateWin *privwin);
|
||||||
|
|
||||||
// MUC room config window
|
// MUC room config window
|
||||||
|
@ -168,6 +168,12 @@ void chatwin_outgoing_msg(ProfChatWin *chatwin, const char * const message, char
|
|||||||
void chatwin_outgoing_carbon(ProfChatWin *chatwin, const char * const message) {}
|
void chatwin_outgoing_carbon(ProfChatWin *chatwin, const char * const message) {}
|
||||||
void privwin_outgoing_msg(ProfPrivateWin *privwin, const char * const message) {}
|
void privwin_outgoing_msg(ProfPrivateWin *privwin, const char * const message) {}
|
||||||
|
|
||||||
|
void privwin_occupant_offline(ProfPrivateWin *privwin) {}
|
||||||
|
void privwin_occupant_kicked(ProfPrivateWin *privwin, const char *const actor, const char *const reason) {}
|
||||||
|
void privwin_occupant_banned(ProfPrivateWin *privwin, const char *const actor, const char *const reason) {}
|
||||||
|
void privwin_occupant_online(ProfPrivateWin *privwin) {}
|
||||||
|
void privwin_message_occupant_offline(ProfPrivateWin *privwin) {}
|
||||||
|
|
||||||
void ui_room_join(const char * const roomjid, gboolean focus) {}
|
void ui_room_join(const char * const roomjid, gboolean focus) {}
|
||||||
void ui_switch_to_room(const char * const roomjid) {}
|
void ui_switch_to_room(const char * const roomjid) {}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user