1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-11-03 19:37:16 -05:00

Add ability to script commands after connect

This commit is contained in:
James Booth 2015-10-15 01:19:24 +01:00
parent fb60a755e5
commit 904a5a81cf
18 changed files with 230 additions and 25 deletions

View File

@ -35,7 +35,8 @@ core_sources = \
src/config/tlscerts.c src/config/tlscerts.h \
src/config/account.c src/config/account.h \
src/config/preferences.c src/config/preferences.h \
src/config/theme.c src/config/theme.h
src/config/theme.c src/config/theme.h \
src/config/scripts.c src/config/scripts.h
unittest_sources = \
src/contact.c src/contact.h src/common.c \
@ -61,6 +62,7 @@ unittest_sources = \
src/config/tlscerts.c src/config/tlscerts.h \
src/config/preferences.c src/config/preferences.h \
src/config/theme.c src/config/theme.h \
src/config/scripts.c src/config/scripts.h \
src/window_list.c src/window_list.h \
src/event/server_events.c src/event/server_events.h \
src/event/client_events.c src/event/client_events.h \

View File

@ -1488,12 +1488,14 @@ static struct cmd_t command_defs[] =
"/account set <account> nick <nick>",
"/account set <account> otr <policy>",
"/account set <account> pgpkeyid <pgpkeyid>",
"/account set <account> startscript <script>",
"/account clear <account> password",
"/account clear <account> eval_password",
"/account clear <account> server",
"/account clear <account> port",
"/account clear <account> otr",
"/account clear <account> pgpkeyid")
"/account clear <account> pgpkeyid",
"/account clear <account> startscript")
CMD_DESC(
"Commands for creating and managing accounts. "
"Calling with no arguments will display information for the current account.")
@ -1520,12 +1522,14 @@ static struct cmd_t command_defs[] =
{ "set <account> nick <nick>", "The default nickname to use when joining chat rooms." },
{ "set <account> otr <policy>", "Override global OTR policy for this account, see /otr." },
{ "set <account> pgpkeyid <pgpkeyid>", "Set the ID of the PGP key for this account, see /pgp." },
{ "set <account> startscript <script>", "Set the script to execute after connecting." },
{ "clear <account> server", "Remove the server 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> eval_password", "Remove the eval_password 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." })
CMD_EXAMPLES(
"/account add me",
"/account set me jid me@chatty",
@ -1915,6 +1919,7 @@ cmd_init(void)
autocomplete_add(account_set_ac, "nick");
autocomplete_add(account_set_ac, "otr");
autocomplete_add(account_set_ac, "pgpkeyid");
autocomplete_add(account_set_ac, "startscript");
account_clear_ac = autocomplete_new();
autocomplete_add(account_clear_ac, "password");
@ -1923,6 +1928,7 @@ cmd_init(void)
autocomplete_add(account_clear_ac, "port");
autocomplete_add(account_clear_ac, "otr");
autocomplete_add(account_clear_ac, "pgpkeyid");
autocomplete_add(account_clear_ac, "startscript");
account_default_ac = autocomplete_new();
autocomplete_add(account_default_ac, "set");

View File

@ -586,6 +586,9 @@ cmd_account(ProfWin *window, const char * const command, gchar **args)
cons_show("PGP support is not included in this build.");
#endif
cons_show("");
} else if (strcmp(property, "startscript") == 0) {
accounts_set_script_start(account_name, value);
cons_show("Updated start script for account %s: %s", account_name, value);
} else if (valid_resource_presence_string(property)) {
int intval;
char *err_msg = NULL;
@ -668,6 +671,10 @@ cmd_account(ProfWin *window, const char * const command, gchar **args)
accounts_clear_pgp_keyid(account_name);
cons_show("Removed PGP key ID for account %s", account_name);
cons_show("");
} else if (strcmp(property, "startscript") == 0) {
accounts_clear_script_start(account_name);
cons_show("Removed start script for account %s", account_name);
cons_show("");
} else {
cons_show("Invalid property: %s", property);
cons_show("");

View File

@ -51,7 +51,7 @@ account_new(const gchar * const name, const gchar * const jid,
int priority_away, int priority_xa, int priority_dnd,
const gchar * const muc_service, const gchar * const muc_nick,
const gchar * const otr_policy, GList *otr_manual, GList *otr_opportunistic,
GList *otr_always, const gchar * const pgp_keyid)
GList *otr_always, const gchar * const pgp_keyid, const char *const startscript)
{
ProfAccount *new_account = malloc(sizeof(ProfAccount));
@ -150,6 +150,12 @@ account_new(const gchar * const name, const gchar * const jid,
new_account->pgp_keyid = NULL;
}
if (startscript != NULL) {
new_account->startscript = strdup(startscript);
} else {
new_account->startscript = NULL;
}
return new_account;
}
@ -217,6 +223,7 @@ account_free(ProfAccount *account)
free(account->muc_nick);
free(account->otr_policy);
free(account->pgp_keyid);
free(account->startscript);
g_list_free_full(account->otr_manual, g_free);
g_list_free_full(account->otr_opportunistic, g_free);
g_list_free_full(account->otr_always, g_free);

View File

@ -60,6 +60,7 @@ typedef struct prof_account_t {
GList *otr_opportunistic;
GList *otr_always;
gchar *pgp_keyid;
gchar *startscript;
} ProfAccount;
ProfAccount* account_new(const gchar * const name, const gchar * const jid,
@ -69,7 +70,7 @@ ProfAccount* account_new(const gchar * const name, const gchar * const jid,
int priority_away, int priority_xa, int priority_dnd,
const gchar * const muc_service, const gchar * const muc_nick,
const gchar * const otr_policy, GList *otr_manual, GList *otr_opportunistic,
GList *otr_always, const gchar * const pgp_keyid);
GList *otr_always, const gchar * const pgp_keyid, const char *const startscript);
char* account_create_full_jid(ProfAccount *account);
gboolean account_eval_password(ProfAccount *account);
void account_free(ProfAccount *account);

View File

@ -264,11 +264,16 @@ accounts_get_account(const char * const name)
pgp_keyid = g_key_file_get_string(accounts, name, "pgp.keyid", NULL);
}
gchar *startscript = NULL;
if (g_key_file_has_key(accounts, name, "script.start", NULL)) {
startscript = g_key_file_get_string(accounts, name, "script.start", NULL);
}
ProfAccount *new_account = account_new(name, jid, password, eval_password, enabled,
server, port, resource, last_presence, login_presence,
priority_online, priority_chat, priority_away, priority_xa,
priority_dnd, muc_service, muc_nick, otr_policy, otr_manual,
otr_opportunistic, otr_always, pgp_keyid);
otr_opportunistic, otr_always, pgp_keyid, startscript);
g_free(jid);
g_free(password);
@ -281,6 +286,7 @@ accounts_get_account(const char * const name)
g_free(muc_nick);
g_free(otr_policy);
g_free(pgp_keyid);
g_free(startscript);
return new_account;
}
@ -347,7 +353,8 @@ accounts_rename(const char * const account_name, const char * const new_name)
"otr.opportunistic",
"otr.always",
"pgp.keyid",
"last.activity"
"last.activity",
"script.start"
};
int i;
@ -461,6 +468,15 @@ 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)
{
if (accounts_account_exists(account_name)) {
g_key_file_set_string(accounts, account_name, "script.start", value);
_save_accounts();
}
}
void
accounts_clear_password(const char * const account_name)
{
@ -506,6 +522,14 @@ accounts_clear_pgp_keyid(const char * const account_name)
}
}
void
accounts_clear_script_start(const char * const account_name)
{
if (accounts_account_exists(account_name)) {
g_key_file_remove_key(accounts, account_name, "script.start", NULL);
_save_accounts();
}
}
void
accounts_clear_otr(const char * const account_name)
{

View File

@ -82,12 +82,14 @@ void accounts_set_priority_all(const char * const account_name, const gint value
gint accounts_get_priority_for_presence_type(const char * const account_name,
resource_presence_t presence_type);
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_clear_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_port(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_script_start(const char * const account_name);
void accounts_add_otr_policy(const char * const account_name, const char * const contact_jid, const char * const policy);
#endif

106
src/config/scripts.c Normal file
View File

@ -0,0 +1,106 @@
/*
* scripts.c
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*
* Profanity is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Profanity is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Profanity. If not, see <http://www.gnu.org/licenses/>.
*
* In addition, as a special exception, the copyright holders give permission to
* link the code of portions of this program with the OpenSSL library under
* certain conditions as described in each individual source file, and
* distribute linked combinations including the two.
*
* You must obey the GNU General Public License in all respects for all of the
* code used other than OpenSSL. If you modify file(s) with this exception, you
* may extend this exception to your version of the file(s), but you are not
* obligated to do so. If you do not wish to do so, delete this exception
* statement from your version. If you delete this exception statement from all
* source files in the program, then also delete it here.
*
*/
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <sys/stat.h>
#include <glib.h>
#include <glib/gstdio.h>
#include "common.h"
#include "log.h"
#include "window_list.h"
#include "command/command.h"
#include "ui/ui.h"
void
scripts_init(void)
{
gchar *data_home = xdg_get_data_home();
GString *scriptsdir = g_string_new(data_home);
free(data_home);
g_string_append(scriptsdir, "/profanity/scripts");
// mkdir if doesn't exist
errno = 0;
int res = g_mkdir_with_parents(scriptsdir->str, S_IRWXU);
if (res == -1) {
char *errmsg = strerror(errno);
if (errmsg) {
log_error("Error creating directory: %s, %s", scriptsdir->str, errmsg);
} else {
log_error("Error creating directory: %s", scriptsdir->str);
}
}
}
gboolean
scripts_exec(const char *const script)
{
gchar *data_home = xdg_get_data_home();
GString *scriptpath = g_string_new(data_home);
free(data_home);
g_string_append(scriptpath, "/profanity/scripts/");
g_string_append(scriptpath, script);
FILE *scriptfile = g_fopen(scriptpath->str, "r");
if (!scriptfile) {
log_info("Script not found: %s", scriptpath->str);
g_string_free(scriptpath, TRUE);
return FALSE;
}
g_string_free(scriptpath, TRUE);
char * line = NULL;
size_t len = 0;
ssize_t read;
while ((read = getline(&line, &len, scriptfile)) != -1) {
ProfWin *win = wins_get_current();
cmd_process_input(win, line);
jabber_process_events(10);
ui_update();
}
fclose(scriptfile);
if (line) free(line);
return TRUE;
}

38
src/config/scripts.h Normal file
View File

@ -0,0 +1,38 @@
/*
* scripts.h
*
* Copyright (C) 2012 - 2015 James Booth <boothj5@gmail.com>
*
* This file is part of Profanity.
*
* Profanity is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Profanity is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Profanity. If not, see <http://www.gnu.org/licenses/>.
*
* In addition, as a special exception, the copyright holders give permission to
* link the code of portions of this program with the OpenSSL library under
* certain conditions as described in each individual source file, and
* distribute linked combinations including the two.
*
* You must obey the GNU General Public License in all respects for all of the
* code used other than OpenSSL. If you modify file(s) with this exception, you
* may extend this exception to your version of the file(s), but you are not
* obligated to do so. If you do not wish to do so, delete this exception
* statement from your version. If you delete this exception statement from all
* source files in the program, then also delete it here.
*
*/
#include <glib.h>
void scripts_init(void);
gboolean scripts_exec(const char *const script);

View File

@ -43,6 +43,7 @@
#include "muc.h"
#include "config/preferences.h"
#include "config/account.h"
#include "config/scripts.h"
#include "roster_list.h"
#include "window_list.h"
#include "config/tlscerts.h"
@ -84,6 +85,11 @@ sv_ev_login_account_success(char *account_name, int secured)
g_list_free(curr);
log_info("%s logged in successfully", account->jid);
if (account->startscript) {
scripts_exec(account->startscript);
}
account_free(account);
}

View File

@ -51,6 +51,7 @@
#include "config/accounts.h"
#include "config/preferences.h"
#include "config/theme.h"
#include "config/scripts.h"
#include "command/command.h"
#include "common.h"
#include "contact.h"
@ -331,6 +332,7 @@ _init(const int disable_tls, char *log_level)
roster_init();
muc_init();
tlscerts_init();
scripts_init();
#ifdef HAVE_LIBOTR
otr_init();
#endif

View File

@ -713,7 +713,9 @@ cons_show_account(ProfAccount *account)
if (account->login_presence) {
cons_show ("Login presence : %s", account->login_presence);
}
if (account->startscript) {
cons_show ("Start script : %s", account->startscript);
}
if (account->otr_policy) {
cons_show ("OTR policy : %s", account->otr_policy);
}

View File

@ -482,6 +482,8 @@ _connection_handler(xmpp_conn_t * const conn,
// login success
if (status == XMPP_CONN_CONNECT) {
log_debug("Connection handler: XMPP_CONN_CONNECT");
jabber_conn.conn_status = JABBER_CONNECTED;
int secured = xmpp_conn_is_secured(jabber_conn.conn);
// logged in with account
@ -520,8 +522,6 @@ _connection_handler(xmpp_conn_t * const conn,
iq_enable_carbons();
}
jabber_conn.conn_status = JABBER_CONNECTED;
if (prefs_get_reconnect() != 0) {
if (reconnect_timer) {
g_timer_destroy(reconnect_timer);

View File

@ -125,6 +125,7 @@ void accounts_set_last_presence(const char * const account_name, const char * co
void accounts_set_last_status(const char * const account_name, const char * const value) {}
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_script_start(const char * const account_name, const char * const value) {}
void accounts_set_login_presence(const char * const account_name, const char * const value)
{
@ -191,4 +192,5 @@ void accounts_clear_server(const char * const account_name) {}
void accounts_clear_port(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_script_start(const char * const account_name) {}
void accounts_add_otr_policy(const char * const account_name, const char * const contact_jid, const char * const policy) {}

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)
{
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);
TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
gchar *args[] = { NULL };
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 };
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);
TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
expect_any(accounts_get_account, name);
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 };
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);
TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
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 };
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);
TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
expect_any(accounts_account_exists, account_name);
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) {
gchar *args[] = { "set", "a_account", "password", "a_password", NULL };
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);
TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
expect_any(accounts_account_exists, account_name);
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) {
gchar *args[] = { "set", "a_account", "eval_password", "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);
TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
expect_any(accounts_account_exists, account_name);
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
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, 10, 10, 10, 10, 10, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
will_return(jabber_get_account_name, "a_account");
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 };
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);
TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
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 };
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);
TRUE, NULL, 0, "laptop", NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
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 };
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);
TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
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";
gchar *args[] = { room, "nick", nick, 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);
TRUE, NULL, 0, "laptop", NULL, NULL, 0, 0, 0, 0, 0, account_service, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
muc_init();
@ -95,7 +95,7 @@ void cmd_join_uses_supplied_nick(void **state)
char *nick = "bob";
gchar *args[] = { room, "nick", nick, 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);
TRUE, NULL, 0, "laptop", NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
muc_init();
@ -120,7 +120,7 @@ void cmd_join_uses_account_nick_when_not_supplied(void **state)
char *account_nick = "a_nick";
gchar *args[] = { room, 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);
TRUE, NULL, 0, "laptop", NULL, NULL, 0, 0, 0, 0, 0, NULL, account_nick, NULL, NULL, NULL, NULL, NULL, NULL);
muc_init();
@ -148,7 +148,7 @@ void cmd_join_uses_password_when_supplied(void **state)
char *expected_room = "room@a_service";
gchar *args[] = { room, "password", password, 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);
TRUE, NULL, 0, "laptop", NULL, NULL, 0, 0, 0, 0, 0, account_service, account_nick, NULL, NULL, NULL, NULL, NULL, NULL);
muc_init();

View File

@ -209,7 +209,7 @@ void cmd_otr_gen_generates_key_for_connected_account(void **state)
gchar *args[] = { "gen", NULL };
char *account_name = "myaccount";
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);
TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
will_return(jabber_get_connection_status, JABBER_CONNECTED);
will_return(jabber_get_account_name, account_name);