Move all handling of SED messages and notices into ctcp.c, re-enable SED notices
Actual encryped messages and notices are now printed directly from do_sed() / do_reply_sed(). Inline CTCP replacement is only done if the message cannot be decrypted (for the [ENCRYPTED MESSAGE] placeholder). This removes the need for the global flag 'sed' to alter the NOTICE and PRIVMSG handling. A side-effect of this is that SED PRIVMSGs now do not go through the usual PRIVMSG ignore and flood handling. This is acceptable because messages can only go through this path if the sender has actually been added as a SED peer with /ENCRYPT, and it still goes through the CTCP ignore and flood handling.
This commit is contained in:
parent
fb8dfc3946
commit
06aa5cb671
|
@ -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)
|
||||
|
|
|
@ -55,7 +55,6 @@
|
|||
extern CtcpEntryDll *dll_ctcp;
|
||||
|
||||
|
||||
extern int sed;
|
||||
extern int in_ctcp_flag;
|
||||
|
||||
#define CTCP_DELIM_CHAR '\001'
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue