diff options
Diffstat (limited to 'src/common/history.c')
-rw-r--r-- | src/common/history.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/common/history.c b/src/common/history.c index 6724662c1..33f13e963 100644 --- a/src/common/history.c +++ b/src/common/history.c @@ -40,6 +40,32 @@ int num_history_general = 0; /* + * history_hide_password: hide a nickserv password + */ + +void +history_hide_password (char *string) +{ + char *pos_pwd; + + if (strstr (string, "nickserv ")) + { + pos_pwd = strstr (string, "identify "); + if (!pos_pwd) + pos_pwd = strstr (string, "register "); + if (pos_pwd) + { + pos_pwd += 9; + while (pos_pwd[0]) + { + pos_pwd[0] = '*'; + pos_pwd++; + } + } + } +} + +/* * history_add: add a text/command to history */ @@ -53,6 +79,8 @@ history_add (void *buffer, char *string) if (new_history) { new_history->text = strdup (string); + if (cfg_log_hide_nickserv_pwd) + history_hide_password (new_history->text); if (history_general) history_general->prev_history = new_history; @@ -82,6 +110,8 @@ history_add (void *buffer, char *string) if (new_history) { new_history->text = strdup (string); + if (cfg_log_hide_nickserv_pwd) + history_hide_password (new_history->text); if (((t_gui_buffer *)(buffer))->history) ((t_gui_buffer *)(buffer))->history->prev_history = new_history; |