summaryrefslogtreecommitdiff
path: root/src/common/history.c
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2004-10-17 11:28:03 +0000
committerSebastien Helleu <flashcode@flashtux.org>2004-10-17 11:28:03 +0000
commit482d3275621c40888ffcc942e905aff6ea78b92e (patch)
treead6432b6a1a4996ccb7b6ef8ed6ce71a08650a2a /src/common/history.c
parentcb5269404c50def3f5df21cb7f3e6fe778cb4f21 (diff)
downloadweechat-482d3275621c40888ffcc942e905aff6ea78b92e.zip
nickserv passwords hidden (new config option: log_hide_nickserv_pwd on/off)
Diffstat (limited to 'src/common/history.c')
-rw-r--r--src/common/history.c30
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;