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:
commit
6667a37571
@ -24,6 +24,7 @@ core_sources = \
|
||||
src/ui/rosterwin.c src/ui/occupantswin.c \
|
||||
src/ui/buffer.c src/ui/buffer.h \
|
||||
src/ui/chatwin.c \
|
||||
src/ui/xmlwin.c \
|
||||
src/command/command.h src/command/command.c \
|
||||
src/command/commands.h src/command/commands.c \
|
||||
src/tools/parser.c \
|
||||
|
@ -4397,10 +4397,12 @@ cmd_vercheck(ProfWin *window, const char *const command, gchar **args)
|
||||
gboolean
|
||||
cmd_xmlconsole(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
if (!ui_xmlconsole_exists()) {
|
||||
ui_create_xmlconsole_win();
|
||||
ProfXMLWin *xmlwin = wins_get_xmlconsole();
|
||||
if (xmlwin) {
|
||||
ui_switch_win((ProfWin*)xmlwin);
|
||||
} else {
|
||||
ui_open_xmlconsole_win();
|
||||
ProfWin *window = wins_new_xmlconsole();
|
||||
ui_switch_win(window);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
@ -521,7 +521,10 @@ sv_ev_roster_update(const char *const barejid, const char *const name,
|
||||
void
|
||||
sv_ev_xmpp_stanza(const char *const msg)
|
||||
{
|
||||
ui_handle_stanza(msg);
|
||||
ProfXMLWin *xmlwin = wins_get_xmlconsole();
|
||||
if (xmlwin) {
|
||||
xmlwin_show(xmlwin, msg);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -222,36 +222,6 @@ ui_load_colours(void)
|
||||
}
|
||||
}
|
||||
|
||||
gboolean
|
||||
ui_xmlconsole_exists(void)
|
||||
{
|
||||
ProfXMLWin *xmlwin = wins_get_xmlconsole();
|
||||
if (xmlwin) {
|
||||
return TRUE;
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ui_handle_stanza(const char *const msg)
|
||||
{
|
||||
if (ui_xmlconsole_exists()) {
|
||||
ProfXMLWin *xmlconsole = wins_get_xmlconsole();
|
||||
ProfWin *window = (ProfWin*) xmlconsole;
|
||||
|
||||
if (g_str_has_prefix(msg, "SENT:")) {
|
||||
win_print(window, '-', 0, NULL, 0, 0, "", "SENT:");
|
||||
win_print(window, '-', 0, NULL, 0, THEME_ONLINE, "", &msg[6]);
|
||||
win_print(window, '-', 0, NULL, 0, THEME_ONLINE, "", "");
|
||||
} else if (g_str_has_prefix(msg, "RECV:")) {
|
||||
win_print(window, '-', 0, NULL, 0, 0, "", "RECV:");
|
||||
win_print(window, '-', 0, NULL, 0, THEME_AWAY, "", &msg[6]);
|
||||
win_print(window, '-', 0, NULL, 0, THEME_AWAY, "", "");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ui_contact_online(char *barejid, Resource *resource, GDateTime *last_activity)
|
||||
{
|
||||
@ -897,22 +867,6 @@ ui_new_private_win(const char *const fulljid)
|
||||
return (ProfPrivateWin*)window;
|
||||
}
|
||||
|
||||
void
|
||||
ui_create_xmlconsole_win(void)
|
||||
{
|
||||
ProfWin *window = wins_new_xmlconsole();
|
||||
ui_switch_win(window);
|
||||
}
|
||||
|
||||
void
|
||||
ui_open_xmlconsole_win(void)
|
||||
{
|
||||
ProfXMLWin *xmlwin = wins_get_xmlconsole();
|
||||
if (xmlwin) {
|
||||
ui_switch_win((ProfWin*)xmlwin);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ui_outgoing_private_msg(ProfPrivateWin *privwin, const char *const message)
|
||||
{
|
||||
|
@ -85,7 +85,6 @@ int ui_win_unread(int index);
|
||||
char* ui_ask_password(void);
|
||||
char* ui_get_line(void);
|
||||
char* ui_ask_pgp_passphrase(const char *hint, int prev_fail);
|
||||
void ui_handle_stanza(const char *const msg);
|
||||
void ui_contact_online(char *barejid, Resource *resource, GDateTime *last_activity);
|
||||
void ui_contact_typing(const char *const barejid, const char *const resource);
|
||||
void ui_incoming_private_msg(const char *const fulljid, const char *const message, GDateTime *timestamp);
|
||||
@ -188,9 +187,6 @@ void ui_update_presence(const resource_presence_t resource_presence, const char
|
||||
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));
|
||||
void ui_create_xmlconsole_win(void);
|
||||
gboolean ui_xmlconsole_exists(void);
|
||||
void ui_open_xmlconsole_win(void);
|
||||
gboolean ui_win_has_unsaved_form(int num);
|
||||
void ui_inp_history_append(char *inp);
|
||||
|
||||
@ -212,6 +208,9 @@ void chatwin_otr_untrust(ProfChatWin *chatwin);
|
||||
void chatwin_otr_smp_event(ProfChatWin *chatwin, prof_otr_smp_event_t event, void *data);
|
||||
#endif
|
||||
|
||||
// xml console
|
||||
void xmlwin_show(ProfXMLWin *xmlwin, const char *const msg);
|
||||
|
||||
// Input window
|
||||
char* inp_readline(void);
|
||||
void inp_nonblocking(gboolean reset);
|
||||
|
55
src/ui/xmlwin.c
Normal file
55
src/ui/xmlwin.c
Normal file
@ -0,0 +1,55 @@
|
||||
/*
|
||||
* xmlwin.c
|
||||
*
|
||||
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
* Profanity is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Profanity is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Profanity. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* In addition, as a special exception, the copyright holders give permission to
|
||||
* link the code of portions of this program with the OpenSSL library under
|
||||
* certain conditions as described in each individual source file, and
|
||||
* distribute linked combinations including the two.
|
||||
*
|
||||
* You must obey the GNU General Public License in all respects for all of the
|
||||
* code used other than OpenSSL. If you modify file(s) with this exception, you
|
||||
* may extend this exception to your version of the file(s), but you are not
|
||||
* obligated to do so. If you do not wish to do so, delete this exception
|
||||
* statement from your version. If you delete this exception statement from all
|
||||
* source files in the program, then also delete it here.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "ui/win_types.h"
|
||||
#include "window_list.h"
|
||||
|
||||
void
|
||||
xmlwin_show(ProfXMLWin *xmlwin, const char *const msg)
|
||||
{
|
||||
assert(xmlwin != NULL);
|
||||
|
||||
ProfWin *window = (ProfWin*)xmlwin;
|
||||
if (g_str_has_prefix(msg, "SENT:")) {
|
||||
win_print(window, '-', 0, NULL, 0, 0, "", "SENT:");
|
||||
win_print(window, '-', 0, NULL, 0, THEME_ONLINE, "", &msg[6]);
|
||||
win_print(window, '-', 0, NULL, 0, THEME_ONLINE, "", "");
|
||||
} else if (g_str_has_prefix(msg, "RECV:")) {
|
||||
win_print(window, '-', 0, NULL, 0, 0, "", "RECV:");
|
||||
win_print(window, '-', 0, NULL, 0, THEME_AWAY, "", &msg[6]);
|
||||
win_print(window, '-', 0, NULL, 0, THEME_AWAY, "", "");
|
||||
}
|
||||
}
|
@ -165,7 +165,7 @@ char *ui_get_line(void)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void ui_handle_stanza(const char * const msg) {}
|
||||
void xmlwin_show(ProfXMLWin *xmlwin, const char * const msg) {}
|
||||
|
||||
// ui events
|
||||
void ui_contact_online(char *barejid, Resource *resource, GDateTime *last_activity)
|
||||
@ -320,14 +320,6 @@ void ui_inp_history_append(char *inp) {}
|
||||
|
||||
void ui_invalid_command_usage(const char * const usage, void (*setting_func)(void)) {}
|
||||
|
||||
void ui_create_xmlconsole_win(void) {}
|
||||
gboolean ui_xmlconsole_exists(void)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void ui_open_xmlconsole_win(void) {}
|
||||
|
||||
gboolean ui_win_has_unsaved_form(int num)
|
||||
{
|
||||
return FALSE;
|
||||
|
Loading…
Reference in New Issue
Block a user