diff options
author | James Booth <boothj5@gmail.com> | 2014-01-12 01:20:22 +0000 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2014-01-12 01:20:22 +0000 |
commit | 462e84ea8218d267164ea563ea00412e57e3fb41 (patch) | |
tree | af96d23e6ff96a1dbb9323790f2de4d5b26ed7a9 /src/ui/core.c | |
parent | f14a9ed72df27c4ed93489c029967a16d2e72738 (diff) | |
download | profani-tty-462e84ea8218d267164ea563ea00412e57e3fb41.tar.gz |
Added /otr trust|untrust commands
Diffstat (limited to 'src/ui/core.c')
-rw-r--r-- | src/ui/core.c | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/src/ui/core.c b/src/ui/core.c index fc6ca40e..e0b934ae 100644 --- a/src/ui/core.c +++ b/src/ui/core.c @@ -593,11 +593,12 @@ _ui_next_win(void) } static void -_ui_gone_secure(const char * const recipient) +_ui_gone_secure(const char * const recipient, gboolean trusted) { ProfWin *window = wins_get_by_recipient(recipient); if (window != NULL) { window->is_otr = TRUE; + window->is_trusted = trusted; win_vprint_line(window, '!', 0, "OTR session started."); if (wins_is_current(window)) { @@ -616,6 +617,7 @@ _ui_gone_insecure(const char * const recipient) ProfWin *window = wins_get_by_recipient(recipient); if (window != NULL) { window->is_otr = FALSE; + window->is_trusted = FALSE; win_vprint_line(window, '!', 0, "OTR session ended."); if (wins_is_current(window)) { @@ -629,6 +631,42 @@ _ui_gone_insecure(const char * const recipient) } static void +_ui_trust(const char * const recipient) +{ + ProfWin *window = wins_get_by_recipient(recipient); + if (window != NULL) { + window->is_otr = TRUE; + window->is_trusted = TRUE; + + if (wins_is_current(window)) { + GString *recipient_str = _get_recipient_string(window); + title_bar_set_recipient(recipient_str->str); + g_string_free(recipient_str, TRUE); + title_bar_draw(); + wins_refresh_current(); + } + } +} + +static void +_ui_untrust(const char * const recipient) +{ + ProfWin *window = wins_get_by_recipient(recipient); + if (window != NULL) { + window->is_otr = TRUE; + window->is_trusted = FALSE; + + if (wins_is_current(window)) { + GString *recipient_str = _get_recipient_string(window); + title_bar_set_recipient(recipient_str->str); + g_string_free(recipient_str, TRUE); + title_bar_draw(); + wins_refresh_current(); + } + } +} + +static void _ui_previous_win(void) { ui_current_page_off(); @@ -1688,4 +1726,6 @@ ui_init_module(void) ui_current_set_otr = _ui_current_set_otr; ui_gone_secure = _ui_gone_secure; ui_gone_insecure = _ui_gone_insecure; + ui_trust = _ui_trust; + ui_untrust = _ui_untrust; } |