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 2016-01-23 23:04:41 +00:00
commit aa111bc07b
23 changed files with 664 additions and 29 deletions

View File

@ -1644,6 +1644,7 @@ static struct cmd_t command_defs[] =
"/account set <account> pgpkeyid <pgpkeyid>", "/account set <account> pgpkeyid <pgpkeyid>",
"/account set <account> startscript <script>", "/account set <account> startscript <script>",
"/account set <account> tls force|allow|disable", "/account set <account> tls force|allow|disable",
"/account set <account> theme <theme>",
"/account clear <account> password", "/account clear <account> password",
"/account clear <account> eval_password", "/account clear <account> eval_password",
"/account clear <account> server", "/account clear <account> server",
@ -1681,13 +1682,15 @@ static struct cmd_t command_defs[] =
{ "set <account> tls force", "Force TLS connection, and fail if one cannot be established, this is default behaviour." }, { "set <account> tls force", "Force TLS connection, and fail if one cannot be established, this is default behaviour." },
{ "set <account> tls allow", "Use TLS for the connection if it is available." }, { "set <account> tls allow", "Use TLS for the connection if it is available." },
{ "set <account> tls disable", "Disable TLS for the connection." }, { "set <account> tls disable", "Disable TLS for the connection." },
{ "set <account> <theme>", "Set the UI theme for the account." },
{ "clear <account> server", "Remove the server setting for this account." }, { "clear <account> server", "Remove the server setting for this account." },
{ "clear <account> port", "Remove the port setting for this account." }, { "clear <account> port", "Remove the port setting for this account." },
{ "clear <account> password", "Remove the password setting for this account." }, { "clear <account> password", "Remove the password setting for this account." },
{ "clear <account> eval_password", "Remove the eval_password setting for this account." }, { "clear <account> eval_password", "Remove the eval_password setting for this account." },
{ "clear <account> otr", "Remove the OTR policy setting for this account." }, { "clear <account> otr", "Remove the OTR policy setting for this account." },
{ "clear <account> pgpkeyid", "Remove pgpkeyid associated with this account." }, { "clear <account> pgpkeyid", "Remove pgpkeyid associated with this account." },
{ "clear <account> startscript", "Remove startscript associated with this account." }) { "clear <account> startscript", "Remove startscript associated with this account." },
{ "clear <account> theme", "Clear the theme setting for the account, the global theme will be used." })
CMD_EXAMPLES( CMD_EXAMPLES(
"/account add me", "/account add me",
"/account set me jid me@chatty", "/account set me jid me@chatty",
@ -1727,13 +1730,15 @@ static struct cmd_t command_defs[] =
CMD_SYN( CMD_SYN(
"/theme list", "/theme list",
"/theme load <theme>", "/theme load <theme>",
"/theme colours") "/theme colours",
"/theme properties")
CMD_DESC( CMD_DESC(
"Load a theme, includes colours and UI options.") "Load a theme, includes colours and UI options.")
CMD_ARGS( CMD_ARGS(
{ "list", "List all available themes." }, { "list", "List all available themes." },
{ "load <theme>", "Load the specified theme. 'default' will reset to the default theme." }, { "load <theme>", "Load the specified theme. 'default' will reset to the default theme." },
{ "colours", "Show the colour values as rendered by the terminal." }) { "colours", "Show colour values as rendered by the terminal." },
{ "properties", "Show colour settings for current theme." })
CMD_EXAMPLES( CMD_EXAMPLES(
"/theme list", "/theme list",
"/theme load forest") "/theme load forest")
@ -2106,6 +2111,7 @@ cmd_init(void)
autocomplete_add(theme_ac, "load"); autocomplete_add(theme_ac, "load");
autocomplete_add(theme_ac, "list"); autocomplete_add(theme_ac, "list");
autocomplete_add(theme_ac, "colours"); autocomplete_add(theme_ac, "colours");
autocomplete_add(theme_ac, "properties");
disco_ac = autocomplete_new(); disco_ac = autocomplete_new();
autocomplete_add(disco_ac, "info"); autocomplete_add(disco_ac, "info");
@ -2142,6 +2148,7 @@ cmd_init(void)
autocomplete_add(account_set_ac, "pgpkeyid"); autocomplete_add(account_set_ac, "pgpkeyid");
autocomplete_add(account_set_ac, "startscript"); autocomplete_add(account_set_ac, "startscript");
autocomplete_add(account_set_ac, "tls"); autocomplete_add(account_set_ac, "tls");
autocomplete_add(account_set_ac, "theme");
account_clear_ac = autocomplete_new(); account_clear_ac = autocomplete_new();
autocomplete_add(account_clear_ac, "password"); autocomplete_add(account_clear_ac, "password");
@ -2151,6 +2158,7 @@ cmd_init(void)
autocomplete_add(account_clear_ac, "otr"); autocomplete_add(account_clear_ac, "otr");
autocomplete_add(account_clear_ac, "pgpkeyid"); autocomplete_add(account_clear_ac, "pgpkeyid");
autocomplete_add(account_clear_ac, "startscript"); autocomplete_add(account_clear_ac, "startscript");
autocomplete_add(account_clear_ac, "theme");
account_default_ac = autocomplete_new(); account_default_ac = autocomplete_new();
autocomplete_add(account_default_ac, "set"); autocomplete_add(account_default_ac, "set");
@ -4439,6 +4447,25 @@ _account_autocomplete(ProfWin *window, const char *const input)
g_strfreev(args); g_strfreev(args);
return found; return found;
} }
} else if ((g_strv_length(args) > 3) && (g_strcmp0(args[2], "theme")) == 0) {
g_string_append(beginning, " ");
g_string_append(beginning, args[2]);
if (theme_load_ac == NULL) {
theme_load_ac = autocomplete_new();
GSList *themes = theme_list();
GSList *curr = themes;
while (curr) {
autocomplete_add(theme_load_ac, curr->data);
curr = g_slist_next(curr);
}
g_slist_free_full(themes, g_free);
autocomplete_add(theme_load_ac, "default");
}
found = autocomplete_param_with_ac(input, beginning->str, theme_load_ac, TRUE);
g_string_free(beginning, TRUE);
if (found) {
return found;
}
#ifdef HAVE_LIBGPGME #ifdef HAVE_LIBGPGME
} else if ((g_strv_length(args) > 3) && (g_strcmp0(args[2], "pgpkeyid")) == 0) { } else if ((g_strv_length(args) > 3) && (g_strcmp0(args[2], "pgpkeyid")) == 0) {
g_string_append(beginning, " "); g_string_append(beginning, " ");

View File

@ -668,6 +668,34 @@ cmd_account(ProfWin *window, const char *const command, gchar **args)
} else if (strcmp(property, "startscript") == 0) { } else if (strcmp(property, "startscript") == 0) {
accounts_set_script_start(account_name, value); accounts_set_script_start(account_name, value);
cons_show("Updated start script for account %s: %s", account_name, value); cons_show("Updated start script for account %s: %s", account_name, value);
} else if (strcmp(property, "theme") == 0) {
if (theme_exists(value)) {
accounts_set_theme(account_name, value);
if (jabber_get_connection_status() == JABBER_CONNECTED) {
ProfAccount *account = accounts_get_account(jabber_get_account_name());
if (account) {
if (g_strcmp0(account->name, account_name) == 0) {
theme_load(value);
ui_load_colours();
if (prefs_get_boolean(PREF_ROSTER)) {
ui_show_roster();
} else {
ui_hide_roster();
}
if (prefs_get_boolean(PREF_OCCUPANTS)) {
ui_show_all_room_rosters();
} else {
ui_hide_all_room_rosters();
}
ui_redraw();
}
account_free(account);
}
}
cons_show("Updated theme for account %s: %s", account_name, value);
} else {
cons_show("Theme does not exist: %s", value);
}
} else if (strcmp(property, "tls") == 0) { } else if (strcmp(property, "tls") == 0) {
if ((g_strcmp0(value, "force") != 0) if ((g_strcmp0(value, "force") != 0)
&& (g_strcmp0(value, "allow") != 0) && (g_strcmp0(value, "allow") != 0)
@ -764,6 +792,10 @@ cmd_account(ProfWin *window, const char *const command, gchar **args)
accounts_clear_script_start(account_name); accounts_clear_script_start(account_name);
cons_show("Removed start script for account %s", account_name); cons_show("Removed start script for account %s", account_name);
cons_show(""); cons_show("");
} else if (strcmp(property, "theme") == 0) {
accounts_clear_theme(account_name);
cons_show("Removed theme for account %s", account_name);
cons_show("");
} else { } else {
cons_show("Invalid property: %s", property); cons_show("Invalid property: %s", property);
cons_show(""); cons_show("");
@ -992,6 +1024,29 @@ cmd_disconnect(ProfWin *window, const char *const command, gchar **args)
cl_ev_disconnect(); cl_ev_disconnect();
char *theme = prefs_get_string(PREF_THEME);
if (theme) {
gboolean res = theme_load(theme);
prefs_free_string(theme);
if (!res) {
theme_load("default");
}
} else {
theme_load("default");
}
ui_load_colours();
if (prefs_get_boolean(PREF_ROSTER)) {
ui_show_roster();
} else {
ui_hide_roster();
}
if (prefs_get_boolean(PREF_OCCUPANTS)) {
ui_show_all_room_rosters();
} else {
ui_hide_all_room_rosters();
}
ui_redraw();
return TRUE; return TRUE;
} }
@ -1401,6 +1456,8 @@ cmd_theme(ProfWin *window, const char *const command, gchar **args)
// show colours // show colours
} else if (g_strcmp0(args[0], "colours") == 0) { } else if (g_strcmp0(args[0], "colours") == 0) {
cons_theme_colours(); cons_theme_colours();
} else if (g_strcmp0(args[0], "properties") == 0) {
cons_theme_properties();
} else { } else {
cons_bad_cmd_usage(command); cons_bad_cmd_usage(command);
} }

View File

@ -52,7 +52,7 @@ account_new(const gchar *const name, const gchar *const jid,
const gchar *const muc_service, const gchar *const muc_nick, const gchar *const muc_service, const gchar *const muc_nick,
const gchar *const otr_policy, GList *otr_manual, GList *otr_opportunistic, const gchar *const otr_policy, GList *otr_manual, GList *otr_opportunistic,
GList *otr_always, const gchar *const pgp_keyid, const char *const startscript, GList *otr_always, const gchar *const pgp_keyid, const char *const startscript,
gchar *tls_policy) const char *const theme, gchar *tls_policy)
{ {
ProfAccount *new_account = malloc(sizeof(ProfAccount)); ProfAccount *new_account = malloc(sizeof(ProfAccount));
@ -157,6 +157,12 @@ account_new(const gchar *const name, const gchar *const jid,
new_account->startscript = NULL; new_account->startscript = NULL;
} }
if (theme != NULL) {
new_account->theme = strdup(theme);
} else {
new_account->theme = NULL;
}
if (tls_policy != NULL) { if (tls_policy != NULL) {
new_account->tls_policy = strdup(tls_policy); new_account->tls_policy = strdup(tls_policy);
} else { } else {
@ -231,6 +237,7 @@ account_free(ProfAccount *account)
free(account->otr_policy); free(account->otr_policy);
free(account->pgp_keyid); free(account->pgp_keyid);
free(account->startscript); free(account->startscript);
free(account->theme);
free(account->tls_policy); free(account->tls_policy);
g_list_free_full(account->otr_manual, g_free); g_list_free_full(account->otr_manual, g_free);
g_list_free_full(account->otr_opportunistic, g_free); g_list_free_full(account->otr_opportunistic, g_free);

View File

@ -61,6 +61,7 @@ typedef struct prof_account_t {
GList *otr_always; GList *otr_always;
gchar *pgp_keyid; gchar *pgp_keyid;
gchar *startscript; gchar *startscript;
gchar *theme;
gchar *tls_policy; gchar *tls_policy;
} ProfAccount; } ProfAccount;
@ -72,7 +73,7 @@ ProfAccount* account_new(const gchar *const name, const gchar *const jid,
const gchar *const muc_service, const gchar *const muc_nick, const gchar *const muc_service, const gchar *const muc_nick,
const gchar *const otr_policy, GList *otr_manual, GList *otr_opportunistic, const gchar *const otr_policy, GList *otr_manual, GList *otr_opportunistic,
GList *otr_always, const gchar *const pgp_keyid, const char *const startscript, GList *otr_always, const gchar *const pgp_keyid, const char *const startscript,
gchar *tls_policy); const char *const theme, gchar *tls_policy);
char* account_create_full_jid(ProfAccount *account); char* account_create_full_jid(ProfAccount *account);
gboolean account_eval_password(ProfAccount *account); gboolean account_eval_password(ProfAccount *account);
void account_free(ProfAccount *account); void account_free(ProfAccount *account);

View File

@ -272,6 +272,11 @@ accounts_get_account(const char *const name)
startscript = g_key_file_get_string(accounts, name, "script.start", NULL); startscript = g_key_file_get_string(accounts, name, "script.start", NULL);
} }
gchar *theme = NULL;
if (g_key_file_has_key(accounts, name, "theme", NULL)) {
theme = g_key_file_get_string(accounts, name, "theme", NULL);
}
gchar *tls_policy = g_key_file_get_string(accounts, name, "tls.policy", NULL); gchar *tls_policy = g_key_file_get_string(accounts, name, "tls.policy", NULL);
if (tls_policy && ((g_strcmp0(tls_policy, "force") != 0) && if (tls_policy && ((g_strcmp0(tls_policy, "force") != 0) &&
(g_strcmp0(tls_policy, "allow") != 0) && (g_strcmp0(tls_policy, "allow") != 0) &&
@ -284,7 +289,7 @@ accounts_get_account(const char *const name)
server, port, resource, last_presence, login_presence, server, port, resource, last_presence, login_presence,
priority_online, priority_chat, priority_away, priority_xa, priority_online, priority_chat, priority_away, priority_xa,
priority_dnd, muc_service, muc_nick, otr_policy, otr_manual, priority_dnd, muc_service, muc_nick, otr_policy, otr_manual,
otr_opportunistic, otr_always, pgp_keyid, startscript, tls_policy); otr_opportunistic, otr_always, pgp_keyid, startscript, theme, tls_policy);
g_free(jid); g_free(jid);
g_free(password); g_free(password);
@ -298,6 +303,7 @@ accounts_get_account(const char *const name)
g_free(otr_policy); g_free(otr_policy);
g_free(pgp_keyid); g_free(pgp_keyid);
g_free(startscript); g_free(startscript);
g_free(theme);
g_free(tls_policy); g_free(tls_policy);
return new_account; return new_account;
@ -490,6 +496,15 @@ accounts_set_script_start(const char *const account_name, const char *const valu
} }
} }
void
accounts_set_theme(const char *const account_name, const char *const value)
{
if (accounts_account_exists(account_name)) {
g_key_file_set_string(accounts, account_name, "theme", value);
_save_accounts();
}
}
void void
accounts_clear_password(const char *const account_name) accounts_clear_password(const char *const account_name)
{ {
@ -543,6 +558,16 @@ accounts_clear_script_start(const char *const account_name)
_save_accounts(); _save_accounts();
} }
} }
void
accounts_clear_theme(const char *const account_name)
{
if (accounts_account_exists(account_name)) {
g_key_file_remove_key(accounts, account_name, "theme", NULL);
_save_accounts();
}
}
void void
accounts_clear_otr(const char *const account_name) accounts_clear_otr(const char *const account_name)
{ {

View File

@ -84,6 +84,7 @@ gint accounts_get_priority_for_presence_type(const char *const account_name,
resource_presence_t presence_type); resource_presence_t presence_type);
void accounts_set_pgp_keyid(const char *const account_name, const char *const value); void accounts_set_pgp_keyid(const char *const account_name, const char *const value);
void accounts_set_script_start(const char *const account_name, const char *const value); void accounts_set_script_start(const char *const account_name, const char *const value);
void accounts_set_theme(const char *const account_name, const char *const value);
void accounts_clear_password(const char *const account_name); void accounts_clear_password(const char *const account_name);
void accounts_clear_eval_password(const char *const account_name); void accounts_clear_eval_password(const char *const account_name);
void accounts_clear_server(const char *const account_name); void accounts_clear_server(const char *const account_name);
@ -91,6 +92,7 @@ void accounts_clear_port(const char *const account_name);
void accounts_clear_otr(const char *const account_name); void accounts_clear_otr(const char *const account_name);
void accounts_clear_pgp_keyid(const char *const account_name); void accounts_clear_pgp_keyid(const char *const account_name);
void accounts_clear_script_start(const char *const account_name); void accounts_clear_script_start(const char *const account_name);
void accounts_clear_theme(const char *const account_name);
void accounts_add_otr_policy(const char *const account_name, const char *const contact_jid, const char *const policy); void accounts_add_otr_policy(const char *const account_name, const char *const contact_jid, const char *const policy);
#endif #endif

View File

@ -404,7 +404,6 @@ prefs_free_string(char *pref)
} }
} }
void void
prefs_set_string(preference_t pref, char *value) prefs_set_string(preference_t pref, char *value)
{ {

View File

@ -53,6 +53,7 @@ static GString *theme_loc;
static GKeyFile *theme; static GKeyFile *theme;
static GHashTable *bold_items; static GHashTable *bold_items;
static GHashTable *str_to_pair; static GHashTable *str_to_pair;
static GHashTable *defaults;
struct colour_string_t { struct colour_string_t {
char *str; char *str;
@ -73,6 +74,90 @@ theme_init(const char *const theme_name)
} }
str_to_pair = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); str_to_pair = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL);
defaults = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL);
g_hash_table_insert(defaults, strdup("main.text"), strdup("white"));
g_hash_table_insert(defaults, strdup("main.text.me"), strdup("white"));
g_hash_table_insert(defaults, strdup("main.text.them"), strdup("white"));
g_hash_table_insert(defaults, strdup("main.splash"), strdup("cyan"));
g_hash_table_insert(defaults, strdup("error"), strdup("red"));
g_hash_table_insert(defaults, strdup("incoming"), strdup("yellow"));
g_hash_table_insert(defaults, strdup("input.text"), strdup("white"));
g_hash_table_insert(defaults, strdup("main.time"), strdup("white"));
g_hash_table_insert(defaults, strdup("titlebar.text"), strdup("white"));
g_hash_table_insert(defaults, strdup("titlebar.brackets"), strdup("cyan"));
g_hash_table_insert(defaults, strdup("titlebar.unencrypted"), strdup("red"));
g_hash_table_insert(defaults, strdup("titlebar.encrypted"), strdup("white"));
g_hash_table_insert(defaults, strdup("titlebar.untrusted"), strdup("yellow"));
g_hash_table_insert(defaults, strdup("titlebar.trusted"), strdup("white"));
g_hash_table_insert(defaults, strdup("titlebar.online"), strdup("white"));
g_hash_table_insert(defaults, strdup("titlebar.offline"), strdup("white"));
g_hash_table_insert(defaults, strdup("titlebar.away"), strdup("white"));
g_hash_table_insert(defaults, strdup("titlebar.chat"), strdup("white"));
g_hash_table_insert(defaults, strdup("titlebar.dnd"), strdup("white"));
g_hash_table_insert(defaults, strdup("titlebar.xa"), strdup("white"));
g_hash_table_insert(defaults, strdup("statusbar.text"), strdup("white"));
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("me"), strdup("yellow"));
g_hash_table_insert(defaults, strdup("them"), strdup("green"));
g_hash_table_insert(defaults, strdup("receipt.sent"), strdup("red"));
g_hash_table_insert(defaults, strdup("roominfo"), strdup("yellow"));
g_hash_table_insert(defaults, strdup("roommention"), strdup("yellow"));
g_hash_table_insert(defaults, strdup("online"), strdup("green"));
g_hash_table_insert(defaults, strdup("offline"), strdup("red"));
g_hash_table_insert(defaults, strdup("away"), strdup("cyan"));
g_hash_table_insert(defaults, strdup("chat"), strdup("green"));
g_hash_table_insert(defaults, strdup("dnd"), strdup("red"));
g_hash_table_insert(defaults, strdup("xa"), strdup("cyan"));
g_hash_table_insert(defaults, strdup("typing"), strdup("yellow"));
g_hash_table_insert(defaults, strdup("gone"), strdup("red"));
g_hash_table_insert(defaults, strdup("subscribed"), strdup("green"));
g_hash_table_insert(defaults, strdup("unsubscribed"), strdup("red"));
g_hash_table_insert(defaults, strdup("otr.started.trusted"), strdup("green"));
g_hash_table_insert(defaults, strdup("otr.started.untrusted"), strdup("yellow"));
g_hash_table_insert(defaults, strdup("otr.ended"), strdup("red"));
g_hash_table_insert(defaults, strdup("otr.trusted"), strdup("green"));
g_hash_table_insert(defaults, strdup("otr.untrusted"), strdup("yellow"));
g_hash_table_insert(defaults, strdup("roster.header"), strdup("yellow"));
g_hash_table_insert(defaults, strdup("roster.online"), strdup("green"));
g_hash_table_insert(defaults, strdup("roster.offline"), strdup("red"));
g_hash_table_insert(defaults, strdup("roster.chat"), strdup("green"));
g_hash_table_insert(defaults, strdup("roster.away"), strdup("cyan"));
g_hash_table_insert(defaults, strdup("roster.dnd"), strdup("red"));
g_hash_table_insert(defaults, strdup("roster.xa"), strdup("cyan"));
g_hash_table_insert(defaults, strdup("roster.online.active"), strdup("green"));
g_hash_table_insert(defaults, strdup("roster.offline.active"), strdup("red"));
g_hash_table_insert(defaults, strdup("roster.chat.active"), strdup("green"));
g_hash_table_insert(defaults, strdup("roster.away.active"), strdup("cyan"));
g_hash_table_insert(defaults, strdup("roster.dnd.active"), strdup("red"));
g_hash_table_insert(defaults, strdup("roster.xa.active"), strdup("cyan"));
g_hash_table_insert(defaults, strdup("roster.online.unread"), strdup("green"));
g_hash_table_insert(defaults, strdup("roster.offline.unread"), strdup("red"));
g_hash_table_insert(defaults, strdup("roster.chat.unread"), strdup("green"));
g_hash_table_insert(defaults, strdup("roster.away.unread"), strdup("cyan"));
g_hash_table_insert(defaults, strdup("roster.dnd.unread"), strdup("red"));
g_hash_table_insert(defaults, strdup("roster.xa.unread"), strdup("cyan"));
g_hash_table_insert(defaults, strdup("roster.room"), strdup("green"));
g_hash_table_insert(defaults, strdup("roster.room.unread"), strdup("green"));
g_hash_table_insert(defaults, strdup("occupants.header"), strdup("yellow"));
}
gboolean
theme_exists(const char *const theme_name)
{
if (g_strcmp0(theme_name, "default") == 0) {
return TRUE;
}
GString *new_theme_file = _theme_find(theme_name);
if (new_theme_file == NULL) {
return FALSE;
}
g_string_free(new_theme_file, TRUE);
return TRUE;
} }
gboolean gboolean
@ -152,6 +237,10 @@ theme_close(void)
g_hash_table_destroy(str_to_pair); g_hash_table_destroy(str_to_pair);
str_to_pair = NULL; str_to_pair = NULL;
} }
if (defaults) {
g_hash_table_destroy(defaults);
defaults = NULL;
}
} }
static void static void
@ -557,6 +646,25 @@ _theme_prep_fgnd(char *setting, char *def, GString *lookup_str, gboolean *bold)
g_free(val); g_free(val);
} }
char*
theme_get_string(char *str)
{
char *res = g_key_file_get_string(theme, "colours", str, NULL);
if (!res) {
return strdup(g_hash_table_lookup(defaults, str));
} else {
return res;
}
}
void
theme_free_string(char *str)
{
if (str) {
g_free(str);
}
}
int int
theme_attrs(theme_item_t attrs) theme_attrs(theme_item_t attrs)
{ {

View File

@ -128,10 +128,12 @@ typedef enum {
void theme_init(const char *const theme_name); void theme_init(const char *const theme_name);
void theme_init_colours(void); void theme_init_colours(void);
gboolean theme_load(const char *const theme_name); gboolean theme_load(const char *const theme_name);
gboolean theme_exists(const char *const theme_name);
GSList* theme_list(void); GSList* theme_list(void);
void theme_close(void); void theme_close(void);
int theme_attrs(theme_item_t attrs); int theme_attrs(theme_item_t attrs);
char* theme_get_string(char *str);
void theme_free_string(char *str);
theme_item_t theme_main_presence_attrs(const char *const presence); theme_item_t theme_main_presence_attrs(const char *const presence);
theme_item_t theme_roster_unread_presence_attrs(const char *const presence); theme_item_t theme_roster_unread_presence_attrs(const char *const presence);
theme_item_t theme_roster_active_presence_attrs(const char *const presence); theme_item_t theme_roster_active_presence_attrs(const char *const presence);

View File

@ -851,6 +851,9 @@ cons_show_account(ProfAccount *account)
if (account->startscript) { if (account->startscript) {
cons_show ("Start script : %s", account->startscript); cons_show ("Start script : %s", account->startscript);
} }
if (account->theme) {
cons_show ("Theme : %s", account->theme);
}
if (account->otr_policy) { if (account->otr_policy) {
cons_show ("OTR policy : %s", account->otr_policy); cons_show ("OTR policy : %s", account->otr_policy);
} }
@ -2003,6 +2006,136 @@ cons_get_string(ProfConsoleWin *conswin)
return strdup("Console"); return strdup("Console");
} }
void
_cons_theme_bar_prop(theme_item_t theme, char *prop)
{
ProfWin *console = wins_get_console();
GString *propstr = g_string_new(" ");
g_string_append_printf(propstr, "%-24s", prop);
win_print(console, '-', 0, NULL, NO_EOL, THEME_TEXT, "", propstr->str);
g_string_free(propstr, TRUE);
GString *valstr = g_string_new(" ");
char *setting = theme_get_string(prop);
g_string_append_printf(valstr, "%s ", setting);
theme_free_string(setting);
win_print(console, '-', 0, NULL, NO_DATE | NO_EOL, theme, "", valstr->str);
win_print(console, '-', 0, NULL, NO_DATE, THEME_TEXT, "", "");
g_string_free(valstr, TRUE);
}
void
_cons_theme_prop(theme_item_t theme, char *prop)
{
ProfWin *console = wins_get_console();
GString *propstr = g_string_new(" ");
g_string_append_printf(propstr, "%-24s", prop);
win_print(console, '-', 0, NULL, NO_EOL, THEME_TEXT, "", propstr->str);
g_string_free(propstr, TRUE);
GString *valstr = g_string_new("");
char *setting = theme_get_string(prop);
g_string_append_printf(valstr, "%s", setting);
theme_free_string(setting);
win_print(console, '-', 0, NULL, NO_DATE, theme, "", valstr->str);
g_string_free(valstr, TRUE);
// GString *str = g_string_new(" ");
// char *setting = theme_get_string(prop);
// g_string_append_printf(str, "%-24s%s", prop, setting);
// theme_free_string(setting);
// win_print(console, '-', 0, NULL, 0, theme, "", str->str);
// g_string_free(str, TRUE);
}
void
cons_theme_properties(void)
{
cons_show("Current colours:");
_cons_theme_bar_prop(THEME_TITLE_TEXT, "titlebar.text");
_cons_theme_bar_prop(THEME_TITLE_BRACKET, "titlebar.brackets");
_cons_theme_bar_prop(THEME_TITLE_UNENCRYPTED, "titlebar.unencrypted");
_cons_theme_bar_prop(THEME_TITLE_ENCRYPTED, "titlebar.encrypted");
_cons_theme_bar_prop(THEME_TITLE_UNTRUSTED, "titlebar.untrusted");
_cons_theme_bar_prop(THEME_TITLE_TRUSTED, "titlebar.trusted");
_cons_theme_bar_prop(THEME_TITLE_CHAT, "titlebar.chat");
_cons_theme_bar_prop(THEME_TITLE_ONLINE, "titlebar.online");
_cons_theme_bar_prop(THEME_TITLE_AWAY, "titlebar.away");
_cons_theme_bar_prop(THEME_TITLE_XA, "titlebar.xa");
_cons_theme_bar_prop(THEME_TITLE_DND, "titlebar.dnd");
_cons_theme_bar_prop(THEME_TITLE_OFFLINE, "titlebar.offline");
_cons_theme_bar_prop(THEME_STATUS_TEXT, "statusbar.text");
_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_prop(THEME_TIME, "main.time");
_cons_theme_prop(THEME_TEXT, "main.text");
_cons_theme_prop(THEME_SPLASH, "main.splash");
_cons_theme_prop(THEME_ERROR, "error");
_cons_theme_prop(THEME_OTR_STARTED_TRUSTED, "otr.started.trusted");
_cons_theme_prop(THEME_OTR_STARTED_UNTRUSTED, "otr.started.untrusted");
_cons_theme_prop(THEME_OTR_ENDED, "otr.ended");
_cons_theme_prop(THEME_OTR_TRUSTED, "otr.trusted");
_cons_theme_prop(THEME_OTR_UNTRUSTED, "otr.untrusted");
_cons_theme_prop(THEME_ME, "me");
_cons_theme_prop(THEME_TEXT_ME, "main.text.me");
_cons_theme_prop(THEME_THEM, "them");
_cons_theme_prop(THEME_TEXT_THEM, "main.text.them");
_cons_theme_prop(THEME_CHAT, "chat");
_cons_theme_prop(THEME_ONLINE, "online");
_cons_theme_prop(THEME_AWAY, "away");
_cons_theme_prop(THEME_XA, "xa");
_cons_theme_prop(THEME_DND, "dnd");
_cons_theme_prop(THEME_OFFLINE, "offline");
_cons_theme_prop(THEME_SUBSCRIBED, "subscribed");
_cons_theme_prop(THEME_UNSUBSCRIBED, "unsubscribed");
_cons_theme_prop(THEME_INCOMING, "incoming");
_cons_theme_prop(THEME_TYPING, "typing");
_cons_theme_prop(THEME_GONE, "gone");
_cons_theme_prop(THEME_ROOMINFO, "roominfo");
_cons_theme_prop(THEME_ROOMMENTION, "roommention");
_cons_theme_prop(THEME_ROSTER_HEADER, "roster.header");
_cons_theme_prop(THEME_ROSTER_CHAT, "roster.chat");
_cons_theme_prop(THEME_ROSTER_ONLINE, "roster.online");
_cons_theme_prop(THEME_ROSTER_AWAY, "roster.away");
_cons_theme_prop(THEME_ROSTER_XA, "roster.xa");
_cons_theme_prop(THEME_ROSTER_DND, "roster.dnd");
_cons_theme_prop(THEME_ROSTER_OFFLINE, "roster.offline");
_cons_theme_prop(THEME_ROSTER_CHAT_ACTIVE, "roster.chat.active");
_cons_theme_prop(THEME_ROSTER_ONLINE_ACTIVE, "roster.online.active");
_cons_theme_prop(THEME_ROSTER_AWAY_ACTIVE, "roster.away.active");
_cons_theme_prop(THEME_ROSTER_XA_ACTIVE, "roster.xa.active");
_cons_theme_prop(THEME_ROSTER_DND_ACTIVE, "roster.dnd.active");
_cons_theme_prop(THEME_ROSTER_OFFLINE_ACTIVE, "roster.offline.active");
_cons_theme_prop(THEME_ROSTER_CHAT_UNREAD, "roster.chat.unread");
_cons_theme_prop(THEME_ROSTER_ONLINE_UNREAD, "roster.online.unread");
_cons_theme_prop(THEME_ROSTER_AWAY_UNREAD, "roster.away.unread");
_cons_theme_prop(THEME_ROSTER_XA_UNREAD, "roster.xa.unread");
_cons_theme_prop(THEME_ROSTER_DND_UNREAD, "roster.dnd.unread");
_cons_theme_prop(THEME_ROSTER_OFFLINE_UNREAD, "roster.offline.unread");
_cons_theme_prop(THEME_ROSTER_ROOM, "roster.room");
_cons_theme_prop(THEME_ROSTER_ROOM_UNREAD, "roster.room.unread");
_cons_theme_prop(THEME_OCCUPANTS_HEADER, "occupants.header");
_cons_theme_prop(THEME_RECEIPT_SENT, "receipt.sent");
_cons_theme_prop(THEME_INPUT_TEXT, "input.text");
cons_show("");
}
void void
cons_theme_colours(void) cons_theme_colours(void)
{ {
@ -2020,7 +2153,7 @@ cons_theme_colours(void)
*/ */
ProfWin *console = wins_get_console(); ProfWin *console = wins_get_console();
cons_show("Theme colours:"); cons_show("Available colours:");
win_print(console, '-', 0, NULL, NO_EOL, THEME_WHITE, "", " white "); win_print(console, '-', 0, NULL, NO_EOL, THEME_WHITE, "", " white ");
win_print(console, '-', 0, NULL, NO_DATE, THEME_WHITE_BOLD, "", " bold_white"); win_print(console, '-', 0, NULL, NO_DATE, THEME_WHITE_BOLD, "", " bold_white");
win_print(console, '-', 0, NULL, NO_EOL, THEME_GREEN, "", " green "); win_print(console, '-', 0, NULL, NO_EOL, THEME_GREEN, "", " green ");

View File

@ -353,6 +353,25 @@ ui_group_removed(const char *const contact, const char *const group)
void void
ui_handle_login_account_success(ProfAccount *account, int secured) ui_handle_login_account_success(ProfAccount *account, int secured)
{ {
if (account->theme) {
if (theme_load(account->theme)) {
ui_load_colours();
if (prefs_get_boolean(PREF_ROSTER)) {
ui_show_roster();
} else {
ui_hide_roster();
}
if (prefs_get_boolean(PREF_OCCUPANTS)) {
ui_show_all_room_rosters();
} else {
ui_hide_all_room_rosters();
}
ui_redraw();
} else {
cons_show("Couldn't find account theme: %s", account->theme);
}
}
resource_presence_t resource_presence = accounts_get_login_presence(account->name); resource_presence_t resource_presence = accounts_get_login_presence(account->name);
contact_presence_t contact_presence = contact_presence_from_resource_presence(resource_presence); contact_presence_t contact_presence = contact_presence_from_resource_presence(resource_presence);
cons_show_login_success(account, secured); cons_show_login_success(account, secured);

View File

@ -301,6 +301,7 @@ void cons_autoconnect_setting(void);
void cons_inpblock_setting(void); void cons_inpblock_setting(void);
void cons_show_contact_online(PContact contact, Resource *resource, GDateTime *last_activity); void cons_show_contact_online(PContact contact, Resource *resource, GDateTime *last_activity);
void cons_show_contact_offline(PContact contact, char *resource, char *status); void cons_show_contact_offline(PContact contact, char *resource, char *status);
void cons_theme_properties(void);
void cons_theme_colours(void); void cons_theme_colours(void);
void cons_show_tlscert(TLSCertificate *cert); void cons_show_tlscert(TLSCertificate *cert);
void cons_show_tlscert_summary(TLSCertificate *cert); void cons_show_tlscert_summary(TLSCertificate *cert);

View File

@ -1086,6 +1086,7 @@ _win_print(ProfWin *window, const char show_char, int pad_indent, GDateTime *tim
if ((flags & NO_DATE) == 0) { if ((flags & NO_DATE) == 0) {
if (date_fmt && strlen(date_fmt)) { if (date_fmt && strlen(date_fmt)) {
if ((flags & NO_COLOUR_DATE) == 0) { if ((flags & NO_COLOUR_DATE) == 0) {
wbkgdset(window->layout->win, theme_attrs(THEME_TIME));
wattron(window->layout->win, theme_attrs(THEME_TIME)); wattron(window->layout->win, theme_attrs(THEME_TIME));
} }
wprintw(window->layout->win, "%s %c ", date_fmt, show_char); wprintw(window->layout->win, "%s %c ", date_fmt, show_char);
@ -1108,6 +1109,7 @@ _win_print(ProfWin *window, const char show_char, int pad_indent, GDateTime *tim
colour = theme_attrs(THEME_RECEIPT_SENT); colour = theme_attrs(THEME_RECEIPT_SENT);
} }
wbkgdset(window->layout->win, colour);
wattron(window->layout->win, colour); wattron(window->layout->win, colour);
if (strncmp(message, "/me ", 4) == 0) { if (strncmp(message, "/me ", 4) == 0) {
wprintw(window->layout->win, "*%s ", from); wprintw(window->layout->win, "*%s ", from);
@ -1121,8 +1123,10 @@ _win_print(ProfWin *window, const char show_char, int pad_indent, GDateTime *tim
if (!me_message) { if (!me_message) {
if (receipt && !receipt->received) { if (receipt && !receipt->received) {
wbkgdset(window->layout->win, theme_attrs(THEME_RECEIPT_SENT));
wattron(window->layout->win, theme_attrs(THEME_RECEIPT_SENT)); wattron(window->layout->win, theme_attrs(THEME_RECEIPT_SENT));
} else { } else {
wbkgdset(window->layout->win, theme_attrs(theme_item));
wattron(window->layout->win, theme_attrs(theme_item)); wattron(window->layout->win, theme_attrs(theme_item));
} }
} }

View File

@ -126,6 +126,7 @@ void accounts_set_last_status(const char * const account_name, const char * cons
void accounts_set_last_activity(const char * const account_name) {} void accounts_set_last_activity(const char * const account_name) {}
void accounts_set_pgp_keyid(const char * const account_name, const char * const value) {} void accounts_set_pgp_keyid(const char * const account_name, const char * const value) {}
void accounts_set_script_start(const char * const account_name, const char * const value) {} void accounts_set_script_start(const char * const account_name, const char * const value) {}
void accounts_set_theme(const char * const account_name, const char * const value) {}
void accounts_set_tls_policy(const char * const account_name, const char * const value) {} void accounts_set_tls_policy(const char * const account_name, const char * const value) {}
void accounts_set_login_presence(const char * const account_name, const char * const value) void accounts_set_login_presence(const char * const account_name, const char * const value)
@ -194,6 +195,7 @@ void accounts_clear_port(const char * const account_name) {}
void accounts_clear_otr(const char * const account_name) {} void accounts_clear_otr(const char * const account_name) {}
void accounts_clear_pgp_keyid(const char * const account_name) {} void accounts_clear_pgp_keyid(const char * const account_name) {}
void accounts_clear_script_start(const char * const account_name) {} void accounts_clear_script_start(const char * const account_name) {}
void accounts_clear_theme(const char * const account_name) {}
void accounts_add_otr_policy(const char * const account_name, const char * const contact_jid, const char * const policy) {} void accounts_add_otr_policy(const char * const account_name, const char * const contact_jid, const char * const policy) {}
char* accounts_get_last_activity(const char *const account_name) char* accounts_get_last_activity(const char *const account_name)
{ {

View File

@ -33,7 +33,7 @@ void cmd_account_shows_usage_when_not_connected_and_no_args(void **state)
void cmd_account_shows_account_when_connected_and_no_args(void **state) void cmd_account_shows_account_when_connected_and_no_args(void **state)
{ {
ProfAccount *account = account_new("jabber_org", "me@jabber.org", NULL, NULL, ProfAccount *account = account_new("jabber_org", "me@jabber.org", NULL, NULL,
TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
gchar *args[] = { NULL }; gchar *args[] = { NULL };
will_return(jabber_get_connection_status, JABBER_CONNECTED); will_return(jabber_get_connection_status, JABBER_CONNECTED);
@ -93,7 +93,7 @@ void cmd_account_show_shows_account_when_exists(void **state)
{ {
gchar *args[] = { "show", "account_name", NULL }; gchar *args[] = { "show", "account_name", NULL };
ProfAccount *account = account_new("jabber_org", "me@jabber.org", NULL, NULL, ProfAccount *account = account_new("jabber_org", "me@jabber.org", NULL, NULL,
TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
expect_any(accounts_get_account, name); expect_any(accounts_get_account, name);
will_return(accounts_get_account, account); will_return(accounts_get_account, account);
@ -409,7 +409,7 @@ void cmd_account_set_password_sets_password(void **state)
{ {
gchar *args[] = { "set", "a_account", "password", "a_password", NULL }; gchar *args[] = { "set", "a_account", "password", "a_password", NULL };
ProfAccount *account = account_new("a_account", NULL, NULL, NULL, ProfAccount *account = account_new("a_account", NULL, NULL, NULL,
TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
expect_any(accounts_account_exists, account_name); expect_any(accounts_account_exists, account_name);
@ -432,7 +432,7 @@ void cmd_account_set_eval_password_sets_eval_password(void **state)
{ {
gchar *args[] = { "set", "a_account", "eval_password", "a_password", NULL }; gchar *args[] = { "set", "a_account", "eval_password", "a_password", NULL };
ProfAccount *account = account_new("a_account", NULL, NULL, NULL, ProfAccount *account = account_new("a_account", NULL, NULL, NULL,
TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
expect_any(accounts_account_exists, account_name); expect_any(accounts_account_exists, account_name);
will_return(accounts_account_exists, TRUE); will_return(accounts_account_exists, TRUE);
@ -453,7 +453,7 @@ void cmd_account_set_eval_password_sets_eval_password(void **state)
void cmd_account_set_password_when_eval_password_set(void **state) { void cmd_account_set_password_when_eval_password_set(void **state) {
gchar *args[] = { "set", "a_account", "password", "a_password", NULL }; gchar *args[] = { "set", "a_account", "password", "a_password", NULL };
ProfAccount *account = account_new("a_account", NULL, NULL, "a_password", ProfAccount *account = account_new("a_account", NULL, NULL, "a_password",
TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
expect_any(accounts_account_exists, account_name); expect_any(accounts_account_exists, account_name);
will_return(accounts_account_exists, TRUE); will_return(accounts_account_exists, TRUE);
@ -470,7 +470,7 @@ void cmd_account_set_password_when_eval_password_set(void **state) {
void cmd_account_set_eval_password_when_password_set(void **state) { void cmd_account_set_eval_password_when_password_set(void **state) {
gchar *args[] = { "set", "a_account", "eval_password", "a_password", NULL }; gchar *args[] = { "set", "a_account", "eval_password", "a_password", NULL };
ProfAccount *account = account_new("a_account", NULL, "a_password", NULL, ProfAccount *account = account_new("a_account", NULL, "a_password", NULL,
TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
expect_any(accounts_account_exists, account_name); expect_any(accounts_account_exists, account_name);
will_return(accounts_account_exists, TRUE); will_return(accounts_account_exists, TRUE);
@ -800,7 +800,7 @@ void cmd_account_set_priority_updates_presence_when_account_connected_with_prese
#ifdef HAVE_LIBGPGME #ifdef HAVE_LIBGPGME
ProfAccount *account = account_new("a_account", "a_jid", NULL, NULL, TRUE, NULL, 5222, "a_resource", ProfAccount *account = account_new("a_account", "a_jid", NULL, NULL, TRUE, NULL, 5222, "a_resource",
NULL, NULL, 10, 10, 10, 10, 10, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); NULL, NULL, 10, 10, 10, 10, 10, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
will_return(jabber_get_account_name, "a_account"); will_return(jabber_get_account_name, "a_account");
expect_any(accounts_get_account, name); expect_any(accounts_get_account, name);

View File

@ -121,7 +121,7 @@ void cmd_connect_asks_password_when_not_in_account(void **state)
{ {
gchar *args[] = { "jabber_org", NULL }; gchar *args[] = { "jabber_org", NULL };
ProfAccount *account = account_new("jabber_org", "me@jabber.org", NULL, NULL, ProfAccount *account = account_new("jabber_org", "me@jabber.org", NULL, NULL,
TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
will_return(jabber_get_connection_status, JABBER_DISCONNECTED); will_return(jabber_get_connection_status, JABBER_DISCONNECTED);
@ -368,7 +368,7 @@ void cmd_connect_shows_message_when_connecting_with_account(void **state)
{ {
gchar *args[] = { "jabber_org", NULL }; gchar *args[] = { "jabber_org", NULL };
ProfAccount *account = account_new("jabber_org", "user@jabber.org", "password", NULL, ProfAccount *account = account_new("jabber_org", "user@jabber.org", "password", NULL,
TRUE, NULL, 0, "laptop", NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); TRUE, NULL, 0, "laptop", NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
will_return(jabber_get_connection_status, JABBER_DISCONNECTED); will_return(jabber_get_connection_status, JABBER_DISCONNECTED);
@ -388,7 +388,7 @@ void cmd_connect_connects_with_account(void **state)
{ {
gchar *args[] = { "jabber_org", NULL }; gchar *args[] = { "jabber_org", NULL };
ProfAccount *account = account_new("jabber_org", "me@jabber.org", "password", NULL, ProfAccount *account = account_new("jabber_org", "me@jabber.org", "password", NULL,
TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
will_return(jabber_get_connection_status, JABBER_DISCONNECTED); will_return(jabber_get_connection_status, JABBER_DISCONNECTED);

View File

@ -70,7 +70,7 @@ void cmd_join_uses_account_mucservice_when_no_service_specified(void **state)
char *expected_room = "room@conference.server.org"; char *expected_room = "room@conference.server.org";
gchar *args[] = { room, "nick", nick, NULL }; gchar *args[] = { room, "nick", nick, NULL };
ProfAccount *account = account_new(account_name, "user@server.org", NULL, NULL, ProfAccount *account = account_new(account_name, "user@server.org", NULL, NULL,
TRUE, NULL, 0, "laptop", NULL, NULL, 0, 0, 0, 0, 0, account_service, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); TRUE, NULL, 0, "laptop", NULL, NULL, 0, 0, 0, 0, 0, account_service, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
muc_init(); muc_init();
@ -95,7 +95,7 @@ void cmd_join_uses_supplied_nick(void **state)
char *nick = "bob"; char *nick = "bob";
gchar *args[] = { room, "nick", nick, NULL }; gchar *args[] = { room, "nick", nick, NULL };
ProfAccount *account = account_new(account_name, "user@server.org", NULL, NULL, ProfAccount *account = account_new(account_name, "user@server.org", NULL, NULL,
TRUE, NULL, 0, "laptop", NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); TRUE, NULL, 0, "laptop", NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
muc_init(); muc_init();
@ -120,7 +120,7 @@ void cmd_join_uses_account_nick_when_not_supplied(void **state)
char *account_nick = "a_nick"; char *account_nick = "a_nick";
gchar *args[] = { room, NULL }; gchar *args[] = { room, NULL };
ProfAccount *account = account_new(account_name, "user@server.org", NULL, NULL, ProfAccount *account = account_new(account_name, "user@server.org", NULL, NULL,
TRUE, NULL, 0, "laptop", NULL, NULL, 0, 0, 0, 0, 0, NULL, account_nick, NULL, NULL, NULL, NULL, NULL, NULL, NULL); TRUE, NULL, 0, "laptop", NULL, NULL, 0, 0, 0, 0, 0, NULL, account_nick, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
muc_init(); muc_init();
@ -148,7 +148,7 @@ void cmd_join_uses_password_when_supplied(void **state)
char *expected_room = "room@a_service"; char *expected_room = "room@a_service";
gchar *args[] = { room, "password", password, NULL }; gchar *args[] = { room, "password", password, NULL };
ProfAccount *account = account_new(account_name, "user@server.org", NULL, NULL, ProfAccount *account = account_new(account_name, "user@server.org", NULL, NULL,
TRUE, NULL, 0, "laptop", NULL, NULL, 0, 0, 0, 0, 0, account_service, account_nick, NULL, NULL, NULL, NULL, NULL, NULL, NULL); TRUE, NULL, 0, "laptop", NULL, NULL, 0, 0, 0, 0, 0, account_service, account_nick, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
muc_init(); muc_init();

View File

@ -209,7 +209,7 @@ void cmd_otr_gen_generates_key_for_connected_account(void **state)
gchar *args[] = { "gen", NULL }; gchar *args[] = { "gen", NULL };
char *account_name = "myaccount"; char *account_name = "myaccount";
ProfAccount *account = account_new(account_name, "me@jabber.org", NULL, NULL, ProfAccount *account = account_new(account_name, "me@jabber.org", NULL, NULL,
TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
will_return(jabber_get_connection_status, JABBER_CONNECTED); will_return(jabber_get_connection_status, JABBER_CONNECTED);
will_return(jabber_get_account_name, account_name); will_return(jabber_get_account_name, account_name);

View File

@ -56,7 +56,7 @@ void cmd_rooms_uses_account_default_when_no_arg(void **state)
gchar *args[] = { NULL }; gchar *args[] = { NULL };
ProfAccount *account = account_new("testaccount", NULL, NULL, NULL, TRUE, NULL, 0, NULL, NULL, NULL, ProfAccount *account = account_new("testaccount", NULL, NULL, NULL, TRUE, NULL, 0, NULL, NULL, NULL,
0, 0, 0, 0, 0, strdup("default_conf_server"), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); 0, 0, 0, 0, 0, strdup("default_conf_server"), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
will_return(jabber_get_connection_status, JABBER_CONNECTED); will_return(jabber_get_connection_status, JABBER_CONNECTED);
will_return(jabber_get_account_name, "account_name"); will_return(jabber_get_account_name, "account_name");

View File

@ -444,6 +444,7 @@ void cons_show_contact_online(PContact contact, Resource *resource, GDateTime *l
void cons_show_contact_offline(PContact contact, char *resource, char *status) {} void cons_show_contact_offline(PContact contact, char *resource, char *status) {}
void cons_theme_colours(void) {} void cons_theme_colours(void) {}
void cons_theme_properties(void) {}
// title bar // title bar
void title_bar_set_presence(contact_presence_t presence) {} void title_bar_set_presence(contact_presence_t presence) {}

125
themes/bios Normal file
View File

@ -0,0 +1,125 @@
[colours]
bkgnd=blue
titlebar=white
titlebar.text=black
titlebar.brackets=black
titlebar.unencrypted=black
titlebar.encrypted=black
titlebar.untrusted=black
titlebar.trusted=black
titlebar.online=black
titlebar.offline=black
titlebar.away=black
titlebar.xa=black
titlebar.dnd=black
titlebar.chat=black
statusbar=white
statusbar.text=black
statusbar.brackets=black
statusbar.active=black
statusbar.new=black
main.text=bold_white
main.text.me=bold_white
main.text.them=bold_white
main.splash=bold_green
main.time=bold_green
input.text=bold_white
subscribed=bold_green
unsubscribed=bold_red
otr.started.trusted=bold_green
otr.started.untrusted=bold_yellow
otr.ended=bold_red
otr.trusted=bold_green
otr.untrusted=bold_yellow
online=bold_green
away=bold_cyan
chat=bold_white
dnd=bold_red
xa=bold_cyan
offline=bold_blue
incoming=bold_yellow
typing=bold_yellow
gone=bold_red
error=bold_red
roominfo=bold_yellow
roommention=bold_green
me=bold_cyan
them=bold_magenta
roster.header=bold_magenta
roster.chat=white
roster.online=green
roster.away=cyan
roster.xa=cyan
roster.dnd=red
roster.offline=bold_blue
roster.chat.active=white
roster.online.active=green
roster.away.active=cyan
roster.xa.active=cyan
roster.dnd.active=red
roster.offline.active=bold_blue
roster.chat.unread=bold_white
roster.online.unread=bold_green
roster.away.unread=bold_cyan
roster.xa.unread=bold_cyan
roster.dnd.unread=bold_red
roster.offline.unread=bold_blue
roster.room=bold_red
roster.room.unread=bold_magenta
occupants.header=bold_magenta
receipt.sent=bold_blue
[ui]
beep=false
flash=false
splash=true
wrap=true
time.console=%H:%M:%S
time.chat=%d/%m/%y %H:%M:%S
time.muc=%d/%m/%y %H:%M:%S
time.mucconfig=off
time.private=%d/%m/%y %H:%M:%S
time.xml=%H:%M:%S
time.statusbar=%H:%M:%S
time.lastactivity=%d/%m/%y %H:%M:%S
privileges=true
presence=true
intype=true
enc.warn=true
resource.title=true
resource.message=true
statuses.console=all
statuses.chat=all
statuses.muc=none
roster=true
roster.offline=true
roster.empty=false
roster.by=group
roster.order=presence
roster.unread=before
roster.count=true
roster.priority=false
roster.size=25
roster.wrap=true
roster.header.char=@
roster.contact.indent=1
roster.resource=true
roster.resource.char=/
roster.resource.indent=1
roster.resource.join=true
roster.presence=true
roster.presence.indent=-1
roster.status=true
roster.contacts=true
roster.rooms=true
roster.rooms.order=name
roster.rooms.unread=before
roster.rooms.pos=last
occupants=true
occupants.size=15
occupants.jid=false
wins.autotidy=true
otr.char=@
pgp.char=%
tls.show=true
console.muc=first

View File

@ -2,7 +2,7 @@
bkgnd=default bkgnd=default
titlebar=blue titlebar=blue
titlebar.text=bold_white titlebar.text=bold_white
titlebar.brackets=white titlebar.brackets=bold_white
titlebar.unencrypted=bold_red titlebar.unencrypted=bold_red
titlebar.encrypted=bold_white titlebar.encrypted=bold_white
titlebar.untrusted=bold_yellow titlebar.untrusted=bold_yellow
@ -15,7 +15,7 @@ titlebar.dnd=bold_red
titlebar.chat=bold_green titlebar.chat=bold_green
statusbar=blue statusbar=blue
statusbar.text=bold_white statusbar.text=bold_white
statusbar.brackets=white statusbar.brackets=bold_white
statusbar.active=bold_cyan statusbar.active=bold_cyan
statusbar.new=bold_white statusbar.new=bold_white
main.text=white main.text=white

122
themes/boothj5_slack Normal file
View File

@ -0,0 +1,122 @@
[colours]
bkgnd=default
titlebar=blue
titlebar.text=bold_white
titlebar.brackets=bold_white
titlebar.unencrypted=bold_red
titlebar.encrypted=bold_white
titlebar.untrusted=bold_yellow
titlebar.trusted=bold_white
titlebar.online=bold_green
titlebar.offline=bold_red
titlebar.away=bold_cyan
titlebar.xa=bold_cyan
titlebar.dnd=bold_red
titlebar.chat=bold_green
statusbar=blue
statusbar.text=bold_white
statusbar.brackets=bold_white
statusbar.active=bold_cyan
statusbar.new=bold_white
main.text=white
main.text.me=cyan
main.text.them=bold_white
main.splash=bold_red
main.time=yellow
input.text=bold_green
subscribed=bold_green
unsubscribed=red
otr.started.trusted=green
otr.started.untrusted=yellow
otr.ended=red
otr.trusted=green
otr.untrusted=yellow
online=bold_green
away=bold_cyan
chat=bold_white
dnd=magenta
xa=bold_blue
offline=red
incoming=bold_yellow
typing=yellow
gone=red
error=red
roominfo=yellow
roommention=bold_red
me=blue
them=bold_green
roster.header=bold_yellow
roster.chat=white
roster.online=green
roster.away=cyan
roster.xa=blue
roster.dnd=magenta
roster.offline=red
roster.chat.active=white
roster.online.active=green
roster.away.active=cyan
roster.xa.active=blue
roster.dnd.active=magenta
roster.offline.active=red
roster.chat.unread=bold_white
roster.online.unread=bold_green
roster.away.unread=bold_cyan
roster.xa.unread=bold_blue
roster.dnd.unread=bold_magenta
roster.offline.unread=bold_red
roster.room=green
roster.room.unread=bold_green
occupants.header=bold_yellow
receipt.sent=bold_black
[ui]
beep=false
flash=false
splash=true
wrap=true
time.console=%H:%M:%S
time.chat=%d/%m/%y %H:%M:%S
time.muc=%d/%m/%y %H:%M:%S
time.mucconfig=off
time.private=%d/%m/%y %H:%M:%S
time.xml=%H:%M:%S
time.statusbar=%H:%M:%S
time.lastactivity=%d/%m/%y %H:%M:%S
privileges=false
presence=true
intype=true
enc.warn=true
resource.title=false
resource.message=false
statuses.console=none
statuses.chat=none
statuses.muc=none
roster=true
roster.offline=false
roster.empty=false
roster.by=presence
roster.order=presence
roster.unread=before
roster.count=true
roster.priority=false
roster.size=35
roster.wrap=true
roster.header.char=@
roster.contact.indent=1
roster.resource=false
roster.presence=true
roster.presence.indent=-1
roster.status=true
roster.contacts=true
roster.rooms=true
roster.rooms.order=name
roster.rooms.unread=before
roster.rooms.pos=first
occupants=true
occupants.size=15
occupants.jid=false
wins.autotidy=true
otr.char=@
pgp.char=%
tls.show=true
console.muc=all