mirror of
https://github.com/profanity-im/profanity.git
synced 2024-09-01 19:24:15 -04:00
Added cons_show_incoming_room_message()
This commit is contained in:
parent
8f6b37f650
commit
1f56c12377
@ -212,16 +212,69 @@ void
|
||||
sv_ev_room_message(const char *const room_jid, const char *const nick,
|
||||
const char *const 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());
|
||||
groupchat_log_chat(jid->barejid, room_jid, nick, message);
|
||||
jid_destroy(jid);
|
||||
}
|
||||
|
||||
ProfMucWin *mucwin = wins_get_muc(room_jid);
|
||||
if (!mucwin) {
|
||||
return;
|
||||
}
|
||||
|
||||
mucwin_message(mucwin, nick, message);
|
||||
|
||||
ProfWin *window = (ProfWin*)mucwin;
|
||||
gboolean is_current = wins_is_current(window);
|
||||
int num = wins_get_num(window);
|
||||
char *my_nick = muc_nick(mucwin->roomjid);
|
||||
gboolean notify = prefs_do_room_notify(is_current, mucwin->roomjid, my_nick, message);
|
||||
|
||||
// currently in groupchat window
|
||||
if (wins_is_current(window)) {
|
||||
status_bar_active(num);
|
||||
|
||||
// not currently on groupchat window
|
||||
} else {
|
||||
status_bar_new(num);
|
||||
cons_show_incoming_room_message(nick, mucwin->roomjid, num);
|
||||
|
||||
if (prefs_get_boolean(PREF_FLASH) && (strcmp(nick, my_nick) != 0)) {
|
||||
flash();
|
||||
}
|
||||
|
||||
mucwin->unread++;
|
||||
if (notify) {
|
||||
mucwin->notify = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
// don't notify self messages
|
||||
if (strcmp(nick, my_nick) == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (prefs_get_boolean(PREF_BEEP)) {
|
||||
beep();
|
||||
}
|
||||
|
||||
if (!notify) {
|
||||
return;
|
||||
}
|
||||
|
||||
Jid *jidp = jid_create(mucwin->roomjid);
|
||||
int ui_index = num;
|
||||
if (ui_index == 10) {
|
||||
ui_index = 0;
|
||||
}
|
||||
|
||||
if (prefs_get_boolean(PREF_NOTIFY_ROOM_TEXT)) {
|
||||
notify_room_message(nick, jidp->localpart, ui_index, message);
|
||||
} else {
|
||||
notify_room_message(nick, jidp->localpart, ui_index, NULL);
|
||||
}
|
||||
jid_destroy(jidp);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -301,6 +301,21 @@ cons_show_typing(const char *const barejid)
|
||||
cons_alert();
|
||||
}
|
||||
|
||||
void
|
||||
cons_show_incoming_room_message(const char *const nick, const char *const room, const int win_index)
|
||||
{
|
||||
ProfWin *const console = wins_get_console();
|
||||
|
||||
int ui_index = win_index;
|
||||
if (ui_index == 10) {
|
||||
ui_index = 0;
|
||||
}
|
||||
|
||||
win_vprint(console, '-', 0, NULL, 0, THEME_INCOMING, "", "<< incoming from %s in %s (win %d)", nick, room, ui_index);
|
||||
|
||||
cons_alert();
|
||||
}
|
||||
|
||||
void
|
||||
cons_show_incoming_message(const char *const short_from, const int win_index)
|
||||
{
|
||||
|
@ -361,7 +361,6 @@ mucwin_message(ProfMucWin *mucwin, const char *const nick, const char *const mes
|
||||
assert(mucwin != NULL);
|
||||
|
||||
ProfWin *window = (ProfWin*)mucwin;
|
||||
int num = wins_get_num(window);
|
||||
char *my_nick = muc_nick(mucwin->roomjid);
|
||||
|
||||
if (g_strcmp0(nick, my_nick) != 0) {
|
||||
@ -373,54 +372,6 @@ mucwin_message(ProfMucWin *mucwin, const char *const nick, const char *const mes
|
||||
} else {
|
||||
win_print(window, '-', 0, NULL, 0, THEME_TEXT_ME, nick, message);
|
||||
}
|
||||
|
||||
gboolean is_current = wins_is_current(window);
|
||||
gboolean notify = prefs_do_room_notify(is_current, mucwin->roomjid, my_nick, message);
|
||||
|
||||
// currently in groupchat window
|
||||
if (wins_is_current(window)) {
|
||||
status_bar_active(num);
|
||||
|
||||
// not currently on groupchat window
|
||||
} else {
|
||||
status_bar_new(num);
|
||||
cons_show_incoming_message(nick, num);
|
||||
|
||||
if (prefs_get_boolean(PREF_FLASH) && (strcmp(nick, my_nick) != 0)) {
|
||||
flash();
|
||||
}
|
||||
|
||||
mucwin->unread++;
|
||||
if (notify) {
|
||||
mucwin->notify = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
// don't notify self messages
|
||||
if (strcmp(nick, my_nick) == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (prefs_get_boolean(PREF_BEEP)) {
|
||||
beep();
|
||||
}
|
||||
|
||||
if (!notify) {
|
||||
return;
|
||||
}
|
||||
|
||||
Jid *jidp = jid_create(mucwin->roomjid);
|
||||
int ui_index = num;
|
||||
if (ui_index == 10) {
|
||||
ui_index = 0;
|
||||
}
|
||||
|
||||
if (prefs_get_boolean(PREF_NOTIFY_ROOM_TEXT)) {
|
||||
notify_room_message(nick, jidp->localpart, ui_index, message);
|
||||
} else {
|
||||
notify_room_message(nick, jidp->localpart, ui_index, NULL);
|
||||
}
|
||||
jid_destroy(jidp);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -257,6 +257,7 @@ void cons_show_disco_info(const char *from, GSList *identities, GSList *features
|
||||
void cons_show_room_invite(const char *const invitor, const char *const room, const char *const reason);
|
||||
void cons_check_version(gboolean not_available_msg);
|
||||
void cons_show_typing(const char *const barejid);
|
||||
void cons_show_incoming_room_message(const char *const nick, const char *const room, const int win_index);
|
||||
void cons_show_incoming_message(const char *const short_from, const int win_index);
|
||||
void cons_show_room_invites(GSList *invites);
|
||||
void cons_show_received_subs(void);
|
||||
|
@ -394,6 +394,7 @@ void cons_show_room_invite(const char * const invitor, const char * const room,
|
||||
const char * const reason) {}
|
||||
void cons_check_version(gboolean not_available_msg) {}
|
||||
void cons_show_typing(const char * const barejid) {}
|
||||
void cons_show_incoming_room_message(const char *const nick, const char *const room, const int win_index) {}
|
||||
void cons_show_incoming_message(const char * const short_from, const int win_index) {}
|
||||
void cons_show_room_invites(GSList *invites) {}
|
||||
void cons_show_received_subs(void) {}
|
||||
|
Loading…
Reference in New Issue
Block a user