diff --git a/Changelog b/Changelog index 1adc849..dc3dd67 100644 --- a/Changelog +++ b/Changelog @@ -1,5 +1,8 @@ [Changes 1.2.2] +* Move all handling of SED messages and notices into ctcp.c, re-enable + SED notices. (caf) + * Handle SED-encrypted CTCP replies properly. (caf) * Add sent_nick flag to NickList struct, bump MODULE_VERSION. (caf) diff --git a/include/ctcp.h b/include/ctcp.h index 1a2cb0a..40d2575 100644 --- a/include/ctcp.h +++ b/include/ctcp.h @@ -55,7 +55,6 @@ extern CtcpEntryDll *dll_ctcp; -extern int sed; extern int in_ctcp_flag; #define CTCP_DELIM_CHAR '\001' diff --git a/source/ctcp.c b/source/ctcp.c index d3c3c16..ed2b500 100644 --- a/source/ctcp.c +++ b/source/ctcp.c @@ -184,9 +184,6 @@ static char *ctcp_type[] = "NOTICE" }; -/* This is set to one if we parsed an SED */ -int sed = 0; - /* * in_ctcp_flag is set to true when IRCII is handling a CTCP request. This * is used by the ctcp() sending function to force NOTICEs to be used in any @@ -632,7 +629,6 @@ static char *try_decrypt(char *from, char *to, char *msg) CTCP_HANDLER(do_sed) { char *ret; - char *ret2; ret = try_decrypt(from, to, cmd); @@ -642,16 +638,17 @@ CTCP_HANDLER(do_sed) * There might be a CTCP message in there, * so we see if we can find it. */ - ret2 = m_strdup(do_ctcp(from, to, ret)); - sed = 1; + char *ptr = do_ctcp(from, to, ret); + if (*ptr && do_hook(ENCRYPTED_PRIVMSG_LIST, "%s %s %s", from, to, ptr)) + put_it("%s",convert_output_format(fget_string_var(FORMAT_ENCRYPTED_PRIVMSG_FSET), "%s %s %s %s %s", update_clock(GET_TIME), from, FromUserHost, to, ptr)); + *ret = 0; } else { - ret2 = m_strdup("[ENCRYPTED MESSAGE]"); + ret = m_strdup("[ENCRYPTED MESSAGE]"); } - new_free(&ret); - return ret2; + return ret; } /* do_sed_reply: Same as do_sed, but CTCPs within the SED are handled as @@ -659,7 +656,6 @@ CTCP_HANDLER(do_sed) CTCP_HANDLER(do_sed_reply) { char *ret; - char *ret2; ret = try_decrypt(from, to, cmd); @@ -669,16 +665,17 @@ CTCP_HANDLER(do_sed_reply) * There might be a CTCP reply in there, * so we see if we can find it. */ - ret2 = m_strdup(do_notice_ctcp(from, to, ret)); - sed = 1; + char *ptr = do_notice_ctcp(from, to, ret); + if (*ptr && do_hook(ENCRYPTED_NOTICE_LIST, "%s %s %s", from, to, ptr)) + put_it("%s",convert_output_format(fget_string_var(FORMAT_ENCRYPTED_NOTICE_FSET), "%s %s %s %s %s", update_clock(GET_TIME), from, FromUserHost, to, ptr)); + *ret = 0; } else { - ret2 = m_strdup("[ENCRYPTED MESSAGE]"); + ret = m_strdup("[ENCRYPTED MESSAGE]"); } - new_free(&ret); - return ret2; + return ret; } CTCP_HANDLER(do_utc) diff --git a/source/notice.c b/source/notice.c index 5609b34..314a5c5 100644 --- a/source/notice.c +++ b/source/notice.c @@ -574,15 +574,6 @@ void parse_notice(char *from, char **Args) goto notice_cleanup; } - if (sed && !do_hook(ENCRYPTED_NOTICE_LIST, "%s %s %s", from, to, line)) - { -#if 0 - put_it("%s", convert_output_format(fget_string_var(FORMAT_ENCRYPTED_NOTICE_FSET), "%s %s %s %s", update_clock(GET_TIME), from, FromUserHost, line)); -#endif - sed = 0; - goto notice_cleanup; - } - if (!check_chanwall_notice(from, line, list_type)) { char *s; diff --git a/source/parse.c b/source/parse.c index 1a5c555..b316caa 100644 --- a/source/parse.c +++ b/source/parse.c @@ -613,13 +613,6 @@ static void p_privmsg(char *from, char **Args) else no_flood = check_flooding(from, flood_type, ptr, NULL); - if (sed == 1) - { - if (do_hook(ENCRYPTED_PRIVMSG_LIST,"%s %s %s",from, to, ptr)) - put_it("%s",convert_output_format(fget_string_var(FORMAT_ENCRYPTED_PRIVMSG_FSET), "%s %s %s %s %s", update_clock(GET_TIME), from, FromUserHost, to, ptr)); - sed = 0; - } - else { int added_to_tab = 0; if (list_type == PUBLIC_LIST || list_type == PUBLIC_OTHER_LIST || list_type == PUBLIC_MSG_LIST)