1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Added pgpkeyid account setting, send signed presence

This commit is contained in:
James Booth 2015-03-23 23:38:06 +00:00
parent 8a5d1fef29
commit 475dfebd97
16 changed files with 182 additions and 19 deletions

View File

@ -1369,6 +1369,7 @@ cmd_init(void)
autocomplete_add(account_set_ac, "muc"); autocomplete_add(account_set_ac, "muc");
autocomplete_add(account_set_ac, "nick"); autocomplete_add(account_set_ac, "nick");
autocomplete_add(account_set_ac, "otr"); autocomplete_add(account_set_ac, "otr");
autocomplete_add(account_set_ac, "pgpkeyid");
account_clear_ac = autocomplete_new(); account_clear_ac = autocomplete_new();
autocomplete_add(account_clear_ac, "password"); autocomplete_add(account_clear_ac, "password");
@ -1376,6 +1377,7 @@ cmd_init(void)
autocomplete_add(account_clear_ac, "server"); autocomplete_add(account_clear_ac, "server");
autocomplete_add(account_clear_ac, "port"); autocomplete_add(account_clear_ac, "port");
autocomplete_add(account_clear_ac, "otr"); autocomplete_add(account_clear_ac, "otr");
autocomplete_add(account_clear_ac, "pgpkeyid");
account_default_ac = autocomplete_new(); account_default_ac = autocomplete_new();
autocomplete_add(account_default_ac, "set"); autocomplete_add(account_default_ac, "set");

View File

@ -516,6 +516,10 @@ cmd_account(gchar **args, struct cmd_help_t help)
cons_show("Updated login status for account %s: %s", account_name, value); cons_show("Updated login status for account %s: %s", account_name, value);
} }
cons_show(""); cons_show("");
} else if (strcmp(property, "pgpkeyid") == 0) {
accounts_set_pgp_keyid(account_name, value);
cons_show("Updated PGP key ID for account %s: %s", account_name, value);
cons_show("");
} else if (valid_resource_presence_string(property)) { } else if (valid_resource_presence_string(property)) {
int intval; int intval;
char *err_msg = NULL; char *err_msg = NULL;
@ -594,6 +598,10 @@ cmd_account(gchar **args, struct cmd_help_t help)
accounts_clear_otr(account_name); accounts_clear_otr(account_name);
cons_show("OTR policy removed for account %s", account_name); cons_show("OTR policy removed for account %s", account_name);
cons_show(""); cons_show("");
} else if (strcmp(property, "pgpkeyid") == 0) {
accounts_clear_pgp_keyid(account_name);
cons_show("Removed PGP key ID 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("");

View File

@ -49,7 +49,7 @@ account_new(const gchar * const name, const gchar * const jid,
int priority_away, int priority_xa, int priority_dnd, int priority_away, int priority_xa, int priority_dnd,
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) GList *otr_always, const gchar * const pgp_keyid)
{ {
ProfAccount *new_account = malloc(sizeof(ProfAccount)); ProfAccount *new_account = malloc(sizeof(ProfAccount));
@ -142,6 +142,12 @@ account_new(const gchar * const name, const gchar * const jid,
new_account->otr_opportunistic = otr_opportunistic; new_account->otr_opportunistic = otr_opportunistic;
new_account->otr_always = otr_always; new_account->otr_always = otr_always;
if (pgp_keyid != NULL) {
new_account->pgp_keyid = strdup(pgp_keyid);
} else {
new_account->pgp_keyid = NULL;
}
return new_account; return new_account;
} }
@ -170,6 +176,7 @@ account_free(ProfAccount *account)
free(account->muc_service); free(account->muc_service);
free(account->muc_nick); free(account->muc_nick);
free(account->otr_policy); free(account->otr_policy);
free(account->pgp_keyid);
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);
g_list_free_full(account->otr_always, g_free); g_list_free_full(account->otr_always, g_free);

View File

@ -59,6 +59,7 @@ typedef struct prof_account_t {
GList *otr_manual; GList *otr_manual;
GList *otr_opportunistic; GList *otr_opportunistic;
GList *otr_always; GList *otr_always;
gchar *pgp_keyid;
} ProfAccount; } ProfAccount;
ProfAccount* account_new(const gchar * const name, const gchar * const jid, ProfAccount* account_new(const gchar * const name, const gchar * const jid,
@ -68,7 +69,7 @@ ProfAccount* account_new(const gchar * const name, const gchar * const jid,
int priority_away, int priority_xa, int priority_dnd, int priority_away, int priority_xa, int priority_dnd,
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); GList *otr_always, const gchar * const pgp_keyid);
char* account_create_full_jid(ProfAccount *account); char* account_create_full_jid(ProfAccount *account);

View File

@ -280,11 +280,16 @@ accounts_get_account(const char * const name)
g_strfreev(always); g_strfreev(always);
} }
gchar *pgp_keyid = NULL;
if (g_key_file_has_key(accounts, name, "pgp.keyid", NULL)) {
pgp_keyid = g_key_file_get_string(accounts, name, "pgp.keyid", NULL);
}
ProfAccount *new_account = account_new(name, jid, password, eval_password, enabled, ProfAccount *new_account = account_new(name, jid, password, eval_password, enabled,
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); otr_opportunistic, otr_always, pgp_keyid);
g_free(jid); g_free(jid);
g_free(password); g_free(password);
@ -296,6 +301,7 @@ accounts_get_account(const char * const name)
g_free(muc_service); g_free(muc_service);
g_free(muc_nick); g_free(muc_nick);
g_free(otr_policy); g_free(otr_policy);
g_free(pgp_keyid);
return new_account; return new_account;
} }
@ -453,6 +459,15 @@ accounts_set_eval_password(const char * const account_name, const char * const v
} }
} }
void
accounts_set_pgp_keyid(const char * const account_name, const char * const value)
{
if (accounts_account_exists(account_name)) {
g_key_file_set_string(accounts, account_name, "pgp.keyid", value);
_save_accounts();
}
}
void void
accounts_clear_password(const char * const account_name) accounts_clear_password(const char * const account_name)
{ {
@ -489,6 +504,15 @@ accounts_clear_port(const char * const account_name)
} }
} }
void
accounts_clear_pgp_keyid(const char * const account_name)
{
if (accounts_account_exists(account_name)) {
g_key_file_remove_key(accounts, account_name, "pgp.keyid", NULL);
_save_accounts();
}
}
void void
accounts_clear_otr(const char * const account_name) accounts_clear_otr(const char * const account_name)
{ {

View File

@ -77,11 +77,13 @@ void accounts_set_priority_dnd(const char * const account_name, const gint value
void accounts_set_priority_all(const char * const account_name, const gint value); 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, 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_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);
void accounts_clear_port(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_otr(const char * const account_name);
void accounts_clear_pgp_keyid(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

@ -42,8 +42,12 @@
#include "pgp/gpg.h" #include "pgp/gpg.h"
#include "log.h" #include "log.h"
#define PGP_FOOTER "-----END PGP SIGNATURE-----"
static const char *libversion; static const char *libversion;
static char* _remove_header_footer(char *str);
void void
p_gpg_init(void) p_gpg_init(void)
{ {
@ -62,7 +66,7 @@ p_gpg_list_keys(void)
error = gpgme_new(&ctx); error = gpgme_new(&ctx);
if (error) { if (error) {
log_error("GPG: Could not list keys: %s %s", gpgme_strsource(error), gpgme_strerror(error)); log_error("GPG: Could not list keys. %s %s", gpgme_strsource(error), gpgme_strerror(error));
return NULL; return NULL;
} }
@ -84,7 +88,7 @@ p_gpg_list_keys(void)
gpgme_key_release(key); gpgme_key_release(key);
} }
} else { } else {
log_error("GPG: Could not list keys: %s %s", gpgme_strsource(error), gpgme_strerror(error)); log_error("GPG: Could not list keys. %s %s", gpgme_strsource(error), gpgme_strerror(error));
} }
gpgme_release(ctx); gpgme_release(ctx);
@ -108,3 +112,88 @@ p_gpg_free_key(ProfPGPKey *key)
free(key); free(key);
} }
} }
char*
p_gpg_sign_str(const char * const str, const char * const fp)
{
gpgme_ctx_t ctx;
gpgme_error_t error = gpgme_new(&ctx);
if (error) {
log_error("GPG: Failed to create gpgme context. %s %s", gpgme_strsource(error), gpgme_strerror(error));
return NULL;
}
gpgme_key_t key = NULL;
error = gpgme_get_key(ctx, fp, &key, 1);
if (error || key == NULL) {
log_error("GPG: Failed to get key. %s %s", gpgme_strsource(error), gpgme_strerror(error));
gpgme_release (ctx);
return NULL;
}
gpgme_signers_clear(ctx);
error = gpgme_signers_add(ctx, key);
if (error) {
log_error("GPG: Failed to load signer. %s %s", gpgme_strsource(error), gpgme_strerror(error));
gpgme_release(ctx);
return NULL;
}
gpgme_data_t str_data;
gpgme_data_t signed_data;
char *str_or_empty = NULL;
if (str) {
str_or_empty = strdup(str);
} else {
str_or_empty = strdup("");
}
gpgme_data_new_from_mem(&str_data, str_or_empty, strlen(str_or_empty), 1);
gpgme_data_new(&signed_data);
gpgme_set_armor(ctx,1);
error = gpgme_op_sign(ctx,str_data,signed_data,GPGME_SIG_MODE_DETACH);
if (error) {
log_error("GPG: Failed to sign string. %s %s", gpgme_strsource(error), gpgme_strerror(error));
gpgme_release(ctx);
return NULL;
}
char *result = NULL;
gpgme_data_release(str_data);
size_t len = 0;
char *signed_str = gpgme_data_release_and_get_mem(signed_data, &len);
if (signed_str != NULL) {
signed_str[len] = 0;
result = _remove_header_footer(signed_str);
}
gpgme_free(signed_str);
gpgme_release(ctx);
free(str_or_empty);
return result;
}
static char*
_remove_header_footer(char *str)
{
char *pointer = str;
int newlines = 0;
while (newlines < 3) {
if (pointer[0] == '\n') {
newlines++;
}
pointer++;
if (strlen(pointer) == 0) {
return NULL;
}
}
char *stripped = malloc(strlen(pointer)+1-strlen(PGP_FOOTER));
strncpy(stripped,pointer,strlen(pointer)-strlen(PGP_FOOTER));
stripped[strlen(pointer)-strlen(PGP_FOOTER)] = '\0';
return stripped;
}

View File

@ -45,5 +45,6 @@ void p_gpg_init(void);
GSList* p_gpg_list_keys(void); GSList* p_gpg_list_keys(void);
const char* p_gpg_libver(void); const char* p_gpg_libver(void);
void p_gpg_free_key(ProfPGPKey *key); void p_gpg_free_key(ProfPGPKey *key);
char* p_gpg_sign_str(const char * const str, const char * const fp);
#endif #endif

View File

@ -710,6 +710,10 @@ cons_show_account(ProfAccount *account)
g_string_free(always, TRUE); g_string_free(always, TRUE);
} }
if (account->pgp_keyid) {
cons_show ("PGP Key ID : %s", account->pgp_keyid);
}
cons_show ("Priority : chat:%d, online:%d, away:%d, xa:%d, dnd:%d", cons_show ("Priority : chat:%d, online:%d, away:%d, xa:%d, dnd:%d",
account->priority_chat, account->priority_online, account->priority_away, account->priority_chat, account->priority_online, account->priority_away,
account->priority_xa, account->priority_dnd); account->priority_xa, account->priority_dnd);

View File

@ -49,6 +49,7 @@
#include "xmpp/connection.h" #include "xmpp/connection.h"
#include "xmpp/stanza.h" #include "xmpp/stanza.h"
#include "xmpp/xmpp.h" #include "xmpp/xmpp.h"
#include "pgp/gpg.h"
static Autocomplete sub_requests_ac; static Autocomplete sub_requests_ac;
@ -222,7 +223,28 @@ presence_update(const resource_presence_t presence_type, const char * const msg,
char *id = create_unique_id("presence"); char *id = create_unique_id("presence");
xmpp_stanza_set_id(presence, id); xmpp_stanza_set_id(presence, id);
stanza_attach_show(ctx, presence, show); stanza_attach_show(ctx, presence, show);
stanza_attach_status(ctx, presence, msg); stanza_attach_status(ctx, presence, msg);
char *account_name = jabber_get_account_name();
ProfAccount *account = accounts_get_account(account_name);
if (account->pgp_keyid) {
xmpp_stanza_t *x = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(x, STANZA_NAME_X);
xmpp_stanza_set_ns(x, STANZA_NS_SIGNED);
xmpp_stanza_t *signed_text = xmpp_stanza_new(ctx);
char *signed_status = p_gpg_sign_str(msg, account->pgp_keyid);
xmpp_stanza_set_text(signed_text, signed_status);
xmpp_stanza_add_child(x, signed_text);
xmpp_stanza_release(signed_text);
xmpp_stanza_add_child(presence, x);
xmpp_stanza_release(x);
free(signed_status);
}
stanza_attach_priority(ctx, presence, pri); stanza_attach_priority(ctx, presence, pri);
stanza_attach_last_activity(ctx, presence, idle); stanza_attach_last_activity(ctx, presence, idle);
stanza_attach_caps(ctx, presence); stanza_attach_caps(ctx, presence);

View File

@ -159,6 +159,7 @@
#define STANZA_NS_CARBONS "urn:xmpp:carbons:2" #define STANZA_NS_CARBONS "urn:xmpp:carbons:2"
#define STANZA_NS_FORWARD "urn:xmpp:forward:0" #define STANZA_NS_FORWARD "urn:xmpp:forward:0"
#define STANZA_NS_RECEIPTS "urn:xmpp:receipts" #define STANZA_NS_RECEIPTS "urn:xmpp:receipts"
#define STANZA_NS_SIGNED "jabber:x:signed"
#define STANZA_DATAFORM_SOFTWARE "urn:xmpp:dataforms:softwareinfo" #define STANZA_DATAFORM_SOFTWARE "urn:xmpp:dataforms:softwareinfo"

View File

@ -122,6 +122,7 @@ void accounts_set_otr_policy(const char * const account_name, const char * const
} }
void accounts_set_last_presence(const char * const account_name, const char * const value) {} void accounts_set_last_presence(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_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)
{ {
@ -182,4 +183,5 @@ 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) {}
void accounts_clear_port(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_otr(const char * const account_name) {}
void accounts_clear_pgp_keyid(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) {}

View File

@ -36,7 +36,7 @@ void cmd_account_shows_account_when_connected_and_no_args(void **state)
{ {
CommandHelp *help = malloc(sizeof(CommandHelp)); CommandHelp *help = malloc(sizeof(CommandHelp));
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); TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, 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);
@ -109,7 +109,7 @@ void cmd_account_show_shows_account_when_exists(void **state)
CommandHelp *help = malloc(sizeof(CommandHelp)); CommandHelp *help = malloc(sizeof(CommandHelp));
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); TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, 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);
@ -478,7 +478,7 @@ void cmd_account_set_password_sets_password(void **state)
CommandHelp *help = malloc(sizeof(CommandHelp)); CommandHelp *help = malloc(sizeof(CommandHelp));
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); TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
expect_any(accounts_account_exists, account_name); expect_any(accounts_account_exists, account_name);
@ -504,7 +504,7 @@ void cmd_account_set_eval_password_sets_eval_password(void **state)
CommandHelp *help = malloc(sizeof(CommandHelp)); CommandHelp *help = malloc(sizeof(CommandHelp));
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); TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
expect_any(accounts_account_exists, account_name); expect_any(accounts_account_exists, account_name);
@ -529,7 +529,7 @@ void cmd_account_set_password_when_eval_password_set(void **state) {
CommandHelp *help = malloc(sizeof(CommandHelp)); CommandHelp *help = malloc(sizeof(CommandHelp));
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); TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
expect_any(accounts_account_exists, account_name); expect_any(accounts_account_exists, account_name);
@ -550,7 +550,7 @@ void cmd_account_set_eval_password_when_password_set(void **state) {
CommandHelp *help = malloc(sizeof(CommandHelp)); CommandHelp *help = malloc(sizeof(CommandHelp));
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); TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
expect_any(accounts_account_exists, account_name); expect_any(accounts_account_exists, account_name);

View File

@ -411,7 +411,7 @@ void cmd_connect_asks_password_when_not_in_account(void **state)
CommandHelp *help = malloc(sizeof(CommandHelp)); CommandHelp *help = malloc(sizeof(CommandHelp));
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); TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
will_return(jabber_get_connection_status, JABBER_DISCONNECTED); will_return(jabber_get_connection_status, JABBER_DISCONNECTED);
@ -436,7 +436,7 @@ void cmd_connect_shows_message_when_connecting_with_account(void **state)
CommandHelp *help = malloc(sizeof(CommandHelp)); CommandHelp *help = malloc(sizeof(CommandHelp));
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); TRUE, NULL, 0, "laptop", NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
will_return(jabber_get_connection_status, JABBER_DISCONNECTED); will_return(jabber_get_connection_status, JABBER_DISCONNECTED);
@ -459,7 +459,7 @@ void cmd_connect_connects_with_account(void **state)
CommandHelp *help = malloc(sizeof(CommandHelp)); CommandHelp *help = malloc(sizeof(CommandHelp));
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); TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, 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

@ -93,7 +93,7 @@ void cmd_join_uses_account_mucservice_when_no_service_specified(void **state)
CommandHelp *help = malloc(sizeof(CommandHelp)); CommandHelp *help = malloc(sizeof(CommandHelp));
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); TRUE, NULL, 0, "laptop", NULL, NULL, 0, 0, 0, 0, 0, account_service, NULL, NULL, NULL, NULL, NULL, NULL);
muc_init(); muc_init();
@ -121,7 +121,7 @@ void cmd_join_uses_supplied_nick(void **state)
CommandHelp *help = malloc(sizeof(CommandHelp)); CommandHelp *help = malloc(sizeof(CommandHelp));
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); TRUE, NULL, 0, "laptop", NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
muc_init(); muc_init();
@ -149,7 +149,7 @@ void cmd_join_uses_account_nick_when_not_supplied(void **state)
CommandHelp *help = malloc(sizeof(CommandHelp)); CommandHelp *help = malloc(sizeof(CommandHelp));
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); TRUE, NULL, 0, "laptop", NULL, NULL, 0, 0, 0, 0, 0, NULL, account_nick, NULL, NULL, NULL, NULL, NULL);
muc_init(); muc_init();
@ -180,7 +180,7 @@ void cmd_join_uses_password_when_supplied(void **state)
CommandHelp *help = malloc(sizeof(CommandHelp)); CommandHelp *help = malloc(sizeof(CommandHelp));
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); TRUE, NULL, 0, "laptop", NULL, NULL, 0, 0, 0, 0, 0, account_service, account_nick, NULL, NULL, NULL, NULL, NULL);
muc_init(); muc_init();

View File

@ -308,7 +308,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); TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, 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);