From 480589f0aec93b5b83d287a221c69d0388f2ec3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Senart?= Date: Mon, 14 Oct 2013 20:15:51 +0200 Subject: [PATCH 1/7] Use passwords from the accounts file This commit makes it so that if the password in an account in the accounts file is present, then use it. Otherwise ask for the password to the user. --- src/command/command.c | 30 ++++++++++++++++++++++-------- src/config/accounts.c | 12 ++++++++++++ src/config/accounts.h | 1 + src/ui/console.c | 1 + src/xmpp/connection.c | 9 ++++----- src/xmpp/xmpp.h | 3 +-- 6 files changed, 41 insertions(+), 15 deletions(-) diff --git a/src/command/command.c b/src/command/command.c index e8232405..d824ebc5 100644 --- a/src/command/command.c +++ b/src/command/command.c @@ -20,6 +20,7 @@ * */ +#include #include #include #include @@ -68,6 +69,7 @@ typedef struct cmd_t { typedef char*(*autocompleter)(char*, int*); +static void _ask_password(char * passwd); static void _update_presence(const resource_presence_t presence, const char * const show, gchar **args); static gboolean _cmd_set_boolean_preference(gchar *arg, struct cmd_help_t help, @@ -1347,13 +1349,6 @@ _cmd_connect(gchar **args, struct cmd_help_t help) char *lower = g_utf8_strdown(user, -1); char *jid; - status_bar_get_password(); - status_bar_refresh(); - char passwd[21]; - inp_block(); - inp_get_password(passwd); - inp_non_block(); - ProfAccount *account = accounts_get_account(lower); if (account != NULL) { if (account->resource != NULL) { @@ -1361,9 +1356,16 @@ _cmd_connect(gchar **args, struct cmd_help_t help) } else { jid = strdup(account->jid); } + + if (strlen(account->password) == 0) { + account->password = (gchar *) realloc(account->password, 21); + _ask_password(account->password); + } cons_show("Connecting with account %s as %s", account->name, jid); - conn_status = jabber_connect_with_account(account, passwd); + conn_status = jabber_connect_with_account(account); } else { + char passwd[21]; + _ask_password(passwd); jid = strdup(lower); cons_show("Connecting as %s", jid); conn_status = jabber_connect_with_details(jid, passwd, altdomain); @@ -3525,6 +3527,18 @@ _cmd_xa(gchar **args, struct cmd_help_t help) return TRUE; } +// helper function that asks the user for a password and saves it in passwd + +static void +_ask_password(char * passwd) { + assert(passwd != NULL); + status_bar_get_password(); + status_bar_refresh(); + inp_block(); + inp_get_password(passwd); + inp_non_block(); +} + // helper function for status change commands static void diff --git a/src/config/accounts.c b/src/config/accounts.c index 4eb4b8e3..e083fd38 100644 --- a/src/config/accounts.c +++ b/src/config/accounts.c @@ -133,6 +133,7 @@ accounts_add(const char *account_name, const char *altdomain) if (!g_key_file_has_group(accounts, account_name)) { g_key_file_set_boolean(accounts, account_name, "enabled", TRUE); g_key_file_set_string(accounts, account_name, "jid", barejid); + g_key_file_set_string(accounts, account_name, "password", ""); g_key_file_set_string(accounts, account_name, "resource", resource); if (altdomain != NULL) { g_key_file_set_string(accounts, account_name, "server", altdomain); @@ -191,6 +192,16 @@ accounts_get_account(const char * const name) _save_accounts(); } + gchar *password = g_key_file_get_string(accounts, name, "password", NULL); + if (password != NULL) { + account->password = strdup(password); + g_free(password); + } else { + account->password = strdup(""); + g_key_file_set_string(accounts, name, "password", account->password); + _save_accounts(); + } + account->enabled = g_key_file_get_boolean(accounts, name, "enabled", NULL); gchar *server = g_key_file_get_string(accounts, name, "server", NULL); @@ -288,6 +299,7 @@ accounts_free_account(ProfAccount *account) if (account != NULL) { free(account->name); free(account->jid); + free(account->password); free(account->resource); free(account->server); free(account->last_presence); diff --git a/src/config/accounts.h b/src/config/accounts.h index 4c74a523..ba282eac 100644 --- a/src/config/accounts.h +++ b/src/config/accounts.h @@ -28,6 +28,7 @@ typedef struct prof_account_t { gchar *name; gchar *jid; + gchar *password; gchar *resource; gchar *server; gchar *last_presence; diff --git a/src/ui/console.c b/src/ui/console.c index 732fc53b..faa8e2fe 100644 --- a/src/ui/console.c +++ b/src/ui/console.c @@ -793,6 +793,7 @@ cons_show_account(ProfAccount *account) cons_show ("enabled : FALSE"); } cons_show ("jid : %s", account->jid); + cons_show ("password : [redacted]"); if (account->resource != NULL) { cons_show ("resource : %s", account->resource); } diff --git a/src/xmpp/connection.c b/src/xmpp/connection.c index 40a1ea05..a1cb31c4 100644 --- a/src/xmpp/connection.c +++ b/src/xmpp/connection.c @@ -109,21 +109,20 @@ jabber_init(const int disable_tls) } jabber_conn_status_t -jabber_connect_with_account(const ProfAccount * const account, - const char * const passwd) +jabber_connect_with_account(const ProfAccount * const account) { assert(account != NULL); - assert(passwd != NULL); log_info("Connecting using account: %s", account->name); // save account name and password for reconnect saved_account.name = strdup(account->name); - saved_account.passwd = strdup(passwd); + saved_account.passwd = strdup(account->password); // connect with fulljid Jid *jidp = jid_create_from_bare_and_resource(account->jid, account->resource); - jabber_conn_status_t result = _jabber_connect(jidp->fulljid, passwd, account->server); + jabber_conn_status_t result = + _jabber_connect(jidp->fulljid, account->password, account->server); jid_destroy(jidp); return result; diff --git a/src/xmpp/xmpp.h b/src/xmpp/xmpp.h index 61f07e5e..407fe0e2 100644 --- a/src/xmpp/xmpp.h +++ b/src/xmpp/xmpp.h @@ -78,8 +78,7 @@ typedef struct disco_identity_t { void jabber_init(const int disable_tls); jabber_conn_status_t jabber_connect_with_details(const char * const jid, const char * const passwd, const char * const altdomain); -jabber_conn_status_t jabber_connect_with_account(const ProfAccount * const account, - const char * const passwd); +jabber_conn_status_t jabber_connect_with_account(const ProfAccount * const account); void jabber_disconnect(void); void jabber_shutdown(void); void jabber_process_events(void); From ac7ec7f2d182d75ea15c5b07009709f106f6e691 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Senart?= Date: Mon, 14 Oct 2013 21:22:46 +0200 Subject: [PATCH 2/7] Connect to an account on start-up This commit enables connecting to an account on startup which enables the use case of having different pre-configured scripts which start different profanity processes for different accounts. This only makes sense in the light of not supporting many accounts connected per process. --- src/main.c | 4 +++- src/profanity.c | 8 +++++++- src/profanity.h | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/main.c b/src/main.c index 253c9237..6e6de9eb 100644 --- a/src/main.c +++ b/src/main.c @@ -32,6 +32,7 @@ static gboolean disable_tls = FALSE; static gboolean version = FALSE; static char *log = "INFO"; +static char *account_name = ""; int main(int argc, char **argv) @@ -40,6 +41,7 @@ main(int argc, char **argv) { { "version", 'v', 0, G_OPTION_ARG_NONE, &version, "Show version information", NULL }, { "disable-tls", 'd', 0, G_OPTION_ARG_NONE, &disable_tls, "Disable TLS", NULL }, + { "account", 'a', 0, G_OPTION_ARG_STRING, &account_name, "Auto connect to an account on start-up" }, { "log",'l', 0, G_OPTION_ARG_STRING, &log, "Set logging levels, DEBUG, INFO (default), WARN, ERROR", "LEVEL" }, { NULL } }; @@ -77,7 +79,7 @@ main(int argc, char **argv) return 0; } - prof_run(disable_tls, log); + prof_run(disable_tls, log, account_name); return 0; } diff --git a/src/profanity.c b/src/profanity.c index 4c621ffa..9802d63c 100644 --- a/src/profanity.c +++ b/src/profanity.c @@ -58,7 +58,7 @@ static void _create_directories(void); static gboolean idle = FALSE; void -prof_run(const int disable_tls, char *log_level) +prof_run(const int disable_tls, char *log_level, char *account_name) { _init(disable_tls, log_level); log_info("Starting main event loop"); @@ -70,6 +70,12 @@ prof_run(const int disable_tls, char *log_level) char inp[INP_WIN_MAX]; int size = 0; + if (strlen(account_name) != 0) { + char *cmd = "/connect"; + snprintf(inp, sizeof(inp), "%s %s", cmd, account_name); + cmd_execute(cmd, inp); + } + while(cmd_result == TRUE) { wint_t ch = ERR; size = 0; diff --git a/src/profanity.h b/src/profanity.h index 0cd59fd0..3dac6c3e 100644 --- a/src/profanity.h +++ b/src/profanity.h @@ -26,7 +26,7 @@ #include "resource.h" #include "xmpp/xmpp.h" -void prof_run(const int disable_tls, char *log_level); +void prof_run(const int disable_tls, char *log_level, char *account_name); void prof_handle_login_success(const char *jid, const char *altdomain); void prof_handle_login_account_success(char *account_name); From 99d3322834c337bd6de755665acc08472769b5bd Mon Sep 17 00:00:00 2001 From: James Booth Date: Thu, 7 Nov 2013 22:15:43 +0000 Subject: [PATCH 3/7] Added MAX_PASSWORD_SIZE set to 64 fixes #245 --- src/command/command.c | 2 +- src/config/accounts.h | 2 ++ src/ui/inputwin.c | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/command/command.c b/src/command/command.c index 35bcd4f7..296cf38d 100644 --- a/src/command/command.c +++ b/src/command/command.c @@ -3530,7 +3530,7 @@ _cmd_xa(gchar **args, struct cmd_help_t help) static char * _ask_password(void) { - char *passwd = malloc(sizeof(char) * 21); + char *passwd = malloc(sizeof(char) * (MAX_PASSWORD_SIZE + 1)); status_bar_get_password(); status_bar_refresh(); inp_block(); diff --git a/src/config/accounts.h b/src/config/accounts.h index ba282eac..f28067f1 100644 --- a/src/config/accounts.h +++ b/src/config/accounts.h @@ -23,6 +23,8 @@ #ifndef ACCOUNTS_H #define ACCOUNTS_H +#define MAX_PASSWORD_SIZE 64 + #include "common.h" typedef struct prof_account_t { diff --git a/src/ui/inputwin.c b/src/ui/inputwin.c index dfcb533d..d5b882d7 100644 --- a/src/ui/inputwin.c +++ b/src/ui/inputwin.c @@ -35,6 +35,7 @@ #include "command/command.h" #include "common.h" +#include "config/accounts.h" #include "config/preferences.h" #include "config/theme.h" #include "log.h" @@ -207,7 +208,7 @@ inp_get_password(char *passwd) _clear_input(); _inp_win_refresh(); noecho(); - mvwgetnstr(inp_win, 0, 1, passwd, 20); + mvwgetnstr(inp_win, 0, 1, passwd, MAX_PASSWORD_SIZE); wmove(inp_win, 0, 0); echo(); status_bar_clear(); From 2fa8da493e6f5f0afb1fe703c00dcd4041d8410d Mon Sep 17 00:00:00 2001 From: James Booth Date: Thu, 7 Nov 2013 22:20:30 +0000 Subject: [PATCH 4/7] Use correct type in account rename for priorities fixes #250 --- src/config/accounts.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/config/accounts.c b/src/config/accounts.c index 3150686b..ff140769 100644 --- a/src/config/accounts.c +++ b/src/config/accounts.c @@ -350,15 +350,15 @@ accounts_rename(const char * const account_name, const char * const new_name) g_key_file_get_boolean(accounts, account_name, "enabled", NULL)); g_key_file_set_integer(accounts, new_name, "priority.online", - g_key_file_get_boolean(accounts, account_name, "priority.online", NULL)); + g_key_file_get_integer(accounts, account_name, "priority.online", NULL)); g_key_file_set_integer(accounts, new_name, "priority.chat", - g_key_file_get_boolean(accounts, account_name, "priority.chat", NULL)); + g_key_file_get_integer(accounts, account_name, "priority.chat", NULL)); g_key_file_set_integer(accounts, new_name, "priority.away", - g_key_file_get_boolean(accounts, account_name, "priority.away", NULL)); + g_key_file_get_integer(accounts, account_name, "priority.away", NULL)); g_key_file_set_integer(accounts, new_name, "priority.xa", - g_key_file_get_boolean(accounts, account_name, "priority.xa", NULL)); + g_key_file_get_integer(accounts, account_name, "priority.xa", NULL)); g_key_file_set_integer(accounts, new_name, "priority.dnd", - g_key_file_get_boolean(accounts, account_name, "priority.dnd", NULL)); + g_key_file_get_integer(accounts, account_name, "priority.dnd", NULL)); // copy other string properties int i; From 2b0108e6cc21e0ac0da62b105e36b7842edda22d Mon Sep 17 00:00:00 2001 From: James Booth Date: Thu, 7 Nov 2013 23:04:12 +0000 Subject: [PATCH 5/7] Allow "account" setting in [connection] to autconnect the account closes #251 --- src/command/command.c | 33 ++++++++++++++++++++++++++++++++- src/config/preferences.c | 4 ++++ src/config/preferences.h | 3 ++- src/profanity.c | 4 ++++ src/ui/console.c | 10 ++++++++++ src/ui/ui.h | 1 + 6 files changed, 53 insertions(+), 2 deletions(-) diff --git a/src/command/command.c b/src/command/command.c index 296cf38d..95f16f93 100644 --- a/src/command/command.c +++ b/src/command/command.c @@ -94,6 +94,7 @@ static int _strtoi(char *str, int *saveptr, int min, int max); static gboolean _cmd_about(gchar **args, struct cmd_help_t help); static gboolean _cmd_account(gchar **args, struct cmd_help_t help); static gboolean _cmd_autoaway(gchar **args, struct cmd_help_t help); +static gboolean _cmd_autoconnect(gchar **args, struct cmd_help_t help); static gboolean _cmd_autoping(gchar **args, struct cmd_help_t help); static gboolean _cmd_away(gchar **args, struct cmd_help_t help); static gboolean _cmd_beep(gchar **args, struct cmd_help_t help); @@ -579,6 +580,16 @@ static struct cmd_t command_defs[] = "Switch on or off the ascii logo on start up and when the /about command is called.", NULL } } }, + { "/autoconnect", + _cmd_autoconnect, parse_args, 0, 1, cons_autoconnect_setting, + { "/autoconnect [account]", "Set account to autoconnect with.", + { "/autoconnect [account]", + "----------------------", + "Set the account to autoconnect with.", + "Will be overridden by any command line options specified.", + "Passing no account will clear the setting.", + NULL } } }, + { "/vercheck", _cmd_vercheck, parse_args, 0, 1, NULL, { "/vercheck [on|off]", "Check for a new release.", @@ -1302,6 +1313,13 @@ _cmd_complete_parameters(char *input, int *size) return; } + result = autocomplete_param_with_func(input, size, "/autoconnect", accounts_find_enabled); + if (result != NULL) { + inp_replace_input(input, result, size); + g_free(result); + return; + } + gchar *cmds[] = { "/help", "/prefs", "/log", "/disco", "/close", "/wins" }; Autocomplete completers[] = { help_ac, prefs_ac, log_ac, disco_ac, close_ac, wins_ac }; @@ -1809,7 +1827,7 @@ _cmd_help(gchar **args, struct cmd_help_t help) _cmd_show_filtered_help("Service discovery commands", filter, ARRAY_SIZE(filter)); } else if (strcmp(args[0], "settings") == 0) { - gchar *filter[] = { "/account", "/autoaway", "/autoping", "/beep", + gchar *filter[] = { "/account", "/autoaway", "/autoping", "/autoconnect", "/beep", "/chlog", "/flash", "/gone", "/grlog", "/history", "/intype", "/log", "/mouse", "/notify", "/outtype", "/prefs", "/priority", "/reconnect", "/roster", "/splash", "/states", "/statuses", "/theme", @@ -3447,6 +3465,19 @@ _cmd_splash(gchar **args, struct cmd_help_t help) "Splash screen", PREF_SPLASH); } +static gboolean +_cmd_autoconnect(gchar **args, struct cmd_help_t help) +{ + if (args[0] == NULL) { + prefs_set_string(PREF_CONNECT_ACCOUNT, NULL); + cons_show("Autoconnect account disabled."); + } else { + prefs_set_string(PREF_CONNECT_ACCOUNT, args[0]); + cons_show("Autoconnect account set to: %s.", args[0]); + } + return true; +} + static gboolean _cmd_chlog(gchar **args, struct cmd_help_t help) { diff --git a/src/config/preferences.c b/src/config/preferences.c index 1d417e41..18f10dee 100644 --- a/src/config/preferences.c +++ b/src/config/preferences.c @@ -309,6 +309,8 @@ _get_group(preference_t pref) case PREF_AUTOAWAY_MODE: case PREF_AUTOAWAY_MESSAGE: return "presence"; + case PREF_CONNECT_ACCOUNT: + return "connection"; default: return NULL; } @@ -361,6 +363,8 @@ _get_key(preference_t pref) return "autoaway.mode"; case PREF_AUTOAWAY_MESSAGE: return "autoaway.message"; + case PREF_CONNECT_ACCOUNT: + return "account"; default: return NULL; } diff --git a/src/config/preferences.h b/src/config/preferences.h index cb1f9204..5affe002 100644 --- a/src/config/preferences.h +++ b/src/config/preferences.h @@ -56,7 +56,8 @@ typedef enum { PREF_GRLOG, PREF_AUTOAWAY_CHECK, PREF_AUTOAWAY_MODE, - PREF_AUTOAWAY_MESSAGE + PREF_AUTOAWAY_MESSAGE, + PREF_CONNECT_ACCOUNT } preference_t; void prefs_load(void); diff --git a/src/profanity.c b/src/profanity.c index 38be5531..116e8b9c 100644 --- a/src/profanity.c +++ b/src/profanity.c @@ -76,6 +76,10 @@ prof_run(const int disable_tls, char *log_level, char *account_name) char *cmd = "/connect"; snprintf(inp, sizeof(inp), "%s %s", cmd, account_name); _process_input(inp); + } else if (prefs_get_string(PREF_CONNECT_ACCOUNT) != NULL) { + char *cmd = "/connect"; + snprintf(inp, sizeof(inp), "%s %s", cmd, prefs_get_string(PREF_CONNECT_ACCOUNT)); + _process_input(inp); } while(cmd_result == TRUE) { diff --git a/src/ui/console.c b/src/ui/console.c index 1de7cf51..bbf0cef6 100644 --- a/src/ui/console.c +++ b/src/ui/console.c @@ -942,6 +942,15 @@ cons_splash_setting(void) cons_show("Splash screen (/splash) : OFF"); } +void +cons_autoconnect_setting(void) +{ + if (prefs_get_string(PREF_CONNECT_ACCOUNT) != NULL) + cons_show("Autoconnect (/autoconnect) : %s", prefs_get_string(PREF_CONNECT_ACCOUNT)); + else + cons_show("Autoconnect (/autoconnect) : OFF"); +} + void cons_vercheck_setting(void) { @@ -1218,6 +1227,7 @@ cons_show_connection_prefs(void) cons_show(""); cons_reconnect_setting(); cons_autoping_setting(); + cons_autoconnect_setting(); wins_refresh_console(); cons_alert(); diff --git a/src/ui/ui.h b/src/ui/ui.h index 7fff0703..1fa932b7 100644 --- a/src/ui/ui.h +++ b/src/ui/ui.h @@ -216,6 +216,7 @@ void cons_autoaway_setting(void); void cons_reconnect_setting(void); void cons_autoping_setting(void); void cons_priority_setting(void); +void cons_autoconnect_setting(void); // status bar actions void status_bar_refresh(void); From be653667e4d250c7ec28f2eab5026e63e95f5453 Mon Sep 17 00:00:00 2001 From: James Booth Date: Thu, 7 Nov 2013 23:36:04 +0000 Subject: [PATCH 6/7] Added /account set password --- src/command/command.c | 5 +++++ src/config/accounts.c | 9 +++++++++ src/config/accounts.h | 1 + 3 files changed, 15 insertions(+) diff --git a/src/command/command.c b/src/command/command.c index 95f16f93..f7737464 100644 --- a/src/command/command.c +++ b/src/command/command.c @@ -759,6 +759,7 @@ static struct cmd_t command_defs[] = "online|chat|away", "|xa|dnd : Priority for the specified presence.", "resource : The resource to be used.", + "password : Password for the account, note this is currently stored in plaintext if set.", "muc : The default MUC chat service to use.", "nick : The default nickname to use when joining chat rooms.", "", @@ -1518,6 +1519,10 @@ _cmd_account(gchar **args, struct cmd_help_t help) accounts_set_resource(account_name, value); cons_show("Updated resource for account %s: %s", account_name, value); cons_show(""); + } else if (strcmp(property, "password") == 0) { + accounts_set_password(account_name, value); + cons_show("Updated password for account %s", account_name); + cons_show(""); } else if (strcmp(property, "muc") == 0) { accounts_set_muc_service(account_name, value); cons_show("Updated muc service for account %s: %s", account_name, value); diff --git a/src/config/accounts.c b/src/config/accounts.c index ff140769..6bfc7bef 100644 --- a/src/config/accounts.c +++ b/src/config/accounts.c @@ -434,6 +434,15 @@ accounts_set_resource(const char * const account_name, const char * const value) } } +void +accounts_set_password(const char * const account_name, const char * const value) +{ + if (accounts_account_exists(account_name)) { + g_key_file_set_string(accounts, account_name, "password", value); + _save_accounts(); + } +} + void accounts_set_muc_service(const char * const account_name, const char * const value) { diff --git a/src/config/accounts.h b/src/config/accounts.h index f28067f1..118b5c80 100644 --- a/src/config/accounts.h +++ b/src/config/accounts.h @@ -65,6 +65,7 @@ gboolean accounts_account_exists(const char * const account_name); void accounts_set_jid(const char * const account_name, const char * const value); void accounts_set_server(const char * const account_name, const char * const value); void accounts_set_resource(const char * const account_name, const char * const value); +void accounts_set_password(const char * const account_name, const char * const value); void accounts_set_muc_service(const char * const account_name, const char * const value); void accounts_set_muc_nick(const char * const account_name, const char * const value); void accounts_set_last_presence(const char * const account_name, const char * const value); From c5f76721ce9d10b127d54e127ac34e555c749465 Mon Sep 17 00:00:00 2001 From: James Booth Date: Sun, 10 Nov 2013 18:48:55 +0000 Subject: [PATCH 7/7] Fixed compile error for -Wduplicate-decl-specifier on OSX --- src/contact.h | 2 +- src/ui/core.c | 4 ++-- src/xmpp/roster.c | 2 +- src/xmpp/xmpp.h | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/contact.h b/src/contact.h index e71e0f7d..20c0e3dd 100644 --- a/src/contact.h +++ b/src/contact.h @@ -35,7 +35,7 @@ gboolean p_contact_remove_resource(PContact contact, const char * const resource void p_contact_free(PContact contact); const char* p_contact_barejid(PContact contact); const char* p_contact_name(PContact contact); -const char * p_contact_name_or_jid(const PContact contact); +const char* p_contact_name_or_jid(const PContact contact); const char* p_contact_presence(PContact contact); const char* p_contact_status(PContact contact); const char* p_contact_subscription(const PContact contact); diff --git a/src/ui/core.c b/src/ui/core.c index 2249a944..a6c54faf 100644 --- a/src/ui/core.c +++ b/src/ui/core.c @@ -965,8 +965,8 @@ ui_new_chat_win(const char * const to) if (contact != NULL) { if (strcmp(p_contact_presence(contact), "offline") == 0) { - const char const *show = p_contact_presence(contact); - const char const *status = p_contact_status(contact); + const char * const show = p_contact_presence(contact); + const char * const status = p_contact_status(contact); _show_status_string(window, to, show, status, NULL, "--", "offline"); } } diff --git a/src/xmpp/roster.c b/src/xmpp/roster.c index c073464d..5fbb7be7 100644 --- a/src/xmpp/roster.c +++ b/src/xmpp/roster.c @@ -518,7 +518,7 @@ roster_barejid_from_name(const char * const name) } PContact -roster_get_contact(const char const *barejid) +roster_get_contact(const char * const barejid) { return g_hash_table_lookup(contacts, barejid); } diff --git a/src/xmpp/xmpp.h b/src/xmpp/xmpp.h index 407fe0e2..f1b3ba6c 100644 --- a/src/xmpp/xmpp.h +++ b/src/xmpp/xmpp.h @@ -127,7 +127,7 @@ void caps_close(void); void roster_clear(void); gboolean roster_update_presence(const char * const barejid, Resource *resource, GDateTime *last_activity); -PContact roster_get_contact(const char const *barejid); +PContact roster_get_contact(const char * const barejid); gboolean roster_contact_offline(const char * const barejid, const char * const resource, const char * const status); void roster_reset_search_attempts(void);