mirror of
https://github.com/profanity-im/profanity.git
synced 2024-11-03 19:37:16 -05:00
Renamed account_add_login -> account_add, added comments
This commit is contained in:
parent
e9ce6b94ec
commit
5cca57f6fb
@ -135,13 +135,15 @@ accounts_reset_enabled_search(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
accounts_add_login(const char *account_name, const char *altdomain)
|
accounts_add(const char *account_name, const char *altdomain)
|
||||||
{
|
{
|
||||||
|
// assume account name is barejid, use default resource
|
||||||
const char *barejid = account_name;
|
const char *barejid = account_name;
|
||||||
const char *resource = NULL;
|
const char *resource = "profanity";
|
||||||
|
|
||||||
|
// check if account name contains resourcepart and split
|
||||||
|
// into barejid and resourcepart if so
|
||||||
Jid *jid = jid_create(account_name);
|
Jid *jid = jid_create(account_name);
|
||||||
|
|
||||||
if (jid != NULL) {
|
if (jid != NULL) {
|
||||||
barejid = jid->barejid;
|
barejid = jid->barejid;
|
||||||
resource = jid->resourcepart;
|
resource = jid->resourcepart;
|
||||||
@ -151,12 +153,7 @@ accounts_add_login(const char *account_name, const char *altdomain)
|
|||||||
if (!g_key_file_has_group(accounts, account_name)) {
|
if (!g_key_file_has_group(accounts, account_name)) {
|
||||||
g_key_file_set_boolean(accounts, account_name, "enabled", TRUE);
|
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, "jid", barejid);
|
||||||
if (resource != NULL) {
|
g_key_file_set_string(accounts, account_name, "resource", resource);
|
||||||
g_key_file_set_string(accounts, account_name, "resource", resource);
|
|
||||||
} else {
|
|
||||||
g_key_file_set_string(accounts, account_name, "resource", "profanity");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (altdomain != NULL) {
|
if (altdomain != NULL) {
|
||||||
g_key_file_set_string(accounts, account_name, "server", altdomain);
|
g_key_file_set_string(accounts, account_name, "server", altdomain);
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ char * accounts_find_all(char *prefix);
|
|||||||
char * accounts_find_enabled(char *prefix);
|
char * accounts_find_enabled(char *prefix);
|
||||||
void accounts_reset_all_search(void);
|
void accounts_reset_all_search(void);
|
||||||
void accounts_reset_enabled_search(void);
|
void accounts_reset_enabled_search(void);
|
||||||
void accounts_add_login(const char *jid, const char *altdomain);
|
void accounts_add(const char *jid, const char *altdomain);
|
||||||
gchar** accounts_get_list(void);
|
gchar** accounts_get_list(void);
|
||||||
ProfAccount* accounts_get_account(const char * const name);
|
ProfAccount* accounts_get_account(const char * const name);
|
||||||
void accounts_free_account(ProfAccount *account);
|
void accounts_free_account(ProfAccount *account);
|
||||||
|
@ -1079,7 +1079,7 @@ _cmd_account(gchar **args, struct cmd_help_t help)
|
|||||||
if (account_name == NULL) {
|
if (account_name == NULL) {
|
||||||
cons_show("Usage: %s", help.usage);
|
cons_show("Usage: %s", help.usage);
|
||||||
} else {
|
} else {
|
||||||
accounts_add_login(account_name, NULL);
|
accounts_add(account_name, NULL);
|
||||||
cons_show("Account created.");
|
cons_show("Account created.");
|
||||||
cons_show("");
|
cons_show("");
|
||||||
}
|
}
|
||||||
|
@ -224,7 +224,7 @@ prof_handle_login_success(const char *jid, const char *altdomain)
|
|||||||
status_bar_print_message(jid);
|
status_bar_print_message(jid);
|
||||||
status_bar_refresh();
|
status_bar_refresh();
|
||||||
|
|
||||||
accounts_add_login(jid, altdomain);
|
accounts_add(jid, altdomain);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
Reference in New Issue
Block a user