1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-09-22 19:45:54 -04:00

Added OTR supported versions in initial start query message

This commit is contained in:
James Booth 2014-02-18 22:31:27 +00:00
parent 037ca81821
commit 09472e43c4
6 changed files with 26 additions and 2 deletions

View File

@ -2653,7 +2653,8 @@ cmd_otr(gchar **args, struct cmd_help_t help)
if (!otr_key_loaded()) {
ui_current_print_formatted_line('!', 0, "You have not generated or loaded a private key, use '/otr gen'");
} else if (!otr_is_secure(barejid)) {
message_send("?OTR?", barejid);
char *otr_query_message = otr_start_query();
message_send(otr_query_message, barejid);
} else {
ui_gone_secure(barejid, otr_is_trusted(barejid));
}
@ -2670,7 +2671,8 @@ cmd_otr(gchar **args, struct cmd_help_t help)
ui_current_print_formatted_line('!', 0, "You have not generated or loaded a private key, use '/otr gen'");
} else {
char *recipient = ui_current_recipient();
message_send("?OTR?", recipient);
char *otr_query_message = otr_start_query();
message_send(otr_query_message, recipient);
}
}
}

View File

@ -99,6 +99,12 @@ _otr_libotr_version(void)
return OTRL_VERSION;
}
static char *
_otr_start_query(void)
{
return otrlib_start_query();
}
static void
_otr_init(void)
{
@ -454,6 +460,7 @@ otr_init_module(void)
{
otr_init = _otr_init;
otr_libotr_version = _otr_libotr_version;
otr_start_query = _otr_start_query;
otr_on_connect = _otr_on_connect;
otr_keygen = _otr_keygen;
otr_key_loaded = _otr_key_loaded;

View File

@ -29,6 +29,7 @@ void otr_init_module(void);
void (*otr_init)(void);
char* (*otr_libotr_version)(void);
char* (*otr_start_query)(void);
void (*otr_on_connect)(ProfAccount *account);
void (*otr_keygen)(ProfAccount *account);

View File

@ -25,6 +25,8 @@
OtrlPolicy otrlib_policy(void);
char* otrlib_start_query(void);
void otrlib_init_ops(OtrlMessageAppOps *ops);
ConnContext * otrlib_context_find(OtrlUserState user_state, const char * const recipient, char *jid);

View File

@ -31,6 +31,12 @@ otrlib_policy(void)
return OTRL_POLICY_ALLOW_V1 | OTRL_POLICY_ALLOW_V2 ;
}
char *
otrlib_start_query(void)
{
return "?OTR?v2?";
}
static int
cb_display_otr_message(void *opdata, const char *accountname,
const char *protocol, const char *username, const char *msg)

View File

@ -32,6 +32,12 @@ otrlib_policy(void)
return OTRL_POLICY_ALLOW_V1 | OTRL_POLICY_ALLOW_V2 | OTRL_POLICY_ALLOW_V3;
}
char *
otrlib_start_query(void)
{
return "?OTR?v23?";
}
static const char*
cb_otr_error_message(void *opdata, ConnContext *context,
OtrlErrorCode err_code)