mirror of
https://github.com/profanity-im/profanity.git
synced 2024-09-15 19:38:07 -04:00
let account_new()
take ownership of passed values
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
This commit is contained in:
parent
a0aa26b6fa
commit
302d0dd576
@ -49,71 +49,53 @@
|
|||||||
#include "xmpp/resource.h"
|
#include "xmpp/resource.h"
|
||||||
|
|
||||||
ProfAccount*
|
ProfAccount*
|
||||||
account_new(const gchar* const name, const gchar* const jid,
|
account_new(gchar* name, gchar* jid, gchar* password, gchar* eval_password, gboolean enabled,
|
||||||
const gchar* const password, const gchar* eval_password, gboolean enabled, const gchar* const server,
|
gchar* server, int port, gchar* resource, gchar* last_presence, gchar* login_presence,
|
||||||
int port, const gchar* const resource, const gchar* const last_presence,
|
int priority_online, int priority_chat, int priority_away, int priority_xa, int priority_dnd,
|
||||||
const gchar* const login_presence, int priority_online, int priority_chat,
|
gchar* muc_service, gchar* muc_nick,
|
||||||
int priority_away, int priority_xa, int priority_dnd,
|
gchar* otr_policy, GList* otr_manual, GList* otr_opportunistic, GList* otr_always,
|
||||||
const gchar* const muc_service, const gchar* const muc_nick,
|
gchar* omemo_policy, GList* omemo_enabled, GList* omemo_disabled,
|
||||||
const gchar* const otr_policy, GList* otr_manual, GList* otr_opportunistic,
|
GList* ox_enabled, GList* pgp_enabled, gchar* pgp_keyid,
|
||||||
GList* otr_always, const gchar* const omemo_policy, GList* omemo_enabled,
|
gchar* startscript, gchar* theme, gchar* tls_policy, gchar* auth_policy)
|
||||||
GList* omemo_disabled, GList* ox_enabled, GList* pgp_enabled,
|
|
||||||
const gchar* const pgp_keyid, const char* const startscript, const char* const theme,
|
|
||||||
gchar* tls_policy, gchar* auth_policy)
|
|
||||||
{
|
{
|
||||||
ProfAccount* new_account = malloc(sizeof(ProfAccount));
|
ProfAccount* new_account = calloc(1, sizeof(ProfAccount));
|
||||||
memset(new_account, 0, sizeof(ProfAccount));
|
|
||||||
|
|
||||||
new_account->name = strdup(name);
|
new_account->name = name;
|
||||||
|
|
||||||
if (jid) {
|
if (jid) {
|
||||||
new_account->jid = strdup(jid);
|
new_account->jid = jid;
|
||||||
} else {
|
} else {
|
||||||
new_account->jid = strdup(name);
|
new_account->jid = strdup(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (password) {
|
new_account->password = password;
|
||||||
new_account->password = strdup(password);
|
|
||||||
} else {
|
|
||||||
new_account->password = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (eval_password) {
|
new_account->eval_password = eval_password;
|
||||||
new_account->eval_password = strdup(eval_password);
|
|
||||||
} else {
|
|
||||||
new_account->eval_password = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
new_account->enabled = enabled;
|
new_account->enabled = enabled;
|
||||||
|
|
||||||
if (server) {
|
new_account->server = server;
|
||||||
new_account->server = strdup(server);
|
|
||||||
} else {
|
|
||||||
new_account->server = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (resource) {
|
new_account->resource = resource;
|
||||||
new_account->resource = strdup(resource);
|
|
||||||
} else {
|
|
||||||
new_account->resource = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
new_account->port = port;
|
new_account->port = port;
|
||||||
|
|
||||||
if (last_presence == NULL || !valid_resource_presence_string(last_presence)) {
|
if (last_presence == NULL || !valid_resource_presence_string(last_presence)) {
|
||||||
new_account->last_presence = strdup("online");
|
new_account->last_presence = strdup("online");
|
||||||
|
g_free(last_presence);
|
||||||
} else {
|
} else {
|
||||||
new_account->last_presence = strdup(last_presence);
|
new_account->last_presence = last_presence;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (login_presence == NULL) {
|
if (login_presence == NULL) {
|
||||||
new_account->login_presence = strdup("online");
|
new_account->login_presence = strdup("online");
|
||||||
} else if (strcmp(login_presence, "last") == 0) {
|
} else if (strcmp(login_presence, "last") == 0) {
|
||||||
new_account->login_presence = strdup(login_presence);
|
new_account->login_presence = login_presence;
|
||||||
} else if (!valid_resource_presence_string(login_presence)) {
|
} else if (!valid_resource_presence_string(login_presence)) {
|
||||||
new_account->login_presence = strdup("online");
|
new_account->login_presence = strdup("online");
|
||||||
|
g_free(login_presence);
|
||||||
} else {
|
} else {
|
||||||
new_account->login_presence = strdup(login_presence);
|
new_account->login_presence = login_presence;
|
||||||
}
|
}
|
||||||
|
|
||||||
new_account->priority_online = priority_online;
|
new_account->priority_online = priority_online;
|
||||||
@ -122,72 +104,38 @@ account_new(const gchar* const name, const gchar* const jid,
|
|||||||
new_account->priority_xa = priority_xa;
|
new_account->priority_xa = priority_xa;
|
||||||
new_account->priority_dnd = priority_dnd;
|
new_account->priority_dnd = priority_dnd;
|
||||||
|
|
||||||
if (muc_service) {
|
new_account->muc_service = muc_service;
|
||||||
new_account->muc_service = strdup(muc_service);
|
|
||||||
} else {
|
|
||||||
new_account->muc_service = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (muc_nick == NULL) {
|
if (muc_nick == NULL) {
|
||||||
Jid* jidp = jid_create(new_account->jid);
|
Jid* jidp = jid_create(new_account->jid);
|
||||||
new_account->muc_nick = strdup(jidp->domainpart);
|
new_account->muc_nick = strdup(jidp->domainpart);
|
||||||
jid_destroy(jidp);
|
jid_destroy(jidp);
|
||||||
} else {
|
} else {
|
||||||
new_account->muc_nick = strdup(muc_nick);
|
new_account->muc_nick = muc_nick;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (otr_policy) {
|
new_account->otr_policy = otr_policy;
|
||||||
new_account->otr_policy = strdup(otr_policy);
|
|
||||||
} else {
|
|
||||||
new_account->otr_policy = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
new_account->otr_manual = otr_manual;
|
new_account->otr_manual = otr_manual;
|
||||||
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 (omemo_policy) {
|
new_account->omemo_policy = omemo_policy;
|
||||||
new_account->omemo_policy = strdup(omemo_policy);
|
|
||||||
} else {
|
|
||||||
new_account->omemo_policy = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
new_account->omemo_enabled = omemo_enabled;
|
new_account->omemo_enabled = omemo_enabled;
|
||||||
new_account->omemo_disabled = omemo_disabled;
|
new_account->omemo_disabled = omemo_disabled;
|
||||||
|
|
||||||
new_account->ox_enabled = ox_enabled;
|
new_account->ox_enabled = ox_enabled;
|
||||||
|
|
||||||
new_account->pgp_enabled = pgp_enabled;
|
new_account->pgp_enabled = pgp_enabled;
|
||||||
|
new_account->pgp_keyid = pgp_keyid;
|
||||||
|
|
||||||
if (pgp_keyid != NULL) {
|
new_account->startscript = startscript;
|
||||||
new_account->pgp_keyid = strdup(pgp_keyid);
|
|
||||||
} else {
|
|
||||||
new_account->pgp_keyid = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (startscript != NULL) {
|
new_account->theme = theme;
|
||||||
new_account->startscript = strdup(startscript);
|
|
||||||
} else {
|
|
||||||
new_account->startscript = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (theme != NULL) {
|
new_account->tls_policy = tls_policy;
|
||||||
new_account->theme = strdup(theme);
|
|
||||||
} else {
|
|
||||||
new_account->theme = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tls_policy != NULL) {
|
new_account->auth_policy = auth_policy;
|
||||||
new_account->tls_policy = strdup(tls_policy);
|
|
||||||
} else {
|
|
||||||
new_account->tls_policy = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (auth_policy != NULL) {
|
|
||||||
new_account->auth_policy = strdup(auth_policy);
|
|
||||||
} else {
|
|
||||||
new_account->auth_policy = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return new_account;
|
return new_account;
|
||||||
}
|
}
|
||||||
|
@ -73,17 +73,14 @@ typedef struct prof_account_t
|
|||||||
gchar* auth_policy;
|
gchar* auth_policy;
|
||||||
} ProfAccount;
|
} ProfAccount;
|
||||||
|
|
||||||
ProfAccount* account_new(const gchar* const name, const gchar* const jid,
|
ProfAccount* account_new(gchar* name, gchar* jid, gchar* password, gchar* eval_password, gboolean enabled,
|
||||||
const gchar* const passord, const gchar* eval_password, gboolean enabled, const gchar* const server,
|
gchar* server, int port, gchar* resource, gchar* last_presence, gchar* login_presence,
|
||||||
int port, const gchar* const resource, const gchar* const last_presence,
|
int priority_online, int priority_chat, int priority_away, int priority_xa, int priority_dnd,
|
||||||
const gchar* const login_presence, int priority_online, int priority_chat,
|
gchar* muc_service, gchar* muc_nick,
|
||||||
int priority_away, int priority_xa, int priority_dnd,
|
gchar* otr_policy, GList* otr_manual, GList* otr_opportunistic, GList* otr_always,
|
||||||
const gchar* const muc_service, const gchar* const muc_nick,
|
gchar* omemo_policy, GList* omemo_enabled, GList* omemo_disabled,
|
||||||
const gchar* const otr_policy, GList* otr_manual, GList* otr_opportunistic,
|
GList* ox_enabled, GList* pgp_enabled, gchar* pgp_keyid,
|
||||||
GList* otr_always, const gchar* const omemo_policy, GList* omemo_enabled,
|
gchar* startscript, gchar* theme, gchar* tls_policy, gchar* auth_policy);
|
||||||
GList* omemo_disabled, GList* ox_enabled, GList* pgp_enabled, const gchar* const pgp_keyid,
|
|
||||||
const char* const startscript, const char* const theme, gchar* tls_policy,
|
|
||||||
gchar* auth_policy);
|
|
||||||
char* account_create_connect_jid(ProfAccount* account);
|
char* account_create_connect_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);
|
||||||
|
@ -342,7 +342,7 @@ accounts_get_account(const char* const name)
|
|||||||
|
|
||||||
gchar* auth_policy = g_key_file_get_string(accounts, name, "auth.policy", NULL);
|
gchar* auth_policy = g_key_file_get_string(accounts, name, "auth.policy", NULL);
|
||||||
|
|
||||||
ProfAccount* new_account = account_new(name, jid, password, eval_password, enabled,
|
ProfAccount* new_account = account_new(g_strdup(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,
|
||||||
@ -350,23 +350,6 @@ accounts_get_account(const char* const name)
|
|||||||
omemo_disabled, ox_enabled, pgp_enabled, pgp_keyid,
|
omemo_disabled, ox_enabled, pgp_enabled, pgp_keyid,
|
||||||
startscript, theme, tls_policy, auth_policy);
|
startscript, theme, tls_policy, auth_policy);
|
||||||
|
|
||||||
g_free(jid);
|
|
||||||
g_free(password);
|
|
||||||
g_free(eval_password);
|
|
||||||
g_free(server);
|
|
||||||
g_free(resource);
|
|
||||||
g_free(last_presence);
|
|
||||||
g_free(login_presence);
|
|
||||||
g_free(muc_service);
|
|
||||||
g_free(muc_nick);
|
|
||||||
g_free(otr_policy);
|
|
||||||
g_free(omemo_policy);
|
|
||||||
g_free(pgp_keyid);
|
|
||||||
g_free(startscript);
|
|
||||||
g_free(theme);
|
|
||||||
g_free(tls_policy);
|
|
||||||
g_free(auth_policy);
|
|
||||||
|
|
||||||
return new_account;
|
return new_account;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ cmd_account_shows_usage_when_not_connected_and_no_args(void** state)
|
|||||||
void
|
void
|
||||||
cmd_account_shows_account_when_connected_and_no_args(void** state)
|
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(g_strdup("jabber_org"), g_strdup("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, 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, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||||
gchar* args[] = { NULL };
|
gchar* args[] = { NULL };
|
||||||
|
|
||||||
@ -97,7 +97,7 @@ void
|
|||||||
cmd_account_show_shows_account_when_exists(void** state)
|
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(g_strdup("jabber_org"), g_strdup("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, 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, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
expect_any(accounts_get_account, name);
|
expect_any(accounts_get_account, name);
|
||||||
@ -436,7 +436,7 @@ void
|
|||||||
cmd_account_set_password_sets_password(void** state)
|
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(g_strdup("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, 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, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
expect_any(accounts_account_exists, account_name);
|
expect_any(accounts_account_exists, account_name);
|
||||||
@ -459,7 +459,7 @@ void
|
|||||||
cmd_account_set_eval_password_sets_eval_password(void** state)
|
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(g_strdup("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, 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, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
expect_any(accounts_account_exists, account_name);
|
expect_any(accounts_account_exists, account_name);
|
||||||
@ -482,7 +482,7 @@ void
|
|||||||
cmd_account_set_password_when_eval_password_set(void** state)
|
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(g_strdup("a_account"), NULL, NULL, g_strdup("a_password"),
|
||||||
TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 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, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
expect_any(accounts_account_exists, account_name);
|
expect_any(accounts_account_exists, account_name);
|
||||||
@ -501,7 +501,7 @@ void
|
|||||||
cmd_account_set_eval_password_when_password_set(void** state)
|
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(g_strdup("a_account"), NULL, g_strdup("a_password"), NULL,
|
||||||
TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 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, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
expect_any(accounts_account_exists, account_name);
|
expect_any(accounts_account_exists, account_name);
|
||||||
@ -852,7 +852,7 @@ cmd_account_set_priority_updates_presence_when_account_connected_with_presence(v
|
|||||||
will_return(session_get_account_name, "a_account");
|
will_return(session_get_account_name, "a_account");
|
||||||
|
|
||||||
#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(g_strdup("a_account"), g_strdup("a_jid"), NULL, NULL, TRUE, NULL, 5222, g_strdup("a_resource"),
|
||||||
NULL, NULL, 10, 10, 10, 10, 10, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 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, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
will_return(session_get_account_name, "a_account");
|
will_return(session_get_account_name, "a_account");
|
||||||
|
@ -123,7 +123,7 @@ void
|
|||||||
cmd_connect_lowercases_argument_with_account(void** state)
|
cmd_connect_lowercases_argument_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(g_strdup("Jabber_org"), g_strdup("me@jabber.org"), g_strdup("password"), NULL,
|
||||||
TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 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, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
will_return(connection_get_status, JABBER_DISCONNECTED);
|
will_return(connection_get_status, JABBER_DISCONNECTED);
|
||||||
@ -144,7 +144,7 @@ void
|
|||||||
cmd_connect_asks_password_when_not_in_account(void** state)
|
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(g_strdup("jabber_org"), g_strdup("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, 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, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
will_return(connection_get_status, JABBER_DISCONNECTED);
|
will_return(connection_get_status, JABBER_DISCONNECTED);
|
||||||
@ -407,8 +407,8 @@ void
|
|||||||
cmd_connect_shows_message_when_connecting_with_account(void** state)
|
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(g_strdup("jabber_org"), g_strdup("user@jabber.org"), g_strdup("password"), NULL,
|
||||||
TRUE, NULL, 0, "laptop", NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
TRUE, NULL, 0, g_strdup("laptop"), NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
will_return(connection_get_status, JABBER_DISCONNECTED);
|
will_return(connection_get_status, JABBER_DISCONNECTED);
|
||||||
|
|
||||||
@ -428,7 +428,7 @@ void
|
|||||||
cmd_connect_connects_with_account(void** state)
|
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(g_strdup("jabber_org"), g_strdup("me@jabber.org"), g_strdup("password"), NULL,
|
||||||
TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 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, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
will_return(connection_get_status, JABBER_DISCONNECTED);
|
will_return(connection_get_status, JABBER_DISCONNECTED);
|
||||||
|
@ -64,14 +64,14 @@ cmd_join_shows_error_message_when_invalid_room_jid(void** state)
|
|||||||
void
|
void
|
||||||
cmd_join_uses_account_mucservice_when_no_service_specified(void** state)
|
cmd_join_uses_account_mucservice_when_no_service_specified(void** state)
|
||||||
{
|
{
|
||||||
char* account_name = "an_account";
|
char* account_name = g_strdup("an_account");
|
||||||
char* room = "room";
|
char* room = "room";
|
||||||
char* nick = "bob";
|
char* nick = "bob";
|
||||||
char* account_service = "conference.server.org";
|
char* account_service = g_strdup("conference.server.org");
|
||||||
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, g_strdup("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, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
TRUE, NULL, 0, g_strdup("laptop"), NULL, NULL, 0, 0, 0, 0, 0, account_service, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
muc_init();
|
muc_init();
|
||||||
|
|
||||||
@ -94,12 +94,12 @@ cmd_join_uses_account_mucservice_when_no_service_specified(void** state)
|
|||||||
void
|
void
|
||||||
cmd_join_uses_supplied_nick(void** state)
|
cmd_join_uses_supplied_nick(void** state)
|
||||||
{
|
{
|
||||||
char* account_name = "an_account";
|
char* account_name = g_strdup("an_account");
|
||||||
char* room = "room@conf.server.org";
|
char* room = "room@conf.server.org";
|
||||||
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, g_strdup("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, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
TRUE, NULL, 0, g_strdup("laptop"), NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
muc_init();
|
muc_init();
|
||||||
|
|
||||||
@ -122,12 +122,12 @@ cmd_join_uses_supplied_nick(void** state)
|
|||||||
void
|
void
|
||||||
cmd_join_uses_account_nick_when_not_supplied(void** state)
|
cmd_join_uses_account_nick_when_not_supplied(void** state)
|
||||||
{
|
{
|
||||||
char* account_name = "an_account";
|
char* account_name = g_strdup("an_account");
|
||||||
char* room = "room2@conf.server.org";
|
char* room = "room2@conf.server.org";
|
||||||
char* account_nick = "a_nick";
|
char* account_nick = g_strdup("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, g_strdup("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, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
TRUE, NULL, 0, g_strdup("laptop"), NULL, NULL, 0, 0, 0, 0, 0, NULL, account_nick, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
muc_init();
|
muc_init();
|
||||||
|
|
||||||
@ -150,15 +150,15 @@ cmd_join_uses_account_nick_when_not_supplied(void** state)
|
|||||||
void
|
void
|
||||||
cmd_join_uses_password_when_supplied(void** state)
|
cmd_join_uses_password_when_supplied(void** state)
|
||||||
{
|
{
|
||||||
char* account_name = "an_account";
|
char* account_name = g_strdup("an_account");
|
||||||
char* room = "room";
|
char* room = "room";
|
||||||
char* password = "a_password";
|
char* password = "a_password";
|
||||||
char* account_nick = "a_nick";
|
char* account_nick = g_strdup("a_nick");
|
||||||
char* account_service = "a_service";
|
char* account_service = g_strdup("a_service");
|
||||||
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, g_strdup("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, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
TRUE, NULL, 0, g_strdup("laptop"), NULL, NULL, 0, 0, 0, 0, 0, account_service, account_nick, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
muc_init();
|
muc_init();
|
||||||
|
|
||||||
|
@ -194,8 +194,8 @@ void
|
|||||||
cmd_otr_gen_generates_key_for_connected_account(void** state)
|
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 = g_strdup("myaccount");
|
||||||
ProfAccount* account = account_new(account_name, "me@jabber.org", NULL, NULL,
|
ProfAccount* account = account_new(account_name, g_strdup("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, 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, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
will_return(connection_get_status, JABBER_CONNECTED);
|
will_return(connection_get_status, JABBER_CONNECTED);
|
||||||
|
@ -50,8 +50,8 @@ 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(g_strdup("testaccount"), NULL, NULL, NULL, TRUE, NULL, 0, NULL, NULL, NULL,
|
||||||
0, 0, 0, 0, 0, "default_conf_server", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
0, 0, 0, 0, 0, g_strdup("default_conf_server"), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
will_return(connection_get_status, JABBER_CONNECTED);
|
will_return(connection_get_status, JABBER_CONNECTED);
|
||||||
will_return(session_get_account_name, "account_name");
|
will_return(session_get_account_name, "account_name");
|
||||||
@ -90,8 +90,8 @@ cmd_rooms_filter_arg_used_when_passed(void** state)
|
|||||||
{
|
{
|
||||||
gchar* args[] = { "filter", "text", NULL };
|
gchar* args[] = { "filter", "text", NULL };
|
||||||
|
|
||||||
ProfAccount* account = account_new("testaccount", NULL, NULL, NULL, TRUE, NULL, 0, NULL, NULL, NULL,
|
ProfAccount* account = account_new(g_strdup("testaccount"), NULL, NULL, NULL, TRUE, NULL, 0, NULL, NULL, NULL,
|
||||||
0, 0, 0, 0, 0, "default_conf_server", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
0, 0, 0, 0, 0, g_strdup("default_conf_server"), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
will_return(connection_get_status, JABBER_CONNECTED);
|
will_return(connection_get_status, JABBER_CONNECTED);
|
||||||
will_return(session_get_account_name, "account_name");
|
will_return(session_get_account_name, "account_name");
|
||||||
|
Loading…
Reference in New Issue
Block a user