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

Merge branch 'master' into osx-functional

This commit is contained in:
James Booth 2015-11-02 21:27:40 +00:00
commit 6593af2e86
11 changed files with 46 additions and 154 deletions

View File

@ -857,7 +857,7 @@ cmd_wins(ProfWin *window, const char *const command, gchar **args)
if (args[0] == NULL) {
cons_show_wins();
} else if (strcmp(args[0], "tidy") == 0) {
if (ui_tidy_wins()) {
if (wins_tidy()) {
cons_show("Windows tidied.");
} else {
cons_show("No tidy needed.");
@ -875,7 +875,7 @@ cmd_wins(ProfWin *window, const char *const command, gchar **args)
} else if (source_win == 10 || target_win == 10) {
cons_show("Window 10 does not exist");
} else if (source_win != target_win) {
gboolean swapped = ui_swap_wins(source_win, target_win);
gboolean swapped = wins_swap(source_win, target_win);
if (swapped) {
cons_show("Swapped windows %d <-> %d", source_win, target_win);
} else {
@ -889,7 +889,7 @@ cmd_wins(ProfWin *window, const char *const command, gchar **args)
if (g_strcmp0(args[1], "on") == 0) {
cons_show("Window autotidy enabled");
prefs_set_boolean(PREF_WINS_AUTO_TIDY, TRUE);
ui_tidy_wins();
wins_tidy();
} else if (g_strcmp0(args[1], "off") == 0) {
cons_show("Window autotidy disabled");
prefs_set_boolean(PREF_WINS_AUTO_TIDY, FALSE);
@ -912,7 +912,7 @@ cmd_win(ProfWin *window, const char *const command, gchar **args)
if (!focuswin) {
cons_show("Window %d does not exist.", num);
} else {
ui_switch_win(focuswin);
ui_focus_win(focuswin);
}
return TRUE;
@ -1467,7 +1467,7 @@ cmd_who(ProfWin *window, const char *const command, gchar **args)
}
if (window->type != WIN_CONSOLE && window->type != WIN_MUC) {
ui_statusbar_new(1);
status_bar_new(1);
}
return TRUE;
@ -1499,7 +1499,7 @@ cmd_msg(ProfWin *window, const char *const command, gchar **args)
if (!privwin) {
privwin = ui_new_private_win(full_jid->str);
}
ui_switch_win((ProfWin*)privwin);
ui_focus_win((ProfWin*)privwin);
if (msg) {
cl_ev_send_priv_msg(privwin, msg);
@ -1524,7 +1524,7 @@ cmd_msg(ProfWin *window, const char *const command, gchar **args)
if (!chatwin) {
chatwin = chatwin_new(barejid);
}
ui_switch_win((ProfWin*)chatwin);
ui_focus_win((ProfWin*)chatwin);
if (msg) {
cl_ev_send_msg(chatwin, msg);
@ -2745,7 +2745,7 @@ cmd_form(ProfWin *window, const char *const command, gchar **args)
if (!new_current) {
new_current = wins_get_console();
}
ui_switch_win(new_current);
ui_focus_win(new_current);
wins_close_by_num(num);
}
@ -3094,7 +3094,7 @@ cmd_room(ProfWin *window, const char *const command, gchar **args)
ProfMucConfWin *confwin = wins_get_muc_conf(mucwin->roomjid);
if (confwin) {
ui_switch_win((ProfWin*)confwin);
ui_focus_win((ProfWin*)confwin);
} else {
iq_request_room_config_form(mucwin->roomjid);
}
@ -3530,7 +3530,7 @@ cmd_tiny(ProfWin *window, const char *const command, gchar **args)
gboolean
cmd_clear(ProfWin *window, const char *const command, gchar **args)
{
ui_clear_win(window);
win_clear(window);
return TRUE;
}
@ -3600,7 +3600,7 @@ cmd_close(ProfWin *window, const char *const command, gchar **args)
// Tidy up the window list.
if (prefs_get_boolean(PREF_WINS_AUTO_TIDY)) {
ui_tidy_wins();
wins_tidy();
}
return TRUE;
@ -4399,10 +4399,10 @@ cmd_xmlconsole(ProfWin *window, const char *const command, gchar **args)
{
ProfXMLWin *xmlwin = wins_get_xmlconsole();
if (xmlwin) {
ui_switch_win((ProfWin*)xmlwin);
ui_focus_win((ProfWin*)xmlwin);
} else {
ProfWin *window = wins_new_xmlconsole();
ui_switch_win(window);
ui_focus_win(window);
}
return TRUE;
@ -4712,7 +4712,7 @@ cmd_pgp(ProfWin *window, const char *const command, gchar **args)
if (!chatwin) {
chatwin = chatwin_new(barejid);
}
ui_switch_win((ProfWin*)chatwin);
ui_focus_win((ProfWin*)chatwin);
} else {
chatwin = (ProfChatWin*)window;
assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
@ -4913,7 +4913,7 @@ cmd_otr(ProfWin *window, const char *const command, gchar **args)
if (!chatwin) {
chatwin = chatwin_new(barejid);
}
ui_switch_win((ProfWin*)chatwin);
ui_focus_win((ProfWin*)chatwin);
if (chatwin->pgp_send) {
ui_current_print_formatted_line('!', 0, "You must disable PGP encryption before starting an OTR session.");

View File

@ -132,7 +132,7 @@ prof_handle_idle(void)
{
jabber_conn_status_t status = jabber_get_connection_status();
if (status == JABBER_CONNECTED) {
GSList *recipients = ui_get_chat_recipients();
GSList *recipients = wins_get_chat_recipients();
GSList *curr = recipients;
while (curr) {
@ -227,7 +227,7 @@ _check_autoaway(void)
}
prefs_free_string(message);
ui_titlebar_presence(CONTACT_AWAY);
title_bar_set_presence(CONTACT_AWAY);
}
} else if (g_strcmp0(mode, "idle") == 0) {
activity_state = ACTIVITY_ST_IDLE;
@ -267,7 +267,7 @@ _check_autoaway(void)
}
prefs_free_string(message);
ui_titlebar_presence(CONTACT_XA);
title_bar_set_presence(CONTACT_XA);
} else if (check && (idle_ms < away_time_ms)) {
activity_state = ACTIVITY_ST_ACTIVE;
@ -276,7 +276,7 @@ _check_autoaway(void)
// send saved presence without last activity
cl_ev_presence_send(saved_presence, saved_status, 0);
contact_presence_t contact_pres = contact_presence_from_resource_presence(saved_presence);
ui_titlebar_presence(contact_pres);
title_bar_set_presence(contact_pres);
}
break;
case ACTIVITY_ST_XA:
@ -288,7 +288,7 @@ _check_autoaway(void)
// send saved presence without last activity
cl_ev_presence_send(saved_presence, saved_status, 0);
contact_presence_t contact_pres = contact_presence_from_resource_presence(saved_presence);
ui_titlebar_presence(contact_pres);
title_bar_set_presence(contact_pres);
}
break;
}

View File

@ -76,17 +76,14 @@
#include "xmpp/xmpp.h"
static char *win_title;
static int inp_size;
static gboolean perform_resize = FALSE;
static GTimer *ui_idle_time;
#ifdef HAVE_LIBXSS
static Display *display;
#endif
static GTimer *ui_idle_time;
static void _ui_draw_term_title(void);
void
@ -307,13 +304,6 @@ ui_contact_typing(const char *const barejid, const char *const resource)
}
}
GSList*
ui_get_chat_recipients(void)
{
GSList *recipients = wins_get_chat_recipients();
return recipients;
}
void
ui_incoming_private_msg(const char *const fulljid, const char *const message, GDateTime *timestamp)
{
@ -404,12 +394,6 @@ ui_group_removed(const char *const contact, const char *const group)
rosterwin_roster();
}
void
ui_titlebar_presence(contact_presence_t presence)
{
title_bar_set_presence(presence);
}
void
ui_handle_login_account_success(ProfAccount *account, int secured)
{
@ -442,18 +426,6 @@ ui_update_presence(const resource_presence_t resource_presence,
}
}
void
ui_handle_recipient_not_found(const char *const recipient, const char *const err_msg)
{
// intended recipient was invalid chat room
ProfMucWin *mucwin = wins_get_muc(recipient);
if (mucwin) {
cons_show_error("Room %s not found: %s", recipient, err_msg);
win_vprint((ProfWin*) mucwin, '!', 0, NULL, 0, THEME_ERROR, "", "Room %s not found: %s", recipient, err_msg);
return;
}
}
void
ui_handle_recipient_error(const char *const recipient, const char *const err_msg)
{
@ -692,7 +664,7 @@ ui_win_has_unsaved_form(int num)
}
void
ui_switch_win(ProfWin *window)
ui_focus_win(ProfWin *window)
{
assert(window != NULL);
@ -740,12 +712,6 @@ ui_close_win(int index)
status_bar_active(1);
}
gboolean
ui_tidy_wins(void)
{
return wins_tidy();
}
void
ui_prune_wins(void)
{
@ -785,19 +751,6 @@ ui_prune_wins(void)
}
}
gboolean
ui_swap_wins(int source_win, int target_win)
{
return wins_swap(source_win, target_win);
}
win_type_t
ui_win_type(int index)
{
ProfWin *window = wins_get_by_num(index);
return window->type;
}
void
ui_current_print_line(const char *const msg, ...)
{
@ -897,7 +850,7 @@ ui_room_join(const char *const roomjid, gboolean focus)
if (focus) {
ui_switch_win(window);
ui_focus_win(window);
} else {
int num = wins_get_num(window);
status_bar_active(num);
@ -911,13 +864,7 @@ void
ui_switch_to_room(const char *const roomjid)
{
ProfWin *window = (ProfWin*)wins_get_muc(roomjid);
ui_switch_win(window);
}
void
ui_handle_room_join_error(const char *const roomjid, const char *const err)
{
cons_show_error("Error joining room %s, reason: %s", roomjid, err);
ui_focus_win(window);
}
void
@ -1025,12 +972,6 @@ ui_room_banned(const char *const roomjid, const char *const actor, const char *c
}
}
gint
ui_unread(void)
{
return wins_get_total_unread();
}
int
ui_win_unread(int index)
{
@ -1133,12 +1074,6 @@ ui_clear_win_title(void)
printf("%c]0;%c", '\033', '\007');
}
void
ui_clear_win(ProfWin *window)
{
win_clear(window);
}
void
ui_goodbye_title(void)
{
@ -1146,12 +1081,6 @@ ui_goodbye_title(void)
if(result == -1) log_error("Error printing title on shutdown");
}
void
ui_statusbar_new(const int win)
{
status_bar_new(win);
}
static void
_ui_draw_term_title(void)
{
@ -1160,7 +1089,7 @@ _ui_draw_term_title(void)
if (status == JABBER_CONNECTED) {
const char * const jid = jabber_get_fulljid();
gint unread = ui_unread();
gint unread = wins_get_total_unread();
if (unread != 0) {
snprintf(new_win_title, sizeof(new_win_title),
@ -1367,7 +1296,7 @@ ui_handle_room_configuration(const char *const roomjid, DataForm *form)
ProfMucConfWin *confwin = (ProfMucConfWin*)window;
assert(confwin->memcheck == PROFCONFWIN_MEMCHECK);
ui_switch_win(window);
ui_focus_win(window);
ui_show_form(confwin);
win_print(window, '-', 0, NULL, 0, 0, "", "");
@ -1419,11 +1348,11 @@ ui_handle_room_config_submit_result(const char *const roomjid)
}
if (muc_window) {
ui_switch_win((ProfWin*)muc_window);
ui_focus_win((ProfWin*)muc_window);
win_print(muc_window, '!', 0, NULL, 0, THEME_ROOMINFO, "", "Room configuration successful");
} else {
ProfWin *console = wins_get_console();
ui_switch_win(console);
ui_focus_win(console);
cons_show("Room configuration successful: %s", roomjid);
}
} else {

View File

@ -456,7 +456,7 @@ _go_to_win(int i)
{
ProfWin *window = wins_get_by_num(i);
if (window) {
ui_switch_win(window);
ui_focus_win(window);
}
}
@ -535,7 +535,7 @@ _inp_rl_altleft_handler(int count, int key)
{
ProfWin *window = wins_get_previous();
if (window) {
ui_switch_win(window);
ui_focus_win(window);
}
return 0;
}
@ -545,7 +545,7 @@ _inp_rl_altright_handler(int count, int key)
{
ProfWin *window = wins_get_next();
if (window) {
ui_switch_win(window);
ui_focus_win(window);
}
return 0;
}

View File

@ -149,7 +149,7 @@ notify_remind(void)
gdouble elapsed = g_timer_elapsed(remind_timer, NULL);
gint remind_period = prefs_get_notify_remind();
if (remind_period > 0 && elapsed >= remind_period) {
gint unread = ui_unread();
gint unread = wins_get_total_unread();
gint open = muc_invites_count();
gint subs = presence_sub_request_count();

View File

@ -39,7 +39,6 @@ void create_title_bar(void);
void title_bar_update_virtual(void);
void title_bar_resize(void);
void title_bar_console(void);
void title_bar_set_presence(contact_presence_t presence);
void title_bar_set_connected(gboolean connected);
void title_bar_set_tls(gboolean secured);
void title_bar_switch(void);

View File

@ -63,15 +63,13 @@ void ui_update(void);
void ui_close(void);
void ui_redraw(void);
void ui_resize(void);
GSList* ui_get_chat_recipients(void);
void ui_switch_win(ProfWin *window);
void ui_focus_win(ProfWin *window);
void ui_sigwinch_handler(int sig);
void ui_handle_otr_error(const char *const barejid, const char *const message);
unsigned long ui_get_idle_time(void);
void ui_reset_idle_time(void);
ProfPrivateWin* ui_new_private_win(const char *const fulljid);
void ui_print_system_msg_from_recipient(const char *const barejid, const char *message);
gint ui_unread(void);
void ui_close_connected_win(int index);
int ui_close_all_wins(void);
int ui_close_read_wins(void);
@ -79,7 +77,6 @@ void ui_current_print_line(const char *const msg, ...);
void ui_current_print_formatted_line(const char show_char, int attrs, const char *const msg, ...);
void ui_current_error_line(const char *const msg);
void ui_win_error_line(ProfWin *window, const char *const msg);
win_type_t ui_win_type(int index);
void ui_close_win(int index);
int ui_win_unread(int index);
char* ui_ask_password(void);
@ -107,12 +104,10 @@ void ui_contact_not_in_group(const char *const contact, const char *const group)
void ui_group_added(const char *const contact, const char *const group);
void ui_group_removed(const char *const contact, const char *const group);
void ui_contact_offline(char *barejid, char *resource, char *status);
void ui_handle_recipient_not_found(const char *const recipient, const char *const err_msg);
void ui_handle_recipient_error(const char *const recipient, const char *const err_msg);
void ui_handle_error(const char *const err_msg);
void ui_clear_win_title(void);
void ui_goodbye_title(void);
void ui_handle_room_join_error(const char *const roomjid, const char *const err);
void ui_handle_room_configuration(const char *const roomjid, DataForm *form);
void ui_handle_room_configuration_form_error(const char *const roomjid, const char *const message);
void ui_handle_room_config_submit_result(const char *const roomjid);
@ -128,15 +123,10 @@ void ui_hide_all_room_rosters(void);
void ui_handle_software_version_error(const char *const roomjid, const char *const message);
void ui_show_software_version(const char *const jid, const char *const presence, const char *const name,
const char *const version, const char *const os);
gboolean ui_tidy_wins(void);
void ui_prune_wins(void);
gboolean ui_swap_wins(int source_win, int target_win);
void ui_clear_win(ProfWin *window);
void ui_auto_away(char *message, gint time, resource_presence_t res_presence);
void ui_titlebar_presence(contact_presence_t presence);
void ui_handle_login_account_success(ProfAccount *account, int secured);
void ui_update_presence(const resource_presence_t resource_presence, const char *const message, const char *const show);
void ui_statusbar_new(const int win);
void ui_write(char *line, int offset);
void ui_invalid_command_usage(const char *const cmd, void (*setting_func)(void));
gboolean ui_win_has_unsaved_form(int num);
@ -301,6 +291,9 @@ void cons_show_contact_online(PContact contact, Resource *resource, GDateTime *l
void cons_show_contact_offline(PContact contact, char *resource, char *status);
void cons_theme_colours(void);
// title bar
void title_bar_set_presence(contact_presence_t presence);
// status bar
void status_bar_inactive(const int win);
void status_bar_active(const int win);
@ -337,6 +330,7 @@ void win_show_contact(ProfWin *window, PContact contact);
void win_show_info(ProfWin *window, PContact contact);
void win_println(ProfWin *window, int pad, const char *const message);
void win_vprintln_ch(ProfWin *window, char ch, const char *const message, ...);
void win_clear(ProfWin *window);
// desktop notifications
void notifier_initialise(void);

View File

@ -72,8 +72,6 @@ void win_mark_received(ProfWin *window, const char *const id);
gboolean win_has_active_subwin(ProfWin *window);
void win_clear(ProfWin *window);
void win_page_up(ProfWin *window);
void win_page_down(ProfWin *window);
void win_sub_page_down(ProfWin *window);

View File

@ -536,7 +536,7 @@ wins_swap(int source_win, int target_win)
}
if (wins_get_current_num() == source_win) {
wins_set_current_by_num(target_win);
ui_switch_win(console);
ui_focus_win(console);
}
return TRUE;
@ -557,7 +557,7 @@ wins_swap(int source_win, int target_win)
status_bar_active(source_win);
}
if ((wins_get_current_num() == source_win) || (wins_get_current_num() == target_win)) {
ui_switch_win(console);
ui_focus_win(console);
}
return TRUE;
}
@ -617,7 +617,7 @@ wins_tidy(void)
windows = new_windows;
current = 1;
ProfWin *console = wins_get_console();
ui_switch_win(console);
ui_focus_win(console);
g_list_free(keys);
return TRUE;
} else {

View File

@ -390,7 +390,7 @@ _presence_error_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza,
if (muc_active(fulljid->barejid)) {
muc_leave(fulljid->barejid);
}
ui_handle_room_join_error(fulljid->barejid, error_cond);
cons_show_error("Error joining room %s, reason: %s", fulljid->barejid, error_cond);
jid_destroy(fulljid);
return 1;
}

View File

@ -64,12 +64,8 @@ void ui_update(void) {}
void ui_close(void) {}
void ui_redraw(void) {}
void ui_resize(void) {}
GSList* ui_get_chat_recipients(void)
{
return NULL;
}
void ui_switch_win(ProfWin *win) {}
void ui_focus_win(ProfWin *win) {}
#ifdef HAVE_LIBOTR
void chatwin_otr_secured(ProfChatWin *chatwin, gboolean trusted) {}
@ -98,10 +94,6 @@ ProfChatWin* chatwin_new(const char * const barejid)
}
void ui_print_system_msg_from_recipient(const char * const barejid, const char *message) {}
gint ui_unread(void)
{
return 0;
}
void ui_close_connected_win(int index) {}
int ui_close_all_wins(void)
@ -140,12 +132,6 @@ void ui_current_print_formatted_line(const char show_char, int attrs, const char
void ui_current_error_line(const char * const msg) {}
void ui_win_error_line(ProfWin *window, const char * const msg) {}
win_type_t ui_win_type(int index)
{
return WIN_CONSOLE;
}
void ui_close_win(int index) {}
int ui_win_unread(int index)
@ -153,8 +139,6 @@ int ui_win_unread(int index)
return 0;
}
void ui_clear_win(ProfWin *window) {}
char * ui_ask_password(void)
{
return mock_ptr_type(char *);
@ -247,12 +231,6 @@ void chatwin_contact_offline(ProfChatWin *chatwin, char *resource, char *status)
void ui_contact_offline(char *barejid, char *resource, char *status) {}
void ui_handle_recipient_not_found(const char * const recipient, const char * const err_msg)
{
check_expected(recipient);
check_expected(err_msg);
}
void ui_handle_recipient_error(const char * const recipient, const char * const err_msg)
{
check_expected(recipient);
@ -266,7 +244,6 @@ void ui_handle_error(const char * const err_msg)
void ui_clear_win_title(void) {}
void ui_goodbye_title(void) {}
void ui_handle_room_join_error(const char * const roomjid, const char * const err) {}
void ui_handle_room_configuration(const char * const roomjid, DataForm *form) {}
void ui_handle_room_configuration_form_error(const char * const roomjid, const char * const message) {}
void ui_handle_room_config_submit_result(const char * const roomjid) {}
@ -289,20 +266,11 @@ void ui_redraw_all_room_rosters(void) {}
void ui_show_all_room_rosters(void) {}
void ui_hide_all_room_rosters(void) {}
gboolean ui_tidy_wins(void) {
return TRUE;
}
void ui_prune_wins(void) {}
gboolean ui_swap_wins(int source_win, int target_win)
{
return FALSE;
}
void ui_titlebar_presence(contact_presence_t presence) {}
void ui_handle_login_account_success(ProfAccount *account, int secured) {}
void ui_update_presence(const resource_presence_t resource_presence,
const char * const message, const char * const show) {}
void ui_statusbar_new(const int win) {}
char* inp_readline(void)
{
@ -469,6 +437,9 @@ void cons_show_contact_online(PContact contact, Resource *resource, GDateTime *l
void cons_show_contact_offline(PContact contact, char *resource, char *status) {}
void cons_theme_colours(void) {}
// title bar
void title_bar_set_presence(contact_presence_t presence) {}
// status bar
void status_bar_inactive(const int win) {}
void status_bar_active(const int win) {}
@ -531,6 +502,7 @@ void win_show_contact(ProfWin *window, PContact contact) {}
void win_show_info(ProfWin *window, PContact contact) {}
void win_println(ProfWin *window, int pad, const char * const message) {}
void win_vprintln_ch(ProfWin *window, char ch, const char *const message, ...) {}
void win_clear(ProfWin *window) {}
// desktop notifier actions
void notifier_uninit(void) {}