mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Merge branch 'master' into configure
This commit is contained in:
commit
2af8e9f117
@ -1,9 +1,11 @@
|
||||
dist: trusty
|
||||
sudo: required
|
||||
language: c
|
||||
install:
|
||||
- lsb_release -a
|
||||
- uname -a
|
||||
- sudo apt-get update
|
||||
- sudo apt-get -y install libssl-dev libexpat1-dev libncursesw5-dev libglib2.0-dev libnotify-dev libcurl3-dev libxss-dev libotr2-dev libgpgme11-dev autoconf-archive expect-dev tcl-dev libtool python-dev
|
||||
- sudo apt-get -y install libssl-dev libexpat1-dev libncursesw5-dev libglib2.0-dev libnotify-dev libcurl3-dev libxss-dev libotr5-dev libgpgme11-dev autoconf-archive expect-dev tcl-dev libtool python-dev libgtk2.0-dev
|
||||
- git clone git://github.com/boothj5/libmesode.git
|
||||
- cd libmesode
|
||||
- mkdir m4
|
||||
|
@ -9,8 +9,11 @@
|
||||
- Add prof.get_room_nick plugins api function
|
||||
- Add main.help.header theme option
|
||||
- Look for system TLS certificate path by default (/tls certpath)
|
||||
- Use service discovery to set account muc property
|
||||
- Allow clearing account muc and resource properties
|
||||
- Allow plugins to complete file paths with prof.filepath_completer_add function
|
||||
- Add encryption settings functions to plugins api
|
||||
- Allow plugins to block message sending on pre message send hooks
|
||||
- Bug fixes: https://github.com/boothj5/profanity/milestone/15?closed=1
|
||||
|
||||
0.5.0
|
||||
|
@ -1,5 +1,5 @@
|
||||
Profanity
|
||||
Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
|
||||
Profanity is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -245,7 +245,7 @@ endif
|
||||
|
||||
man_MANS = $(man_sources)
|
||||
|
||||
EXTRA_DIST = $(man_sources) $(icons_sources) $(themes_sources) $(script_sources) profrc.example LICENSE.txt
|
||||
EXTRA_DIST = $(man_sources) $(icons_sources) $(themes_sources) $(script_sources) profrc.example LICENSE.txt README.md CHANGELOG
|
||||
|
||||
if INCLUDE_GIT_VERSION
|
||||
EXTRA_DIST += .git/HEAD .git/index
|
||||
|
@ -48,7 +48,7 @@ master_doc = 'index'
|
||||
|
||||
# General information about the project.
|
||||
project = u'Profanity Python Plugins API'
|
||||
copyright = u'2016, boothj5'
|
||||
copyright = u'2016 - 2017, boothj5'
|
||||
author = u'boothj5'
|
||||
|
||||
# The version info for the project you're documenting, acts as replacement for
|
||||
|
@ -151,8 +151,8 @@ AS_IF([test "x$ncurses_cv_wget_wch" != xyes],
|
||||
[AC_MSG_ERROR([ncurses does not support wide characters])])
|
||||
|
||||
### Check for other profanity dependencies
|
||||
PKG_CHECK_MODULES([glib], [glib-2.0 >= 2.26], [],
|
||||
[AC_MSG_ERROR([glib 2.26 or higher is required for profanity])])
|
||||
PKG_CHECK_MODULES([glib], [glib-2.0 >= 2.40], [],
|
||||
[AC_MSG_ERROR([glib 2.40 or higher is required for profanity])])
|
||||
PKG_CHECK_MODULES([curl], [libcurl], [],
|
||||
[AC_CHECK_LIB([curl], [main], [],
|
||||
[AC_MSG_ERROR([libcurl is required for profanity])])])
|
||||
|
@ -1,4 +1,4 @@
|
||||
.TH Profanity 1 "August 2016" "Profanity XMPP client"
|
||||
.TH Profanity 1 "January 2017" "Profanity XMPP client"
|
||||
.SH NAME
|
||||
Profanity \- a simple console based XMPP chat client.
|
||||
.SH SYNOPSIS
|
||||
@ -62,7 +62,7 @@ or by sending a mail directly to:
|
||||
.br
|
||||
.PP
|
||||
.SH LICENSE
|
||||
Copyright (C) 2012 \- 2016 James Booth <boothj5web@gmail.com>.
|
||||
Copyright (C) 2012 \- 2017 James Booth <boothj5web@gmail.com>.
|
||||
License GPLv3+: GNU GPL version 3 or later <https://www.gnu.org/licenses/gpl.html>
|
||||
This is free software; you are free to change and redistribute it.
|
||||
There is NO WARRANTY, to the extent permitted by law.
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* cmd_ac.c
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
@ -184,6 +184,7 @@ static Autocomplete console_ac;
|
||||
static Autocomplete console_msg_ac;
|
||||
static Autocomplete autoping_ac;
|
||||
static Autocomplete plugins_ac;
|
||||
static Autocomplete plugins_sourcepath_ac;
|
||||
static Autocomplete plugins_load_ac;
|
||||
static Autocomplete plugins_unload_ac;
|
||||
static Autocomplete plugins_reload_ac;
|
||||
@ -714,6 +715,11 @@ cmd_ac_init(void)
|
||||
autocomplete_add(plugins_ac, "unload");
|
||||
autocomplete_add(plugins_ac, "reload");
|
||||
autocomplete_add(plugins_ac, "python_version");
|
||||
autocomplete_add(plugins_ac, "sourcepath");
|
||||
|
||||
plugins_sourcepath_ac = autocomplete_new();
|
||||
autocomplete_add(plugins_sourcepath_ac, "set");
|
||||
autocomplete_add(plugins_sourcepath_ac, "clear");
|
||||
|
||||
filepath_ac = autocomplete_new();
|
||||
|
||||
@ -1011,6 +1017,7 @@ cmd_ac_reset(ProfWin *window)
|
||||
autocomplete_reset(console_msg_ac);
|
||||
autocomplete_reset(autoping_ac);
|
||||
autocomplete_reset(plugins_ac);
|
||||
autocomplete_reset(plugins_sourcepath_ac);
|
||||
autocomplete_reset(blocked_ac);
|
||||
autocomplete_reset(tray_ac);
|
||||
autocomplete_reset(presence_ac);
|
||||
@ -2025,10 +2032,21 @@ _plugins_autocomplete(ProfWin *window, const char *const input)
|
||||
{
|
||||
char *result = NULL;
|
||||
|
||||
if (strncmp(input, "/plugins sourcepath set ", 24) == 0) {
|
||||
return cmd_ac_complete_filepath(input, "/plugins sourcepath set");
|
||||
}
|
||||
|
||||
if (strncmp(input, "/plugins install ", 17) == 0) {
|
||||
return cmd_ac_complete_filepath(input, "/plugins install");
|
||||
}
|
||||
|
||||
if (strncmp(input, "/plugins sourcepath ", 20) == 0) {
|
||||
result = autocomplete_param_with_ac(input, "/plugins sourcepath", plugins_sourcepath_ac, TRUE);
|
||||
if (result) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
if (strncmp(input, "/plugins load ", 14) == 0) {
|
||||
if (plugins_load_ac == NULL) {
|
||||
plugins_load_ac = autocomplete_new();
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* cmd_ac.h
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* cmd_defs.c
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
@ -576,7 +576,7 @@ static struct cmd_t command_defs[] =
|
||||
CMD_SYN(
|
||||
"/leave")
|
||||
CMD_DESC(
|
||||
"Leave the current chat room.")
|
||||
"Leave the current chat or room.")
|
||||
CMD_NOARGS
|
||||
CMD_NOEXAMPLES
|
||||
},
|
||||
@ -1580,7 +1580,7 @@ static struct cmd_t command_defs[] =
|
||||
CMD_EXAMPLES(
|
||||
"/alias add friends /who online friends",
|
||||
"/alias add /q /quit",
|
||||
"/alias a /away \"I'm in a meeting.\"",
|
||||
"/alias add a /away \"I'm in a meeting.\"",
|
||||
"/alias remove q",
|
||||
"/alias list")
|
||||
},
|
||||
@ -2046,26 +2046,38 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/plugins",
|
||||
parse_args, 0, 2, NULL,
|
||||
CMD_NOSUBFUNCS
|
||||
parse_args, 0, 3, NULL,
|
||||
CMD_SUBFUNCS(
|
||||
{ "sourcepath", cmd_plugins_sourcepath },
|
||||
{ "install", cmd_plugins_install },
|
||||
{ "load", cmd_plugins_load },
|
||||
{ "unload", cmd_plugins_unload },
|
||||
{ "reload", cmd_plugins_reload },
|
||||
{ "python_version", cmd_plugins_python_version })
|
||||
CMD_MAINFUNC(cmd_plugins)
|
||||
CMD_NOTAGS
|
||||
CMD_SYN(
|
||||
"/plugins",
|
||||
"/plugins install <path>",
|
||||
"/plugins unload <plugin>",
|
||||
"/plugins load <plugin>",
|
||||
"/plugins sourcepath set <path>",
|
||||
"/plugins sourcepath clear",
|
||||
"/plugins install [<path>]",
|
||||
"/plugins unload [<plugin>]",
|
||||
"/plugins load [<plugin>]",
|
||||
"/plugins reload [<plugin>]",
|
||||
"/plugins python_version")
|
||||
CMD_DESC(
|
||||
"Manage plugins. Passing no arguments lists currently loaded plugins.")
|
||||
CMD_ARGS(
|
||||
{ "install <file>", "Install file to plugins directory, and load or reload the plugin." },
|
||||
{ "load <plugin>", "Load a plugin that already exists in the plugin directory." },
|
||||
{ "unload <plugin>", "Unload a loaded plugin." },
|
||||
{ "reload [<plugin>]", "Reload a plugin, passing no argument will reload all plugins." },
|
||||
{ "python_version", "Show the Python interpreter version." })
|
||||
{ "sourcepath set <path>", "Set the default path to install plugins from, will be used if no arg is passed to /plugins install." },
|
||||
{ "sourcepath clear", "Clear the default plugins source path." },
|
||||
{ "install [<path>]", "Install a plugin, or all plugins found in a directory (recursive). Passing no argument will use the sourcepath if one is set." },
|
||||
{ "load [<plugin>]", "Load a plugin that already exists in the plugin directory, passing no argument loads all found plugins." },
|
||||
{ "unload [<plugin>]", "Unload a loaded plugin, passing no argument will unload all plugins." },
|
||||
{ "reload [<plugin>]", "Reload a plugin, passing no argument will reload all plugins." },
|
||||
{ "python_version", "Show the Python interpreter version." })
|
||||
CMD_EXAMPLES(
|
||||
"/plugins sourcepath set /home/meee/projects/profanity-plugins",
|
||||
"/plugins install",
|
||||
"/plugins install /home/steveharris/Downloads/metal.py",
|
||||
"/plugins load browser.py",
|
||||
"/plugins unload say.py",
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* cmd_defs.h
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* cmd_funcs.c
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
@ -4756,24 +4756,14 @@ cmd_clear(ProfWin *window, const char *const command, gchar **args)
|
||||
gboolean
|
||||
cmd_leave(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
jabber_conn_status_t conn_status = connection_get_status();
|
||||
int index = wins_get_current_num();
|
||||
|
||||
if (window->type != WIN_MUC) {
|
||||
cons_show("You can only use the /leave command in a chat room.");
|
||||
if (window->type != WIN_MUC && window->type != WIN_CHAT && window->type != WIN_PRIVATE) {
|
||||
cons_show("The /leave command is only valid in chat, or chat room windows.");
|
||||
cons_alert();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// handle leaving rooms, or chat
|
||||
if (conn_status == JABBER_CONNECTED) {
|
||||
ui_close_connected_win(index);
|
||||
}
|
||||
|
||||
// close the window
|
||||
ui_close_win(index);
|
||||
|
||||
return TRUE;
|
||||
// use /close behaviour
|
||||
return cmd_close(window, "/leave", args);
|
||||
}
|
||||
|
||||
gboolean
|
||||
@ -6212,44 +6202,91 @@ cmd_xa(ProfWin *window, const char *const command, gchar **args)
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_plugins(ProfWin *window, const char *const command, gchar **args)
|
||||
cmd_plugins_sourcepath(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
if (g_strcmp0(args[0], "install") == 0) {
|
||||
char *filename = args[1];
|
||||
if (filename == NULL) {
|
||||
if (args[1] == NULL) {
|
||||
char *sourcepath = prefs_get_string(PREF_PLUGINS_SOURCEPATH);
|
||||
if (sourcepath) {
|
||||
cons_show("Current plugins sourcepath: %s", sourcepath);
|
||||
prefs_free_string(sourcepath);
|
||||
} else {
|
||||
cons_show("Plugins sourcepath not currently set.");
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (g_strcmp0(args[1], "clear") == 0) {
|
||||
prefs_set_string(PREF_PLUGINS_SOURCEPATH, NULL);
|
||||
cons_show("Plugins sourcepath cleared.");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (g_strcmp0(args[1], "set") == 0) {
|
||||
char *path = args[2];
|
||||
if (path == NULL) {
|
||||
cons_bad_cmd_usage(command);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// expand ~ to $HOME
|
||||
if (filename[0] == '~' && filename[1] == '/') {
|
||||
if (asprintf(&filename, "%s/%s", getenv("HOME"), filename+2) == -1) {
|
||||
if (path[0] == '~' && path[1] == '/') {
|
||||
if (asprintf(&path, "%s/%s", getenv("HOME"), path+2) == -1) {
|
||||
return TRUE;
|
||||
}
|
||||
} else {
|
||||
filename = strdup(filename);
|
||||
path = strdup(path);
|
||||
}
|
||||
|
||||
if (access(filename, R_OK) != 0) {
|
||||
cons_show("File not found: %s", filename);
|
||||
free(filename);
|
||||
if (!is_dir(path)) {
|
||||
cons_show("Plugins sourcepath must be a directory.");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (!is_regular_file(filename)) {
|
||||
cons_show("Not a file: %s", filename);
|
||||
free(filename);
|
||||
cons_show("Setting plugins sourcepath: %s", path);
|
||||
prefs_set_string(PREF_PLUGINS_SOURCEPATH, path);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
cons_bad_cmd_usage(command);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_plugins_install(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
char *path = args[1];
|
||||
if (path == NULL) {
|
||||
char* sourcepath = prefs_get_string(PREF_PLUGINS_SOURCEPATH);
|
||||
if (sourcepath) {
|
||||
path = strdup(sourcepath);
|
||||
prefs_free_string(sourcepath);
|
||||
} else {
|
||||
cons_show("Either a path must be provided or the sourcepath property must be set, see /help plugins");
|
||||
return TRUE;
|
||||
}
|
||||
} else if (path[0] == '~' && path[1] == '/') {
|
||||
if (asprintf(&path, "%s/%s", getenv("HOME"), path+2) == -1) {
|
||||
return TRUE;
|
||||
}
|
||||
} else {
|
||||
path = strdup(path);
|
||||
}
|
||||
|
||||
if (!g_str_has_suffix(filename, ".py") && !g_str_has_suffix(filename, ".so")) {
|
||||
if (access(path, R_OK) != 0) {
|
||||
cons_show("File not found: %s", path);
|
||||
free(path);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (is_regular_file(path)) {
|
||||
if (!g_str_has_suffix(path, ".py") && !g_str_has_suffix(path, ".so")) {
|
||||
cons_show("Plugins must have one of the following extensions: '.py' '.so'");
|
||||
free(filename);
|
||||
free(path);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gchar *plugin_name = g_path_get_basename(filename);
|
||||
gboolean result = plugins_install(plugin_name, filename);
|
||||
gchar *plugin_name = g_path_get_basename(path);
|
||||
gboolean result = plugins_install(plugin_name, path);
|
||||
if (result) {
|
||||
cons_show("Plugin installed: %s", plugin_name);
|
||||
} else {
|
||||
@ -6257,75 +6294,145 @@ cmd_plugins(ProfWin *window, const char *const command, gchar **args)
|
||||
}
|
||||
g_free(plugin_name);
|
||||
|
||||
free(filename);
|
||||
return TRUE;
|
||||
} else if (g_strcmp0(args[0], "load") == 0) {
|
||||
if (args[1] == NULL) {
|
||||
cons_bad_cmd_usage(command);
|
||||
return TRUE;
|
||||
}
|
||||
gboolean res = plugins_load(args[1]);
|
||||
if (res) {
|
||||
cons_show("Loaded plugin: %s", args[1]);
|
||||
} else {
|
||||
cons_show("Failed to load plugin: %s", args[1]);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
} else if (g_strcmp0(args[0], "unload") == 0) {
|
||||
if (args[1] == NULL) {
|
||||
cons_bad_cmd_usage(command);
|
||||
return TRUE;
|
||||
}
|
||||
gboolean res = plugins_unload(args[1]);
|
||||
if (res) {
|
||||
cons_show("Unloaded plugin: %s", args[1]);
|
||||
} else {
|
||||
cons_show("Failed to unload plugin: %s", args[1]);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
} else if (g_strcmp0(args[0], "reload") == 0) {
|
||||
if (args[1] == NULL) {
|
||||
plugins_reload_all();
|
||||
cons_show("Reloaded all plugins");
|
||||
} else {
|
||||
gboolean res = plugins_reload(args[1]);
|
||||
if (res) {
|
||||
cons_show("Reloaded plugin: %s", args[1]);
|
||||
} else {
|
||||
cons_show("Failed to reload plugin: %s", args[1]);
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
} else if (g_strcmp0(args[0], "python_version") == 0) {
|
||||
#ifdef HAVE_PYTHON
|
||||
const char *version = python_get_version();
|
||||
cons_show("Python version:");
|
||||
cons_show("%s", version);
|
||||
#else
|
||||
cons_show("This build does not support pytyon plugins.");
|
||||
#endif
|
||||
return TRUE;
|
||||
|
||||
} else {
|
||||
GList *plugins = plugins_loaded_list();
|
||||
if (plugins == NULL) {
|
||||
cons_show("No plugins installed.");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
GList *curr = plugins;
|
||||
cons_show("Installed plugins:");
|
||||
while (curr) {
|
||||
cons_show(" %s", curr->data);
|
||||
curr = g_list_next(curr);
|
||||
}
|
||||
g_list_free(plugins);
|
||||
|
||||
free(path);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (is_dir(path)) {
|
||||
PluginsInstallResult* result = plugins_install_all(path);
|
||||
if (result->installed || result->failed) {
|
||||
if (result->installed) {
|
||||
cons_show("");
|
||||
cons_show("Installed plugins:");
|
||||
GSList *curr = result->installed;
|
||||
while (curr) {
|
||||
cons_show(" %s", curr->data);
|
||||
curr = g_slist_next(curr);
|
||||
}
|
||||
}
|
||||
if (result->failed) {
|
||||
cons_show("");
|
||||
cons_show("Failed installs:");
|
||||
GSList *curr = result->failed;
|
||||
while (curr) {
|
||||
cons_show(" %s", curr->data);
|
||||
curr = g_slist_next(curr);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
cons_show("No plugins found in: %s", path);
|
||||
}
|
||||
free(path);
|
||||
plugins_free_install_result(result);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
cons_show("Argument must be a file or directory.");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_plugins_load(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
if (args[1] == NULL) {
|
||||
GSList *loaded = plugins_load_all();
|
||||
if (loaded) {
|
||||
cons_show("Loaded plugins:");
|
||||
GSList *curr = loaded;
|
||||
while (curr) {
|
||||
cons_show(" %s", curr->data);
|
||||
curr = g_slist_next(curr);
|
||||
}
|
||||
g_slist_free_full(loaded, g_free);
|
||||
} else {
|
||||
cons_show("No plugins loaded.");
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean res = plugins_load(args[1]);
|
||||
if (res) {
|
||||
cons_show("Loaded plugin: %s", args[1]);
|
||||
} else {
|
||||
cons_show("Failed to load plugin: %s", args[1]);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_plugins_unload(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
if (args[1] == NULL) {
|
||||
gboolean res = plugins_unload_all();
|
||||
if (res) {
|
||||
cons_show("Unloaded all plugins.");
|
||||
} else {
|
||||
cons_show("No plugins unloaded.");
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean res = plugins_unload(args[1]);
|
||||
if (res) {
|
||||
cons_show("Unloaded plugin: %s", args[1]);
|
||||
} else {
|
||||
cons_show("Failed to unload plugin: %s", args[1]);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_plugins_reload(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
if (args[1] == NULL) {
|
||||
plugins_reload_all();
|
||||
cons_show("Reloaded all plugins");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean res = plugins_reload(args[1]);
|
||||
if (res) {
|
||||
cons_show("Reloaded plugin: %s", args[1]);
|
||||
} else {
|
||||
cons_show("Failed to reload plugin: %s", args[1]);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_plugins_python_version(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
#ifdef HAVE_PYTHON
|
||||
const char *version = python_get_version();
|
||||
cons_show("Python version:");
|
||||
cons_show("%s", version);
|
||||
#else
|
||||
cons_show("This build does not support pytyon plugins.");
|
||||
#endif
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_plugins(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
GList *plugins = plugins_loaded_list();
|
||||
if (plugins == NULL) {
|
||||
cons_show("No plugins installed.");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
GList *curr = plugins;
|
||||
cons_show("Installed plugins:");
|
||||
while (curr) {
|
||||
cons_show(" %s", curr->data);
|
||||
curr = g_list_next(curr);
|
||||
}
|
||||
g_list_free(plugins);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* cmd_funcs.h
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
@ -158,7 +158,15 @@ gboolean cmd_script(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_export(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_charset(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_console(ProfWin *window, const char *const command, gchar **args);
|
||||
|
||||
gboolean cmd_plugins(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_plugins_sourcepath(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_plugins_install(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_plugins_load(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_plugins_unload(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_plugins_reload(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_plugins_python_version(ProfWin *window, const char *const command, gchar **args);
|
||||
|
||||
gboolean cmd_blocked(ProfWin *window, const char *const command, gchar **args);
|
||||
|
||||
gboolean cmd_account(ProfWin *window, const char *const command, gchar **args);
|
||||
|
114
src/common.c
114
src/common.c
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* common.c
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
@ -67,54 +67,6 @@ static unsigned long unique_id = 0;
|
||||
|
||||
static size_t _data_callback(void *ptr, size_t size, size_t nmemb, void *data);
|
||||
|
||||
// taken from glib 2.30.3
|
||||
gchar*
|
||||
p_utf8_substring(const gchar *str, glong start_pos, glong end_pos)
|
||||
{
|
||||
gchar *start, *end, *out;
|
||||
|
||||
start = g_utf8_offset_to_pointer (str, start_pos);
|
||||
end = g_utf8_offset_to_pointer (start, end_pos - start_pos);
|
||||
|
||||
out = g_malloc (end - start + 1);
|
||||
memcpy (out, start, end - start);
|
||||
out[end - start] = 0;
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
void
|
||||
p_slist_free_full(GSList *items, GDestroyNotify free_func)
|
||||
{
|
||||
g_slist_foreach (items, (GFunc) free_func, NULL);
|
||||
g_slist_free (items);
|
||||
}
|
||||
|
||||
void
|
||||
p_list_free_full(GList *items, GDestroyNotify free_func)
|
||||
{
|
||||
g_list_foreach (items, (GFunc) free_func, NULL);
|
||||
g_list_free (items);
|
||||
}
|
||||
|
||||
gboolean
|
||||
p_hash_table_add(GHashTable *hash_table, gpointer key)
|
||||
{
|
||||
// doesn't handle when key exists, but value == NULL
|
||||
gpointer found = g_hash_table_lookup(hash_table, key);
|
||||
g_hash_table_replace(hash_table, key, key);
|
||||
|
||||
return (found == NULL);
|
||||
}
|
||||
|
||||
gboolean
|
||||
p_hash_table_contains(GHashTable *hash_table, gconstpointer key)
|
||||
{
|
||||
// doesn't handle when key exists, but value == NULL
|
||||
gpointer found = g_hash_table_lookup(hash_table, key);
|
||||
return (found != NULL);
|
||||
}
|
||||
|
||||
gboolean
|
||||
create_dir(char *name)
|
||||
{
|
||||
@ -509,13 +461,18 @@ prof_occurrences(const char *const needle, const char *const haystack, int offse
|
||||
return *result;
|
||||
}
|
||||
|
||||
if (g_str_has_prefix(&haystack[offset], needle)) {
|
||||
gchar *haystack_curr = g_utf8_offset_to_pointer(haystack, offset);
|
||||
if (g_str_has_prefix(haystack_curr, needle)) {
|
||||
if (whole_word) {
|
||||
char *prev = g_utf8_prev_char(&haystack[offset]);
|
||||
char *next = g_utf8_next_char(&haystack[offset] + strlen(needle) - 1);
|
||||
gunichar prevu = g_utf8_get_char(prev);
|
||||
gunichar nextu = g_utf8_get_char(next);
|
||||
if (!g_unichar_isalnum(prevu) && !g_unichar_isalnum(nextu)) {
|
||||
gchar *needle_last_ch = g_utf8_offset_to_pointer(needle, g_utf8_strlen(needle, -1)- 1);
|
||||
int needle_last_ch_len = mblen(needle_last_ch, MB_CUR_MAX);
|
||||
|
||||
gchar *haystack_before_ch = g_utf8_prev_char(haystack_curr);
|
||||
gchar *haystack_after_ch = g_utf8_next_char(haystack_curr + strlen(needle) - needle_last_ch_len);
|
||||
|
||||
gunichar before = g_utf8_get_char(haystack_before_ch);
|
||||
gunichar after = g_utf8_get_char(haystack_after_ch);
|
||||
if (!g_unichar_isalnum(before) && !g_unichar_isalnum(after)) {
|
||||
*result = g_slist_append(*result, GINT_TO_POINTER(offset));
|
||||
}
|
||||
} else {
|
||||
@ -523,10 +480,53 @@ prof_occurrences(const char *const needle, const char *const haystack, int offse
|
||||
}
|
||||
}
|
||||
|
||||
if (haystack[offset+1] != '\0') {
|
||||
*result = prof_occurrences(needle, haystack, offset+1, whole_word, result);
|
||||
offset++;
|
||||
if (g_strcmp0(g_utf8_offset_to_pointer(haystack, offset), "\0") != 0) {
|
||||
*result = prof_occurrences(needle, haystack, offset, whole_word, result);
|
||||
}
|
||||
|
||||
return *result;
|
||||
}
|
||||
|
||||
int
|
||||
is_regular_file(const char *path)
|
||||
{
|
||||
struct stat st;
|
||||
stat(path, &st);
|
||||
return S_ISREG(st.st_mode);
|
||||
}
|
||||
|
||||
int
|
||||
is_dir(const char *path)
|
||||
{
|
||||
struct stat st;
|
||||
stat(path, &st);
|
||||
return S_ISDIR(st.st_mode);
|
||||
}
|
||||
|
||||
void
|
||||
get_file_paths_recursive(const char *path, GSList **contents)
|
||||
{
|
||||
if (!is_dir(path)) {
|
||||
return;
|
||||
}
|
||||
|
||||
GDir* directory = g_dir_open(path, 0, NULL);
|
||||
const gchar *entry = g_dir_read_name(directory);
|
||||
while (entry) {
|
||||
GString *full = g_string_new(path);
|
||||
if (!g_str_has_suffix(full->str, "/")) {
|
||||
g_string_append(full, "/");
|
||||
}
|
||||
g_string_append(full, entry);
|
||||
|
||||
if (is_dir(full->str)) {
|
||||
get_file_paths_recursive(full->str, contents);
|
||||
} else if (is_regular_file(full->str)) {
|
||||
*contents = g_slist_append(*contents, full->str);
|
||||
}
|
||||
|
||||
g_string_free(full, FALSE);
|
||||
entry = g_dir_read_name(directory);
|
||||
}
|
||||
}
|
||||
|
26
src/common.h
26
src/common.h
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* common.h
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
@ -40,20 +40,6 @@
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
#if !GLIB_CHECK_VERSION(2,28,0)
|
||||
#define g_slist_free_full(items, free_func) p_slist_free_full(items, free_func)
|
||||
#define g_list_free_full(items, free_func) p_list_free_full(items, free_func)
|
||||
#endif
|
||||
|
||||
#if !GLIB_CHECK_VERSION(2,30,0)
|
||||
#define g_utf8_substring(str, start_pos, end_pos) p_utf8_substring(str, start_pos, end_pos)
|
||||
#endif
|
||||
|
||||
#if !GLIB_CHECK_VERSION(2,32,0)
|
||||
#define g_hash_table_add(hash_table, key) p_hash_table_add(hash_table, key)
|
||||
#define g_hash_table_contains(hash_table, key) p_hash_table_contains(hash_table, key)
|
||||
#endif
|
||||
|
||||
#ifndef NOTIFY_CHECK_VERSION
|
||||
#define notify_notification_new(summary, body, icon) notify_notification_new(summary, body, icon, NULL)
|
||||
#endif
|
||||
@ -94,12 +80,6 @@ typedef enum {
|
||||
RESOURCE_XA
|
||||
} resource_presence_t;
|
||||
|
||||
gchar* p_utf8_substring(const gchar *str, glong start_pos, glong end_pos);
|
||||
void p_slist_free_full(GSList *items, GDestroyNotify free_func);
|
||||
void p_list_free_full(GList *items, GDestroyNotify free_func);
|
||||
gboolean p_hash_table_add(GHashTable *hash_table, gpointer key);
|
||||
gboolean p_hash_table_contains(GHashTable *hash_table, gconstpointer key);
|
||||
|
||||
gboolean create_dir(char *name);
|
||||
gboolean mkdir_recursive(const char *dir);
|
||||
gboolean copy_file(const char *const src, const char *const target);
|
||||
@ -123,4 +103,8 @@ gboolean is_notify_enabled(void);
|
||||
GSList* prof_occurrences(const char *const needle, const char *const haystack, int offset, gboolean whole_word,
|
||||
GSList **result);
|
||||
|
||||
int is_regular_file(const char *path);
|
||||
int is_dir(const char *path);
|
||||
void get_file_paths_recursive(const char *directory, GSList **contents);
|
||||
|
||||
#endif
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* account.c
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* account.h
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* accounts.c
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* accounts.h
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* conflists.c
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* conflists.h
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* files.c
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* files.h
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* preferences.c
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
@ -59,6 +59,7 @@
|
||||
#define PREF_GROUP_OTR "otr"
|
||||
#define PREF_GROUP_PGP "pgp"
|
||||
#define PREF_GROUP_MUC "muc"
|
||||
#define PREF_GROUP_PLUGINS "plugins"
|
||||
|
||||
#define INPBLOCK_DEFAULT 1000
|
||||
|
||||
@ -665,27 +666,27 @@ prefs_get_tray_timer(void)
|
||||
gchar**
|
||||
prefs_get_plugins(void)
|
||||
{
|
||||
if (!g_key_file_has_group(prefs, "plugins")) {
|
||||
if (!g_key_file_has_group(prefs, PREF_GROUP_PLUGINS)) {
|
||||
return NULL;
|
||||
}
|
||||
if (!g_key_file_has_key(prefs, "plugins", "load", NULL)) {
|
||||
if (!g_key_file_has_key(prefs, PREF_GROUP_PLUGINS, "load", NULL)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return g_key_file_get_string_list(prefs, "plugins", "load", NULL, NULL);
|
||||
return g_key_file_get_string_list(prefs, PREF_GROUP_PLUGINS, "load", NULL, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
prefs_add_plugin(const char *const name)
|
||||
{
|
||||
conf_string_list_add(prefs, "plugins", "load", name);
|
||||
conf_string_list_add(prefs, PREF_GROUP_PLUGINS, "load", name);
|
||||
_save_prefs();
|
||||
}
|
||||
|
||||
void
|
||||
prefs_remove_plugin(const char *const name)
|
||||
{
|
||||
conf_string_list_remove(prefs, "plugins", "load", name);
|
||||
conf_string_list_remove(prefs, PREF_GROUP_PLUGINS, "load", name);
|
||||
_save_prefs();
|
||||
}
|
||||
|
||||
@ -1614,6 +1615,8 @@ _get_group(preference_t pref)
|
||||
return PREF_GROUP_PGP;
|
||||
case PREF_BOOKMARK_INVITE:
|
||||
return PREF_GROUP_MUC;
|
||||
case PREF_PLUGINS_SOURCEPATH:
|
||||
return PREF_GROUP_PLUGINS;
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
@ -1814,6 +1817,8 @@ _get_key(preference_t pref)
|
||||
return "console.chat";
|
||||
case PREF_BOOKMARK_INVITE:
|
||||
return "bookmark.invite";
|
||||
case PREF_PLUGINS_SOURCEPATH:
|
||||
return "sourcepath";
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* preferences.h
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
@ -141,6 +141,7 @@ typedef enum {
|
||||
PREF_CONSOLE_PRIVATE,
|
||||
PREF_CONSOLE_CHAT,
|
||||
PREF_BOOKMARK_INVITE,
|
||||
PREF_PLUGINS_SOURCEPATH,
|
||||
} preference_t;
|
||||
|
||||
typedef struct prof_alias_t {
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* scripts.c
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* scripts.h
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* theme.c
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
@ -104,6 +104,7 @@ theme_init(const char *const theme_name)
|
||||
g_hash_table_insert(defaults, strdup("statusbar.brackets"), strdup("cyan"));
|
||||
g_hash_table_insert(defaults, strdup("statusbar.active"), strdup("cyan"));
|
||||
g_hash_table_insert(defaults, strdup("statusbar.new"), strdup("white"));
|
||||
g_hash_table_insert(defaults, strdup("statusbar.time"), strdup("white"));
|
||||
g_hash_table_insert(defaults, strdup("me"), strdup("yellow"));
|
||||
g_hash_table_insert(defaults, strdup("them"), strdup("green"));
|
||||
g_hash_table_insert(defaults, strdup("receipt.sent"), strdup("red"));
|
||||
@ -755,6 +756,7 @@ theme_attrs(theme_item_t attrs)
|
||||
case THEME_STATUS_BRACKET: _theme_prep_fgnd("statusbar.brackets", lookup_str, &bold); break;
|
||||
case THEME_STATUS_ACTIVE: _theme_prep_fgnd("statusbar.active", lookup_str, &bold); break;
|
||||
case THEME_STATUS_NEW: _theme_prep_fgnd("statusbar.new", lookup_str, &bold); break;
|
||||
case THEME_STATUS_TIME: _theme_prep_fgnd("statusbar.time", lookup_str, &bold); break;
|
||||
case THEME_ME: _theme_prep_fgnd("me", lookup_str, &bold); break;
|
||||
case THEME_THEM: _theme_prep_fgnd("them", lookup_str, &bold); break;
|
||||
case THEME_RECEIPT_SENT: _theme_prep_fgnd("receipt.sent", lookup_str, &bold); break;
|
||||
@ -843,6 +845,7 @@ theme_attrs(theme_item_t attrs)
|
||||
case THEME_STATUS_BRACKET:
|
||||
case THEME_STATUS_ACTIVE:
|
||||
case THEME_STATUS_NEW:
|
||||
case THEME_STATUS_TIME:
|
||||
_theme_prep_bgnd("statusbar", "blue", lookup_str);
|
||||
break;
|
||||
default:
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* theme.h
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
@ -69,6 +69,7 @@ typedef enum {
|
||||
THEME_STATUS_BRACKET,
|
||||
THEME_STATUS_ACTIVE,
|
||||
THEME_STATUS_NEW,
|
||||
THEME_STATUS_TIME,
|
||||
THEME_ME,
|
||||
THEME_THEM,
|
||||
THEME_ROOMINFO,
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* tlscerts.c
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* tlscerts.h
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* client_events.c
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* client_events.h
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* server_events.c
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* server_events.h
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* log.c
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* log.h
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* main.c
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
@ -90,7 +90,7 @@ main(int argc, char **argv)
|
||||
g_print("Profanity, version %s\n", PACKAGE_VERSION);
|
||||
}
|
||||
|
||||
g_print("Copyright (C) 2012 - 2016 James Booth <%s>.\n", PACKAGE_BUGREPORT);
|
||||
g_print("Copyright (C) 2012 - 2017 James Booth <%s>.\n", PACKAGE_BUGREPORT);
|
||||
g_print("License GPLv3+: GNU GPL version 3 or later <https://www.gnu.org/licenses/gpl.html>\n");
|
||||
g_print("\n");
|
||||
g_print("This is free software; you are free to change and redistribute it.\n");
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* otr.c
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* otr.h
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* otrlib.h
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* otrlibv3.c
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* otrlibv4.c
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* gpg.c
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* gpg.h
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* api.c
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* api.h
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* autocompleters.c
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* autocompleters.h
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* c_api.c
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* c_api.h
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* c_plugins.c
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* c_plugins.h
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* callbacks.c
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* callbacks.h
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* disco.c
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* disco.h
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* plugins.c
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
@ -129,6 +129,43 @@ plugins_init(void)
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
plugins_free_install_result(PluginsInstallResult *result)
|
||||
{
|
||||
if (!result) {
|
||||
return;
|
||||
}
|
||||
g_slist_free_full(result->installed, free);
|
||||
g_slist_free_full(result->failed, free);
|
||||
}
|
||||
|
||||
PluginsInstallResult*
|
||||
plugins_install_all(const char *const path)
|
||||
{
|
||||
PluginsInstallResult *result = malloc(sizeof(PluginsInstallResult));
|
||||
result->installed = NULL;
|
||||
result->failed = NULL;
|
||||
GSList *contents = NULL;
|
||||
get_file_paths_recursive(path, &contents);
|
||||
|
||||
GSList *curr = contents;
|
||||
while (curr) {
|
||||
if (g_str_has_suffix(curr->data, ".py") || g_str_has_suffix(curr->data, ".so")) {
|
||||
gchar *plugin_name = g_path_get_basename(curr->data);
|
||||
if (plugins_install(plugin_name, curr->data)) {
|
||||
result->installed = g_slist_append(result->installed, strdup(curr->data));
|
||||
} else {
|
||||
result->failed = g_slist_append(result->failed, strdup(curr->data));
|
||||
}
|
||||
}
|
||||
curr = g_slist_next(curr);
|
||||
}
|
||||
|
||||
g_slist_free_full(contents, g_free);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
gboolean
|
||||
plugins_install(const char *const plugin_name, const char *const filename)
|
||||
{
|
||||
@ -153,6 +190,23 @@ plugins_install(const char *const plugin_name, const char *const filename)
|
||||
return result;
|
||||
}
|
||||
|
||||
GSList*
|
||||
plugins_load_all(void)
|
||||
{
|
||||
GSList *plugins = plugins_unloaded_list();
|
||||
GSList *loaded = NULL;
|
||||
GSList *curr = plugins;
|
||||
while (curr) {
|
||||
if (plugins_load(curr->data)) {
|
||||
loaded = g_slist_append(loaded, strdup(curr->data));
|
||||
}
|
||||
curr = g_slist_next(curr);
|
||||
}
|
||||
g_slist_free_full(plugins, g_free);
|
||||
|
||||
return loaded;
|
||||
}
|
||||
|
||||
gboolean
|
||||
plugins_load(const char *const name)
|
||||
{
|
||||
@ -190,6 +244,32 @@ plugins_load(const char *const name)
|
||||
}
|
||||
}
|
||||
|
||||
gboolean
|
||||
plugins_unload_all(void)
|
||||
{
|
||||
gboolean result = FALSE;
|
||||
GList *plugin_names = g_hash_table_get_keys(plugins);
|
||||
GList *plugin_names_dup = NULL;
|
||||
GList *curr = plugin_names;
|
||||
while (curr) {
|
||||
plugin_names_dup = g_list_append(plugin_names_dup, strdup(curr->data));
|
||||
curr = g_list_next(curr);
|
||||
}
|
||||
g_list_free(plugin_names);
|
||||
|
||||
curr = plugin_names_dup;
|
||||
while (curr) {
|
||||
if (plugins_unload(curr->data)) {
|
||||
result = TRUE;
|
||||
}
|
||||
curr = g_list_next(curr);
|
||||
}
|
||||
|
||||
g_list_free_full(plugin_names_dup, free);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
gboolean
|
||||
plugins_unload(const char *const name)
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* plugins.h
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
@ -42,6 +42,11 @@ typedef enum {
|
||||
LANG_C
|
||||
} lang_t;
|
||||
|
||||
typedef struct prof_plugins_install_t {
|
||||
GSList *installed;
|
||||
GSList *failed;
|
||||
} PluginsInstallResult;
|
||||
|
||||
typedef struct prof_plugin_t {
|
||||
char *name;
|
||||
lang_t lang;
|
||||
@ -107,9 +112,14 @@ char* plugins_autocomplete(const char *const input);
|
||||
void plugins_reset_autocomplete(void);
|
||||
void plugins_shutdown(void);
|
||||
|
||||
void plugins_free_install_result(PluginsInstallResult *result);
|
||||
|
||||
gboolean plugins_install(const char *const plugin_name, const char *const filename);
|
||||
PluginsInstallResult* plugins_install_all(const char *const path);
|
||||
gboolean plugins_load(const char *const name);
|
||||
GSList* plugins_load_all(void);
|
||||
gboolean plugins_unload(const char *const name);
|
||||
gboolean plugins_unload_all(void);
|
||||
gboolean plugins_reload(const char *const name);
|
||||
void plugins_reload_all(void);
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* prof_api.c
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* prof_api.h
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* python_api.c
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* python_api.h
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* python_plugins.c
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* python_plugins.h
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* settings.c
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* settings.h
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* themes.c
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* themes.h
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* profanity.c
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* profanity.h
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* autocomplete.c
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
@ -35,6 +35,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <glib.h>
|
||||
|
||||
#include "common.h"
|
||||
#include "tools/autocomplete.h"
|
||||
@ -330,10 +331,17 @@ autocomplete_param_no_with_func(const char *const input, char *command, int arg_
|
||||
static gchar*
|
||||
_search_from(Autocomplete ac, GSList *curr, gboolean quote)
|
||||
{
|
||||
gchar *search_str_ascii = g_str_to_ascii(ac->search_str, NULL);
|
||||
gchar *search_str_lower = g_ascii_strdown(search_str_ascii, -1);
|
||||
g_free(search_str_ascii);
|
||||
|
||||
while(curr) {
|
||||
gchar *curr_ascii = g_str_to_ascii(curr->data, NULL);
|
||||
gchar *curr_lower = g_ascii_strdown(curr_ascii, -1);
|
||||
g_free(curr_ascii);
|
||||
|
||||
// match found
|
||||
if (strncmp(curr->data, ac->search_str, strlen(ac->search_str)) == 0) {
|
||||
if (strncmp(curr_lower, search_str_lower, strlen(search_str_lower)) == 0) {
|
||||
|
||||
// set pointer to last found
|
||||
ac->last_found = curr;
|
||||
@ -347,16 +355,22 @@ _search_from(Autocomplete ac, GSList *curr, gboolean quote)
|
||||
gchar *result = quoted->str;
|
||||
g_string_free(quoted, FALSE);
|
||||
|
||||
g_free(search_str_lower);
|
||||
g_free(curr_lower);
|
||||
return result;
|
||||
|
||||
// otherwise just return the string
|
||||
} else {
|
||||
g_free(search_str_lower);
|
||||
g_free(curr_lower);
|
||||
return strdup(curr->data);
|
||||
}
|
||||
}
|
||||
|
||||
g_free(curr_lower);
|
||||
curr = g_slist_next(curr);
|
||||
}
|
||||
|
||||
g_free(search_str_lower);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* autocomplete.h
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* http_upload.c
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
@ -52,6 +52,7 @@
|
||||
#include "config/preferences.h"
|
||||
#include "ui/ui.h"
|
||||
#include "ui/window.h"
|
||||
#include "common.h"
|
||||
|
||||
#define FALLBACK_MIMETYPE "application/octet-stream"
|
||||
#define FALLBACK_CONTENTTYPE_HEADER "Content-Type: application/octet-stream"
|
||||
@ -330,10 +331,3 @@ off_t file_size(const char* const filename)
|
||||
stat(filename, &st);
|
||||
return st.st_size;
|
||||
}
|
||||
|
||||
int is_regular_file(const char *filename)
|
||||
{
|
||||
struct stat st;
|
||||
stat(filename, &st);
|
||||
return S_ISREG(st.st_mode);
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* http_upload.h
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
@ -62,6 +62,5 @@ void* http_file_put(void *userdata);
|
||||
|
||||
char* file_mime_type(const char* const file_name);
|
||||
off_t file_size(const char* const file_name);
|
||||
int is_regular_file(const char *filename);
|
||||
|
||||
#endif
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* parser.c
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* parser.h
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* tinyurl.c
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* tinyurl.h
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* buffer.c
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* buffer.h
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* chatwin.c
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* console.c
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
@ -412,7 +412,7 @@ cons_about(void)
|
||||
}
|
||||
}
|
||||
|
||||
win_println(console, THEME_DEFAULT, '-', "Copyright (C) 2012 - 2016 James Booth <%s>.", PACKAGE_BUGREPORT);
|
||||
win_println(console, THEME_DEFAULT, '-', "Copyright (C) 2012 - 2017 James Booth <%s>.", PACKAGE_BUGREPORT);
|
||||
win_println(console, THEME_DEFAULT, '-', "License GPLv3+: GNU GPL version 3 or later <https://www.gnu.org/licenses/gpl.html>");
|
||||
win_println(console, THEME_DEFAULT, '-', "");
|
||||
win_println(console, THEME_DEFAULT, '-', "This is free software; you are free to change and redistribute it.");
|
||||
@ -2224,6 +2224,7 @@ cons_theme_properties(void)
|
||||
_cons_theme_bar_prop(THEME_STATUS_BRACKET, "statusbar.brackets");
|
||||
_cons_theme_bar_prop(THEME_STATUS_ACTIVE, "statusbar.active");
|
||||
_cons_theme_bar_prop(THEME_STATUS_NEW, "statusbar.new");
|
||||
_cons_theme_bar_prop(THEME_STATUS_TIME, "statusbar.time");
|
||||
|
||||
_cons_theme_prop(THEME_TIME, "main.time");
|
||||
_cons_theme_prop(THEME_TEXT, "main.text");
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* core.c
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* inputwin.c
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* inputwin.c
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* mucconfwin.c
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* mucwin.c
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* notifier.c
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* occupantswin.c
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* privwin.c
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* rosterwin.c
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* screen.c
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* screen.h
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* statusbar.c
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
@ -459,6 +459,7 @@ _status_bar_draw(void)
|
||||
last_time = g_date_time_new_now(tz);
|
||||
|
||||
int bracket_attrs = theme_attrs(THEME_STATUS_BRACKET);
|
||||
int time_attrs = theme_attrs(THEME_STATUS_TIME);
|
||||
|
||||
char *time_pref = prefs_get_string(PREF_TIME_STATUSBAR);
|
||||
if (g_strcmp0(time_pref, "off") != 0) {
|
||||
@ -468,7 +469,9 @@ _status_bar_draw(void)
|
||||
wattron(status_bar, bracket_attrs);
|
||||
mvwaddch(status_bar, 0, 1, '[');
|
||||
wattroff(status_bar, bracket_attrs);
|
||||
wattron(status_bar, time_attrs);
|
||||
mvwprintw(status_bar, 0, 2, date_fmt);
|
||||
wattroff(status_bar, time_attrs);
|
||||
wattron(status_bar, bracket_attrs);
|
||||
mvwaddch(status_bar, 0, 2 + len, ']');
|
||||
wattroff(status_bar, bracket_attrs);
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* statusbar.h
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* titlebar.c
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* titlebar.h
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* tray.c
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* tray.h
|
||||
*
|
||||
* Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
|
||||
* Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com>
|
||||
*
|
||||
* This file is part of Profanity.
|
||||
*
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user