mirror of
https://github.com/profanity-im/profanity.git
synced 2024-11-03 19:37:16 -05:00
Added /otr theirfp with hardcoded fingerprint
This commit is contained in:
parent
bc8532b79c
commit
03086c0384
@ -2312,8 +2312,23 @@ cmd_otr(gchar **args, struct cmd_help_t help)
|
||||
otr_keygen(account);
|
||||
return TRUE;
|
||||
} else if (strcmp(args[0], "myfp") == 0) {
|
||||
char *fingerprint = otr_get_fingerprint();
|
||||
char *fingerprint = otr_get_my_fingerprint();
|
||||
cons_show("Your fingerprint: %s", fingerprint);
|
||||
free(fingerprint);
|
||||
return TRUE;
|
||||
} else if (strcmp(args[0], "theirfp") == 0) {
|
||||
win_type_t win_type = ui_current_win_type();
|
||||
|
||||
if (win_type != WIN_CHAT) {
|
||||
ui_current_print_line("You must be in a regular chat window to view a recipient's fingerprint.");
|
||||
} else if (!ui_current_win_is_otr()) {
|
||||
ui_current_print_line("You not currently in an OTR session with this recipient.");
|
||||
} else {
|
||||
char *recipient = ui_current_recipient();
|
||||
char *fingerprint = otr_get_their_fingerprint(recipient);
|
||||
ui_current_print_line("OTR fingerprint for %s: %s", recipient, fingerprint);
|
||||
free(fingerprint);
|
||||
}
|
||||
return TRUE;
|
||||
} else if (strcmp(args[0], "start") == 0) {
|
||||
win_type_t win_type = ui_current_win_type();
|
||||
|
@ -333,7 +333,7 @@ otr_key_loaded(void)
|
||||
}
|
||||
|
||||
char *
|
||||
otr_get_fingerprint(void)
|
||||
otr_get_my_fingerprint(void)
|
||||
{
|
||||
char fingerprint[45];
|
||||
otrl_privkey_fingerprint(user_state, fingerprint, jid, "xmpp");
|
||||
@ -342,6 +342,13 @@ otr_get_fingerprint(void)
|
||||
return result;
|
||||
}
|
||||
|
||||
char *
|
||||
otr_get_their_fingerprint(char *recipient)
|
||||
{
|
||||
char *fingerprint = "1234 5678";
|
||||
return strdup(fingerprint);
|
||||
}
|
||||
|
||||
char *
|
||||
otr_encrypt_message(const char * const to, const char * const message)
|
||||
{
|
||||
|
@ -31,7 +31,8 @@ void otr_keygen(ProfAccount *account);
|
||||
|
||||
gboolean otr_key_loaded(void);
|
||||
|
||||
char * otr_get_fingerprint(void);
|
||||
char * otr_get_my_fingerprint(void);
|
||||
char * otr_get_their_fingerprint(char *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);
|
||||
|
@ -131,7 +131,7 @@ _cons_show_typing(const char * const barejid)
|
||||
display_usr = barejid;
|
||||
}
|
||||
|
||||
win_print_line(console, '-', COLOUR_TYPING, "!! %s is typing a message...", display_usr);
|
||||
win_vprint_line(console, '-', COLOUR_TYPING, "!! %s is typing a message...", display_usr);
|
||||
|
||||
wins_refresh_console();
|
||||
cons_alert();
|
||||
|
@ -746,8 +746,11 @@ _ui_current_print_line(const char * const msg, ...)
|
||||
ProfWin *current = wins_get_current();
|
||||
va_list arg;
|
||||
va_start(arg, msg);
|
||||
win_print_line(current, '-', 0, msg, arg);
|
||||
GString *fmt_msg = g_string_new(NULL);
|
||||
g_string_vprintf(fmt_msg, msg, arg);
|
||||
win_print_line(current, '-', 0, fmt_msg->str);
|
||||
va_end(arg);
|
||||
g_string_free(fmt_msg, TRUE);
|
||||
win_refresh(current);
|
||||
}
|
||||
|
||||
@ -775,7 +778,7 @@ _ui_print_error_from_recipient(const char * const from, const char *err_msg)
|
||||
|
||||
ProfWin *window = wins_get_by_recipient(from);
|
||||
if (window != NULL) {
|
||||
win_print_line(window, '-', COLOUR_ERROR, "%s", err_msg);
|
||||
win_vprint_line(window, '-', COLOUR_ERROR, "%s", err_msg);
|
||||
if (wins_is_current(window)) {
|
||||
wins_refresh_current();
|
||||
}
|
||||
@ -833,7 +836,7 @@ _ui_recipient_gone(const char * const barejid)
|
||||
|
||||
ProfWin *window = wins_get_by_recipient(barejid);
|
||||
if (window != NULL) {
|
||||
win_print_line(window, '!', COLOUR_GONE, "<- %s has left the conversation.", display_usr);
|
||||
win_vprint_line(window, '!', COLOUR_GONE, "<- %s has left the conversation.", display_usr);
|
||||
if (wins_is_current(window)) {
|
||||
wins_refresh_current();
|
||||
}
|
||||
@ -1329,7 +1332,7 @@ _ui_status_room(const char * const contact)
|
||||
if (pcontact != NULL) {
|
||||
win_show_contact(current, pcontact);
|
||||
} else {
|
||||
win_print_line(current, '-', 0, "No such participant \"%s\" in room.", contact);
|
||||
win_vprint_line(current, '-', 0, "No such participant \"%s\" in room.", contact);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -84,6 +84,16 @@ win_print_time(ProfWin* window, char show_char)
|
||||
|
||||
void
|
||||
win_print_line(ProfWin *window, const char show_char, int attrs,
|
||||
const char * const msg)
|
||||
{
|
||||
win_print_time(window, show_char);
|
||||
wattron(window->win, attrs);
|
||||
wprintw(window->win, "%s\n", msg);
|
||||
wattroff(window->win, attrs);
|
||||
}
|
||||
|
||||
void
|
||||
win_vprint_line(ProfWin *window, const char show_char, int attrs,
|
||||
const char * const msg, ...)
|
||||
{
|
||||
va_list arg;
|
||||
|
@ -58,8 +58,10 @@ typedef struct prof_win_t {
|
||||
|
||||
ProfWin* win_create(const char * const title, int cols, win_type_t type);
|
||||
void win_free(ProfWin *window);
|
||||
void win_print_line(ProfWin *self, const char show_char, int attrs,
|
||||
void win_vprint_line(ProfWin *self, const char show_char, int attrs,
|
||||
const char * const msg, ...);
|
||||
void win_print_line(ProfWin *self, const char show_char, int attrs,
|
||||
const char * const msg);
|
||||
void win_refresh(ProfWin *window);
|
||||
void win_page_off(ProfWin *window);
|
||||
void win_print_time(ProfWin *window, char show_char);
|
||||
|
Loading…
Reference in New Issue
Block a user