Merge remote-tracking branch 'jubalh/jub'
This commit is contained in:
@@ -2064,7 +2064,6 @@ cmd_info(ProfWin *window, const char * const command, gchar **args)
|
|||||||
char *usr = args[0];
|
char *usr = args[0];
|
||||||
|
|
||||||
jabber_conn_status_t conn_status = jabber_get_connection_status();
|
jabber_conn_status_t conn_status = jabber_get_connection_status();
|
||||||
PContact pcontact = NULL;
|
|
||||||
|
|
||||||
if (conn_status != JABBER_CONNECTED) {
|
if (conn_status != JABBER_CONNECTED) {
|
||||||
cons_show("You are not currently connected.");
|
cons_show("You are not currently connected.");
|
||||||
@@ -2127,7 +2126,7 @@ cmd_info(ProfWin *window, const char * const command, gchar **args)
|
|||||||
if (usr_jid == NULL) {
|
if (usr_jid == NULL) {
|
||||||
usr_jid = usr;
|
usr_jid = usr;
|
||||||
}
|
}
|
||||||
pcontact = roster_get_contact(usr_jid);
|
PContact pcontact = roster_get_contact(usr_jid);
|
||||||
if (pcontact) {
|
if (pcontact) {
|
||||||
cons_show_info(pcontact);
|
cons_show_info(pcontact);
|
||||||
} else {
|
} else {
|
||||||
@@ -2148,7 +2147,6 @@ gboolean
|
|||||||
cmd_caps(ProfWin *window, const char * const command, gchar **args)
|
cmd_caps(ProfWin *window, const char * const command, gchar **args)
|
||||||
{
|
{
|
||||||
jabber_conn_status_t conn_status = jabber_get_connection_status();
|
jabber_conn_status_t conn_status = jabber_get_connection_status();
|
||||||
PContact pcontact = NULL;
|
|
||||||
Occupant *occupant = NULL;
|
Occupant *occupant = NULL;
|
||||||
|
|
||||||
if (conn_status != JABBER_CONNECTED) {
|
if (conn_status != JABBER_CONNECTED) {
|
||||||
@@ -2182,7 +2180,7 @@ cmd_caps(ProfWin *window, const char * const command, gchar **args)
|
|||||||
if (jid->fulljid == NULL) {
|
if (jid->fulljid == NULL) {
|
||||||
cons_show("You must provide a full jid to the /caps command.");
|
cons_show("You must provide a full jid to the /caps command.");
|
||||||
} else {
|
} else {
|
||||||
pcontact = roster_get_contact(jid->barejid);
|
PContact pcontact = roster_get_contact(jid->barejid);
|
||||||
if (pcontact == NULL) {
|
if (pcontact == NULL) {
|
||||||
cons_show("Contact not found in roster: %s", jid->barejid);
|
cons_show("Contact not found in roster: %s", jid->barejid);
|
||||||
} else {
|
} else {
|
||||||
@@ -2225,7 +2223,6 @@ gboolean
|
|||||||
cmd_software(ProfWin *window, const char * const command, gchar **args)
|
cmd_software(ProfWin *window, const char * const command, gchar **args)
|
||||||
{
|
{
|
||||||
jabber_conn_status_t conn_status = jabber_get_connection_status();
|
jabber_conn_status_t conn_status = jabber_get_connection_status();
|
||||||
Occupant *occupant = NULL;
|
|
||||||
|
|
||||||
if (conn_status != JABBER_CONNECTED) {
|
if (conn_status != JABBER_CONNECTED) {
|
||||||
cons_show("You are not currently connected.");
|
cons_show("You are not currently connected.");
|
||||||
@@ -2238,7 +2235,7 @@ cmd_software(ProfWin *window, const char * const command, gchar **args)
|
|||||||
if (args[0]) {
|
if (args[0]) {
|
||||||
ProfMucWin *mucwin = (ProfMucWin*)window;
|
ProfMucWin *mucwin = (ProfMucWin*)window;
|
||||||
assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
|
assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
|
||||||
occupant = muc_roster_item(mucwin->roomjid, args[0]);
|
Occupant *occupant = muc_roster_item(mucwin->roomjid, args[0]);
|
||||||
if (occupant) {
|
if (occupant) {
|
||||||
Jid *jid = jid_create_from_bare_and_resource(mucwin->roomjid, args[0]);
|
Jid *jid = jid_create_from_bare_and_resource(mucwin->roomjid, args[0]);
|
||||||
iq_send_software_version(jid->fulljid);
|
iq_send_software_version(jid->fulljid);
|
||||||
|
|||||||
18
src/common.c
18
src/common.c
@@ -644,3 +644,21 @@ strip_arg_quotes(const char * const input)
|
|||||||
|
|
||||||
return unquoted;
|
return unquoted;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
is_notify_enabled(void)
|
||||||
|
{
|
||||||
|
gboolean notify_enabled = FALSE;
|
||||||
|
|
||||||
|
#ifdef HAVE_OSXNOTIFY
|
||||||
|
notify_enabled = TRUE;
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_LIBNOTIFY
|
||||||
|
notify_enabled = TRUE;
|
||||||
|
#endif
|
||||||
|
#ifdef PLATFORM_CYGWIN
|
||||||
|
notify_enabled = TRUE;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return notify_enabled;
|
||||||
|
}
|
||||||
|
|||||||
@@ -128,5 +128,6 @@ int get_next_available_win_num(GList *used);
|
|||||||
|
|
||||||
char* get_file_or_linked(char *loc, char *basedir);
|
char* get_file_or_linked(char *loc, char *basedir);
|
||||||
char* strip_arg_quotes(const char *const input);
|
char* strip_arg_quotes(const char *const input);
|
||||||
|
gboolean is_notify_enabled(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
14
src/main.c
14
src/main.c
@@ -40,6 +40,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "profanity.h"
|
#include "profanity.h"
|
||||||
|
#include "common.h"
|
||||||
#include "command/command.h"
|
#include "command/command.h"
|
||||||
|
|
||||||
static gboolean version = FALSE;
|
static gboolean version = FALSE;
|
||||||
@@ -103,18 +104,7 @@ main(int argc, char **argv)
|
|||||||
g_print("XMPP library: libstrophe\n");
|
g_print("XMPP library: libstrophe\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
gboolean notify_enabled = FALSE;
|
if (is_notify_enabled()) {
|
||||||
|
|
||||||
#ifdef HAVE_OSXNOTIFY
|
|
||||||
notify_enabled = TRUE;
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_LIBNOTIFY
|
|
||||||
notify_enabled = TRUE;
|
|
||||||
#endif
|
|
||||||
#ifdef PLATFORM_CYGWIN
|
|
||||||
notify_enabled = TRUE;
|
|
||||||
#endif
|
|
||||||
if (notify_enabled) {
|
|
||||||
g_print("Desktop notification support: Enabled\n");
|
g_print("Desktop notification support: Enabled\n");
|
||||||
} else {
|
} else {
|
||||||
g_print("Desktop notification support: Disabled\n");
|
g_print("Desktop notification support: Disabled\n");
|
||||||
|
|||||||
@@ -1170,18 +1170,7 @@ cons_show_ui_prefs(void)
|
|||||||
void
|
void
|
||||||
cons_notify_setting(void)
|
cons_notify_setting(void)
|
||||||
{
|
{
|
||||||
gboolean notify_enabled = FALSE;
|
if (is_notify_enabled()) {
|
||||||
#ifdef HAVE_OSXNOTIFY
|
|
||||||
notify_enabled = TRUE;
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_LIBNOTIFY
|
|
||||||
notify_enabled = TRUE;
|
|
||||||
#endif
|
|
||||||
#ifdef PLATFORM_CYGWIN
|
|
||||||
notify_enabled = TRUE;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (notify_enabled) {
|
|
||||||
if (prefs_get_boolean(PREF_NOTIFY_MESSAGE))
|
if (prefs_get_boolean(PREF_NOTIFY_MESSAGE))
|
||||||
cons_show("Messages (/notify message) : ON");
|
cons_show("Messages (/notify message) : ON");
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -2586,12 +2586,9 @@ ui_handle_room_configuration_form_error(const char * const roomjid, const char *
|
|||||||
void
|
void
|
||||||
ui_handle_room_config_submit_result(const char * const roomjid)
|
ui_handle_room_config_submit_result(const char * const roomjid)
|
||||||
{
|
{
|
||||||
ProfWin *muc_window = NULL;
|
|
||||||
ProfWin *form_window = NULL;
|
|
||||||
int num;
|
|
||||||
|
|
||||||
if (roomjid) {
|
if (roomjid) {
|
||||||
muc_window = (ProfWin*)wins_get_muc(roomjid);
|
ProfWin *form_window = NULL;
|
||||||
|
ProfWin *muc_window = (ProfWin*)wins_get_muc(roomjid);
|
||||||
|
|
||||||
GString *form_recipient = g_string_new(roomjid);
|
GString *form_recipient = g_string_new(roomjid);
|
||||||
g_string_append(form_recipient, " config");
|
g_string_append(form_recipient, " config");
|
||||||
@@ -2599,7 +2596,7 @@ ui_handle_room_config_submit_result(const char * const roomjid)
|
|||||||
g_string_free(form_recipient, TRUE);
|
g_string_free(form_recipient, TRUE);
|
||||||
|
|
||||||
if (form_window) {
|
if (form_window) {
|
||||||
num = wins_get_num(form_window);
|
int num = wins_get_num(form_window);
|
||||||
wins_close_by_num(num);
|
wins_close_by_num(num);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2620,10 +2617,9 @@ void
|
|||||||
ui_handle_room_config_submit_result_error(const char * const roomjid, const char * const message)
|
ui_handle_room_config_submit_result_error(const char * const roomjid, const char * const message)
|
||||||
{
|
{
|
||||||
ProfWin *console = wins_get_console();
|
ProfWin *console = wins_get_console();
|
||||||
|
if (roomjid) {
|
||||||
ProfWin *muc_window = NULL;
|
ProfWin *muc_window = NULL;
|
||||||
ProfWin *form_window = NULL;
|
ProfWin *form_window = NULL;
|
||||||
|
|
||||||
if (roomjid) {
|
|
||||||
muc_window = (ProfWin*)wins_get_muc(roomjid);
|
muc_window = (ProfWin*)wins_get_muc(roomjid);
|
||||||
|
|
||||||
GString *form_recipient = g_string_new(roomjid);
|
GString *form_recipient = g_string_new(roomjid);
|
||||||
|
|||||||
@@ -471,12 +471,12 @@ win_clear(ProfWin *window)
|
|||||||
void
|
void
|
||||||
win_resize(ProfWin *window)
|
win_resize(ProfWin *window)
|
||||||
{
|
{
|
||||||
int subwin_cols = 0;
|
|
||||||
int cols = getmaxx(stdscr);
|
int cols = getmaxx(stdscr);
|
||||||
|
|
||||||
if (window->layout->type == LAYOUT_SPLIT) {
|
if (window->layout->type == LAYOUT_SPLIT) {
|
||||||
ProfLayoutSplit *layout = (ProfLayoutSplit*)window->layout;
|
ProfLayoutSplit *layout = (ProfLayoutSplit*)window->layout;
|
||||||
if (layout->subwin) {
|
if (layout->subwin) {
|
||||||
|
int subwin_cols = 0;
|
||||||
if (window->type == WIN_CONSOLE) {
|
if (window->type == WIN_CONSOLE) {
|
||||||
subwin_cols = win_roster_cols();
|
subwin_cols = win_roster_cols();
|
||||||
} else if (window->type == WIN_MUC) {
|
} else if (window->type == WIN_MUC) {
|
||||||
@@ -506,11 +506,11 @@ win_update_virtual(ProfWin *window)
|
|||||||
{
|
{
|
||||||
int rows, cols;
|
int rows, cols;
|
||||||
getmaxyx(stdscr, rows, cols);
|
getmaxyx(stdscr, rows, cols);
|
||||||
int subwin_cols = 0;
|
|
||||||
|
|
||||||
if (window->layout->type == LAYOUT_SPLIT) {
|
if (window->layout->type == LAYOUT_SPLIT) {
|
||||||
ProfLayoutSplit *layout = (ProfLayoutSplit*)window->layout;
|
ProfLayoutSplit *layout = (ProfLayoutSplit*)window->layout;
|
||||||
if (layout->subwin) {
|
if (layout->subwin) {
|
||||||
|
int subwin_cols = 0;
|
||||||
if (window->type == WIN_MUC) {
|
if (window->type == WIN_MUC) {
|
||||||
subwin_cols = win_occpuants_cols();
|
subwin_cols = win_occpuants_cols();
|
||||||
} else {
|
} else {
|
||||||
@@ -905,6 +905,7 @@ win_vprint(ProfWin *window, const char show_char, int pad_indent, GDateTime *tim
|
|||||||
g_string_vprintf(fmt_msg, message, arg);
|
g_string_vprintf(fmt_msg, message, arg);
|
||||||
win_print(window, show_char, pad_indent, timestamp, flags, theme_item, from, fmt_msg->str);
|
win_print(window, show_char, pad_indent, timestamp, flags, theme_item, from, fmt_msg->str);
|
||||||
g_string_free(fmt_msg, TRUE);
|
g_string_free(fmt_msg, TRUE);
|
||||||
|
va_end(arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
Reference in New Issue
Block a user