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

Applied coding style to src/otr/

This commit is contained in:
James Booth 2015-10-25 22:40:09 +00:00
parent afbd2693cd
commit 894fa355e8
5 changed files with 63 additions and 64 deletions

View File

@ -63,13 +63,13 @@ otr_userstate(void)
return user_state;
}
OtrlMessageAppOps *
OtrlMessageAppOps*
otr_messageops(void)
{
return &ops;
}
GHashTable *
GHashTable*
otr_smpinitators(void)
{
return smp_initiators;
@ -146,13 +146,13 @@ cb_gone_secure(void *opdata, ConnContext *context)
ui_gone_secure(context->username, otr_is_trusted(context->username));
}
char *
char*
otr_libotr_version(void)
{
return OTRL_VERSION;
}
char *
char*
otr_start_query(void)
{
return otrlib_start_query();
@ -274,7 +274,7 @@ otr_on_connect(ProfAccount *account)
}
char*
otr_on_message_recv(const char * const barejid, const char * const resource, const char * const message, gboolean *decrypted)
otr_on_message_recv(const char *const barejid, const char *const resource, const char *const message, gboolean *decrypted)
{
prof_otrpolicy_t policy = otr_get_policy(barejid);
char *whitespace_base = strstr(message, OTRL_MESSAGE_TAG_BASE);
@ -314,7 +314,7 @@ otr_on_message_recv(const char * const barejid, const char * const resource, con
}
gboolean
otr_on_message_send(ProfChatWin *chatwin, const char * const message)
otr_on_message_send(ProfChatWin *chatwin, const char *const message)
{
char *id = NULL;
prof_otrpolicy_t policy = otr_get_policy(chatwin->barejid);
@ -451,8 +451,8 @@ otr_key_loaded(void)
return data_loaded;
}
char *
otr_tag_message(const char * const msg)
char*
otr_tag_message(const char *const msg)
{
GString *otr_message = g_string_new(msg);
g_string_append(otr_message, OTRL_MESSAGE_TAG_BASE);
@ -464,7 +464,7 @@ otr_tag_message(const char * const msg)
}
gboolean
otr_is_secure(const char * const recipient)
otr_is_secure(const char *const recipient)
{
ConnContext *context = otrlib_context_find(user_state, recipient, jid);
@ -480,7 +480,7 @@ otr_is_secure(const char * const recipient)
}
gboolean
otr_is_trusted(const char * const recipient)
otr_is_trusted(const char *const recipient)
{
ConnContext *context = otrlib_context_find(user_state, recipient, jid);
@ -506,7 +506,7 @@ otr_is_trusted(const char * const recipient)
}
void
otr_trust(const char * const recipient)
otr_trust(const char *const recipient)
{
ConnContext *context = otrlib_context_find(user_state, recipient, jid);
@ -530,7 +530,7 @@ otr_trust(const char * const recipient)
}
void
otr_untrust(const char * const recipient)
otr_untrust(const char *const recipient)
{
ConnContext *context = otrlib_context_find(user_state, recipient, jid);
@ -554,7 +554,7 @@ otr_untrust(const char * const recipient)
}
void
otr_smp_secret(const char * const recipient, const char *secret)
otr_smp_secret(const char *const recipient, const char *secret)
{
ConnContext *context = otrlib_context_find(user_state, recipient, jid);
@ -578,7 +578,7 @@ otr_smp_secret(const char * const recipient, const char *secret)
}
void
otr_smp_question(const char * const recipient, const char *question, const char *answer)
otr_smp_question(const char *const recipient, const char *question, const char *answer)
{
ConnContext *context = otrlib_context_find(user_state, recipient, jid);
@ -595,7 +595,7 @@ otr_smp_question(const char * const recipient, const char *question, const char
}
void
otr_smp_answer(const char * const recipient, const char *answer)
otr_smp_answer(const char *const recipient, const char *answer)
{
ConnContext *context = otrlib_context_find(user_state, recipient, jid);
@ -612,12 +612,12 @@ otr_smp_answer(const char * const recipient, const char *answer)
}
void
otr_end_session(const char * const recipient)
otr_end_session(const char *const recipient)
{
otrlib_end_session(user_state, recipient, jid, &ops);
}
char *
char*
otr_get_my_fingerprint(void)
{
char fingerprint[45];
@ -627,8 +627,8 @@ otr_get_my_fingerprint(void)
return result;
}
char *
otr_get_their_fingerprint(const char * const recipient)
char*
otr_get_their_fingerprint(const char *const recipient)
{
ConnContext *context = otrlib_context_find(user_state, recipient, jid);
@ -643,7 +643,7 @@ otr_get_their_fingerprint(const char * const recipient)
}
prof_otrpolicy_t
otr_get_policy(const char * const recipient)
otr_get_policy(const char *const recipient)
{
char *account_name = jabber_get_account_name();
ProfAccount *account = accounts_get_account(account_name);
@ -695,8 +695,8 @@ otr_get_policy(const char * const recipient)
return result;
}
char *
otr_encrypt_message(const char * const to, const char * const message)
char*
otr_encrypt_message(const char *const to, const char *const message)
{
char *newmessage = NULL;
gcry_error_t err = otrlib_encrypt_message(user_state, &ops, jid, to, message, &newmessage);
@ -716,8 +716,8 @@ _otr_tlv_free(OtrlTLV *tlvs)
}
}
char *
otr_decrypt_message(const char * const from, const char * const message, gboolean *decrypted)
char*
otr_decrypt_message(const char *const from, const char *const message, gboolean *decrypted)
{
char *newmessage = NULL;
OtrlTLV *tlvs = NULL;

View File

@ -58,35 +58,35 @@ char* otr_start_query(void);
void otr_poll(void);
void otr_on_connect(ProfAccount *account);
char* otr_on_message_recv(const char * const barejid, const char * const resource, const char * const message, gboolean *decrypted);
gboolean otr_on_message_send(ProfChatWin *chatwin, const char * const message);
char* otr_on_message_recv(const char *const barejid, const char *const resource, const char *const message, gboolean *decrypted);
gboolean otr_on_message_send(ProfChatWin *chatwin, const char *const message);
void otr_keygen(ProfAccount *account);
char* otr_tag_message(const char * const msg);
char* otr_tag_message(const char *const msg);
gboolean otr_key_loaded(void);
gboolean otr_is_secure(const char * const recipient);
gboolean otr_is_secure(const char *const recipient);
gboolean otr_is_trusted(const char * const recipient);
void otr_trust(const char * const recipient);
void otr_untrust(const char * const recipient);
gboolean otr_is_trusted(const char *const recipient);
void otr_trust(const char *const recipient);
void otr_untrust(const char *const recipient);
void otr_smp_secret(const char * const recipient, const char *secret);
void otr_smp_question(const char * const recipient, const char *question, const char *answer);
void otr_smp_answer(const char * const recipient, const char *answer);
void otr_smp_secret(const char *const recipient, const char *secret);
void otr_smp_question(const char *const recipient, const char *question, const char *answer);
void otr_smp_answer(const char *const recipient, const char *answer);
void otr_end_session(const char * const recipient);
void otr_end_session(const char *const recipient);
char * otr_get_my_fingerprint(void);
char * otr_get_their_fingerprint(const char * const recipient);
char* otr_get_my_fingerprint(void);
char* otr_get_their_fingerprint(const char *const recipient);
char * otr_encrypt_message(const char * const to, const char * const message);
char * otr_decrypt_message(const char * const from, const char * const message,
char* otr_encrypt_message(const char *const to, const char *const message);
char* otr_decrypt_message(const char *const from, const char *const message,
gboolean *decrypted);
void otr_free_message(char *message);
prof_otrpolicy_t otr_get_policy(const char * const recipient);
prof_otrpolicy_t otr_get_policy(const char *const recipient);
#endif

View File

@ -44,15 +44,15 @@ void otrlib_init_ops(OtrlMessageAppOps *ops);
void otrlib_init_timer(void);
void otrlib_poll(void);
ConnContext * otrlib_context_find(OtrlUserState user_state, const char * const recipient, char *jid);
ConnContext* otrlib_context_find(OtrlUserState user_state, const char *const recipient, char *jid);
void otrlib_end_session(OtrlUserState user_state, const char * const recipient, char *jid, OtrlMessageAppOps *ops);
void otrlib_end_session(OtrlUserState user_state, const char *const recipient, char *jid, OtrlMessageAppOps *ops);
gcry_error_t otrlib_encrypt_message(OtrlUserState user_state, OtrlMessageAppOps *ops, char *jid, const char * const to,
const char * const message, char **newmessage);
gcry_error_t otrlib_encrypt_message(OtrlUserState user_state, OtrlMessageAppOps *ops, char *jid, const char *const to,
const char *const message, char **newmessage);
int otrlib_decrypt_message(OtrlUserState user_state, OtrlMessageAppOps *ops, char *jid, const char * const from,
const char * const message, char **decrypted, OtrlTLV **tlvs);
int otrlib_decrypt_message(OtrlUserState user_state, OtrlMessageAppOps *ops, char *jid, const char *const from,
const char *const message, char **decrypted, OtrlTLV **tlvs);
void otrlib_handle_tlvs(OtrlUserState user_state, OtrlMessageAppOps *ops, ConnContext *context, OtrlTLV *tlvs, GHashTable *smp_initiators);

View File

@ -55,7 +55,7 @@ otrlib_poll(void)
{
}
char *
char*
otrlib_start_query(void)
{
return "?OTR?v2? This user has requested an Off-the-Record private conversation. However, you do not have a plugin to support that. See http://otr.cypherpunks.ca/ for more information.";
@ -75,14 +75,14 @@ otrlib_init_ops(OtrlMessageAppOps *ops)
ops->display_otr_message = cb_display_otr_message;
}
ConnContext *
otrlib_context_find(OtrlUserState user_state, const char * const recipient, char *jid)
ConnContext*
otrlib_context_find(OtrlUserState user_state, const char *const recipient, char *jid)
{
return otrl_context_find(user_state, recipient, jid, "xmpp", 0, NULL, NULL, NULL);
}
void
otrlib_end_session(OtrlUserState user_state, const char * const recipient, char *jid, OtrlMessageAppOps *ops)
otrlib_end_session(OtrlUserState user_state, const char *const recipient, char *jid, OtrlMessageAppOps *ops)
{
ConnContext *context = otrl_context_find(user_state, recipient, jid, "xmpp",
0, NULL, NULL, NULL);
@ -93,8 +93,8 @@ otrlib_end_session(OtrlUserState user_state, const char * const recipient, char
}
gcry_error_t
otrlib_encrypt_message(OtrlUserState user_state, OtrlMessageAppOps *ops, char *jid, const char * const to,
const char * const message, char **newmessage)
otrlib_encrypt_message(OtrlUserState user_state, OtrlMessageAppOps *ops, char *jid, const char *const to,
const char *const message, char **newmessage)
{
gcry_error_t err;
err = otrl_message_sending(
@ -114,8 +114,8 @@ otrlib_encrypt_message(OtrlUserState user_state, OtrlMessageAppOps *ops, char *j
}
int
otrlib_decrypt_message(OtrlUserState user_state, OtrlMessageAppOps *ops, char *jid, const char * const from,
const char * const message, char **decrypted, OtrlTLV **tlvs)
otrlib_decrypt_message(OtrlUserState user_state, OtrlMessageAppOps *ops, char *jid, const char *const from,
const char *const message, char **decrypted, OtrlTLV **tlvs)
{
return otrl_message_receiving(
user_state,

View File

@ -71,15 +71,14 @@ otrlib_poll(void)
}
}
char *
char*
otrlib_start_query(void)
{
return "?OTR?v2? This user has requested an Off-the-Record private conversation. However, you do not have a plugin to support that. See http://otr.cypherpunks.ca/ for more information.";
}
static const char*
cb_otr_error_message(void *opdata, ConnContext *context,
OtrlErrorCode err_code)
cb_otr_error_message(void *opdata, ConnContext *context, OtrlErrorCode err_code)
{
switch(err_code)
{
@ -241,14 +240,14 @@ otrlib_init_ops(OtrlMessageAppOps *ops)
ops->timer_control = cb_timer_control;
}
ConnContext *
otrlib_context_find(OtrlUserState user_state, const char * const recipient, char *jid)
ConnContext*
otrlib_context_find(OtrlUserState user_state, const char *const recipient, char *jid)
{
return otrl_context_find(user_state, recipient, jid, "xmpp", OTRL_INSTAG_MASTER, 0, NULL, NULL, NULL);
}
void
otrlib_end_session(OtrlUserState user_state, const char * const recipient, char *jid, OtrlMessageAppOps *ops)
otrlib_end_session(OtrlUserState user_state, const char *const recipient, char *jid, OtrlMessageAppOps *ops)
{
ConnContext *context = otrl_context_find(user_state, recipient, jid, "xmpp",
OTRL_INSTAG_MASTER, 0, NULL, NULL, NULL);
@ -259,8 +258,8 @@ otrlib_end_session(OtrlUserState user_state, const char * const recipient, char
}
gcry_error_t
otrlib_encrypt_message(OtrlUserState user_state, OtrlMessageAppOps *ops, char *jid, const char * const to,
const char * const message, char **newmessage)
otrlib_encrypt_message(OtrlUserState user_state, OtrlMessageAppOps *ops, char *jid, const char *const to,
const char *const message, char **newmessage)
{
gcry_error_t err;
@ -284,8 +283,8 @@ otrlib_encrypt_message(OtrlUserState user_state, OtrlMessageAppOps *ops, char *j
}
int
otrlib_decrypt_message(OtrlUserState user_state, OtrlMessageAppOps *ops, char *jid, const char * const from,
const char * const message, char **decrypted, OtrlTLV **tlvs)
otrlib_decrypt_message(OtrlUserState user_state, OtrlMessageAppOps *ops, char *jid, const char *const from,
const char *const message, char **decrypted, OtrlTLV **tlvs)
{
return otrl_message_receiving(
user_state,