1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Merge branch 'master' into openpgp

This commit is contained in:
James Booth 2015-05-10 01:08:30 +01:00
commit 487f5da17d
4 changed files with 21 additions and 37 deletions

View File

@ -473,20 +473,8 @@ ui_incoming_msg(const char * const barejid, const char * const resource, const c
beep(); beep();
} }
int ui_index = num;
if (ui_index == 10) {
ui_index = 0;
}
if (prefs_get_boolean(PREF_NOTIFY_MESSAGE)) { if (prefs_get_boolean(PREF_NOTIFY_MESSAGE)) {
gboolean is_current = wins_is_current(window); notify_message(window, display_name, message);
if ( !is_current || (is_current && prefs_get_boolean(PREF_NOTIFY_MESSAGE_CURRENT)) ) {
if (prefs_get_boolean(PREF_NOTIFY_MESSAGE_TEXT)) {
notify_message(display_name, ui_index, message);
} else {
notify_message(display_name, ui_index, NULL);
}
}
} }
free(display_name); free(display_name);
@ -525,24 +513,12 @@ ui_incoming_private_msg(const char * const fulljid, const char * const message,
} }
} }
int ui_index = num;
if (ui_index == 10) {
ui_index = 0;
}
if (prefs_get_boolean(PREF_BEEP)) { if (prefs_get_boolean(PREF_BEEP)) {
beep(); beep();
} }
if (prefs_get_boolean(PREF_NOTIFY_MESSAGE)) { if (prefs_get_boolean(PREF_NOTIFY_MESSAGE)) {
gboolean is_current = wins_is_current(window); notify_message(window, display_from, message);
if ( !is_current || (is_current && prefs_get_boolean(PREF_NOTIFY_MESSAGE_CURRENT)) ) {
if (prefs_get_boolean(PREF_NOTIFY_MESSAGE_TEXT)) {
notify_message(display_from, ui_index, message);
} else {
notify_message(display_from, ui_index, NULL);
}
}
} }
free(display_from); free(display_from);

View File

@ -48,10 +48,10 @@
#include "log.h" #include "log.h"
#include "muc.h" #include "muc.h"
#include "ui/ui.h" #include "ui/ui.h"
#include "ui/windows.h"
#include "config/preferences.h" #include "config/preferences.h"
static void _notify(const char * const message, int timeout, static void _notify(const char * const message, int timeout, const char * const category);
const char * const category);
static GTimer *remind_timer; static GTimer *remind_timer;
@ -99,17 +99,25 @@ notify_invite(const char * const from, const char * const room,
} }
void void
notify_message(const char * const handle, int win, const char * const text) notify_message(ProfWin *window, const char * const name, const char * const text)
{ {
GString *message = g_string_new(""); int num = wins_get_num(window);
g_string_append_printf(message, "%s (win %d)", handle, win); if (num == 10) {
if (text) { num = 0;
g_string_append_printf(message, "\n%s", text);
} }
_notify(message->str, 10000, "incoming message"); gboolean is_current = wins_is_current(window);
if (!is_current || (is_current && prefs_get_boolean(PREF_NOTIFY_MESSAGE_CURRENT)) ) {
GString *message = g_string_new("");
g_string_append_printf(message, "%s (win %d)", name, num);
g_string_free(message, TRUE); if (prefs_get_boolean(PREF_NOTIFY_MESSAGE_TEXT) && text) {
g_string_append_printf(message, "\n%s", text);
}
_notify(message->str, 10000, "incoming message");
g_string_free(message, TRUE);
}
} }
void void

View File

@ -342,7 +342,7 @@ void notifier_initialise(void);
void notifier_uninit(void); void notifier_uninit(void);
void notify_typing(const char * const handle); void notify_typing(const char * const handle);
void notify_message(const char * const handle, int win, const char * const text); void notify_message(ProfWin *window, const char * const name, const char * const text);
void notify_room_message(const char * const handle, const char * const room, void notify_room_message(const char * const handle, const char * const room,
int win, const char * const text); int win, const char * const text);
void notify_remind(void); void notify_remind(void);

View File

@ -500,7 +500,7 @@ void occupantswin_occupants(const char * const room) {}
void notifier_uninit(void) {} void notifier_uninit(void) {}
void notify_typing(const char * const handle) {} void notify_typing(const char * const handle) {}
void notify_message(const char * const handle, int win, const char * const text) {} void notify_message(ProfWin *window, const char * const name, const char * const text) {}
void notify_room_message(const char * const handle, const char * const room, void notify_room_message(const char * const handle, const char * const room,
int win, const char * const text) {} int win, const char * const text) {}
void notify_remind(void) {} void notify_remind(void) {}