summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/common/history.c30
-rw-r--r--src/common/weeconfig.c5
-rw-r--r--src/common/weeconfig.h1
-rw-r--r--src/irc/irc-send.c36
4 files changed, 72 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;
diff --git a/src/common/weeconfig.c b/src/common/weeconfig.c
index d78d581ee..38bf40427 100644
--- a/src/common/weeconfig.c
+++ b/src/common/weeconfig.c
@@ -417,6 +417,7 @@ int cfg_log_auto_channel;
int cfg_log_auto_private;
char *cfg_log_path;
char *cfg_log_timestamp;
+int cfg_log_hide_nickserv_pwd;
t_config_option weechat_options_log[] =
{ { "log_auto_server", N_("automatically log server messages"),
@@ -439,6 +440,10 @@ t_config_option weechat_options_log[] =
N_("timestamp for log (see man strftime for date/time specifiers)"),
OPTION_TYPE_STRING, 0, 0, 0,
"%Y %b %d %H:%M:%S", NULL, NULL, &cfg_log_timestamp, NULL },
+ { "log_hide_nickserv_pwd", N_("hide password displayed by nickserv"),
+ N_("hide password displayed by nickserv"),
+ OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
+ NULL, NULL, &cfg_log_hide_nickserv_pwd, NULL, NULL },
{ NULL, NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL }
};
diff --git a/src/common/weeconfig.h b/src/common/weeconfig.h
index c90d287b7..d5e217720 100644
--- a/src/common/weeconfig.h
+++ b/src/common/weeconfig.h
@@ -144,6 +144,7 @@ extern int cfg_log_auto_channel;
extern int cfg_log_auto_private;
extern char *cfg_log_path;
extern char *cfg_log_timestamp;
+extern int cfg_log_hide_nickserv_pwd;
extern int cfg_dcc_auto_accept_files;
extern int cfg_dcc_auto_accept_chats;
diff --git a/src/irc/irc-send.c b/src/irc/irc-send.c
index c55aacb36..1db8219c7 100644
--- a/src/irc/irc-send.c
+++ b/src/irc/irc-send.c
@@ -513,6 +513,7 @@ int
irc_cmd_send_msg (t_irc_server *server, char *arguments)
{
char *pos, *pos_comma;
+ char *msg_pwd_hidden, *pos_pwd;
t_irc_channel *ptr_channel;
t_irc_nick *ptr_nick;
@@ -582,6 +583,41 @@ irc_cmd_send_msg (t_irc_server *server, char *arguments)
}
else
{
+ /* message to nickserv with identify ? */
+ if (strcmp (arguments, "nickserv") == 0)
+ {
+ msg_pwd_hidden = strdup (pos);
+ if (cfg_log_hide_nickserv_pwd)
+ {
+ pos_pwd = strstr (msg_pwd_hidden, "identify ");
+ if (!pos_pwd)
+ pos_pwd = strstr (msg_pwd_hidden, "register ");
+ if (pos_pwd)
+ {
+ pos_pwd += 9;
+ while (pos_pwd[0])
+ {
+ pos_pwd[0] = '*';
+ pos_pwd++;
+ }
+ }
+ }
+ gui_printf_color_type (server->buffer,
+ MSG_TYPE_NICK,
+ COLOR_WIN_CHAT_DARK, "-");
+ gui_printf_color_type (server->buffer,
+ MSG_TYPE_NICK,
+ COLOR_WIN_CHAT_NICK, "%s", arguments);
+ gui_printf_color_type (server->buffer,
+ MSG_TYPE_NICK,
+ COLOR_WIN_CHAT_DARK, "-");
+ gui_printf_color (server->buffer,
+ COLOR_WIN_CHAT, " %s\n", msg_pwd_hidden);
+ server_sendf (server, "PRIVMSG %s :%s\r\n", arguments, pos);
+ free (msg_pwd_hidden);
+ return 0;
+ }
+
ptr_channel = channel_search (server, arguments);
if (!ptr_channel)
{