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

Merge remote-tracking branch 'jubalh/jub'

This commit is contained in:
James Booth 2015-10-24 21:42:04 +01:00
commit 1d4d693a53
18 changed files with 183 additions and 191 deletions

View File

@ -2064,7 +2064,6 @@ cmd_info(ProfWin *window, const char * const command, gchar **args)
char *usr = args[0];
jabber_conn_status_t conn_status = jabber_get_connection_status();
PContact pcontact = NULL;
if (conn_status != JABBER_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) {
usr_jid = usr;
}
pcontact = roster_get_contact(usr_jid);
PContact pcontact = roster_get_contact(usr_jid);
if (pcontact) {
cons_show_info(pcontact);
} else {
@ -2148,7 +2147,6 @@ gboolean
cmd_caps(ProfWin *window, const char * const command, gchar **args)
{
jabber_conn_status_t conn_status = jabber_get_connection_status();
PContact pcontact = NULL;
Occupant *occupant = NULL;
if (conn_status != JABBER_CONNECTED) {
@ -2182,7 +2180,7 @@ cmd_caps(ProfWin *window, const char * const command, gchar **args)
if (jid->fulljid == NULL) {
cons_show("You must provide a full jid to the /caps command.");
} else {
pcontact = roster_get_contact(jid->barejid);
PContact pcontact = roster_get_contact(jid->barejid);
if (pcontact == NULL) {
cons_show("Contact not found in roster: %s", jid->barejid);
} else {
@ -2225,7 +2223,6 @@ gboolean
cmd_software(ProfWin *window, const char * const command, gchar **args)
{
jabber_conn_status_t conn_status = jabber_get_connection_status();
Occupant *occupant = NULL;
if (conn_status != JABBER_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]) {
ProfMucWin *mucwin = (ProfMucWin*)window;
assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
occupant = muc_roster_item(mucwin->roomjid, args[0]);
Occupant *occupant = muc_roster_item(mucwin->roomjid, args[0]);
if (occupant) {
Jid *jid = jid_create_from_bare_and_resource(mucwin->roomjid, args[0]);
iq_send_software_version(jid->fulljid);

View File

@ -644,3 +644,21 @@ strip_arg_quotes(const char * const input)
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;
}

View File

@ -128,5 +128,6 @@ int get_next_available_win_num(GList *used);
char* get_file_or_linked(char *loc, char *basedir);
char* strip_arg_quotes(const char *const input);
gboolean is_notify_enabled(void);
#endif

View File

@ -40,6 +40,7 @@
#endif
#include "profanity.h"
#include "common.h"
#include "command/command.h"
static gboolean version = FALSE;
@ -103,18 +104,7 @@ main(int argc, char **argv)
g_print("XMPP library: libstrophe\n");
#endif
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
if (notify_enabled) {
if (is_notify_enabled()) {
g_print("Desktop notification support: Enabled\n");
} else {
g_print("Desktop notification support: Disabled\n");

View File

@ -1170,18 +1170,7 @@ cons_show_ui_prefs(void)
void
cons_notify_setting(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
if (notify_enabled) {
if (is_notify_enabled()) {
if (prefs_get_boolean(PREF_NOTIFY_MESSAGE))
cons_show("Messages (/notify message) : ON");
else

View File

@ -2586,12 +2586,9 @@ ui_handle_room_configuration_form_error(const char * const roomjid, const char *
void
ui_handle_room_config_submit_result(const char * const roomjid)
{
ProfWin *muc_window = NULL;
ProfWin *form_window = NULL;
int num;
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);
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);
if (form_window) {
num = wins_get_num(form_window);
int num = wins_get_num(form_window);
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)
{
ProfWin *console = wins_get_console();
if (roomjid) {
ProfWin *muc_window = NULL;
ProfWin *form_window = NULL;
if (roomjid) {
muc_window = (ProfWin*)wins_get_muc(roomjid);
GString *form_recipient = g_string_new(roomjid);

View File

@ -471,12 +471,12 @@ win_clear(ProfWin *window)
void
win_resize(ProfWin *window)
{
int subwin_cols = 0;
int cols = getmaxx(stdscr);
if (window->layout->type == LAYOUT_SPLIT) {
ProfLayoutSplit *layout = (ProfLayoutSplit*)window->layout;
if (layout->subwin) {
int subwin_cols = 0;
if (window->type == WIN_CONSOLE) {
subwin_cols = win_roster_cols();
} else if (window->type == WIN_MUC) {
@ -506,11 +506,11 @@ win_update_virtual(ProfWin *window)
{
int rows, cols;
getmaxyx(stdscr, rows, cols);
int subwin_cols = 0;
if (window->layout->type == LAYOUT_SPLIT) {
ProfLayoutSplit *layout = (ProfLayoutSplit*)window->layout;
if (layout->subwin) {
int subwin_cols = 0;
if (window->type == WIN_MUC) {
subwin_cols = win_occpuants_cols();
} 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);
win_print(window, show_char, pad_indent, timestamp, flags, theme_item, from, fmt_msg->str);
g_string_free(fmt_msg, TRUE);
va_end(arg);
}
void