Cleanups and simplifications in p_privmsg
This commit is contained in:
@@ -479,30 +479,28 @@ static void p_wallops(char *from, char **ArgList)
|
||||
|
||||
static void p_privmsg(char *from, char **Args)
|
||||
{
|
||||
int level,
|
||||
list_type,
|
||||
flood_type,
|
||||
log_type,
|
||||
ar_true = 0,
|
||||
no_flood = 1,
|
||||
do_beep = 0;
|
||||
|
||||
unsigned char ignore_type;
|
||||
|
||||
char *ptr = NULL,
|
||||
*to,
|
||||
*high;
|
||||
|
||||
int level;
|
||||
int list_type;
|
||||
int flood_type;
|
||||
int log_type;
|
||||
int ar_true = 0;
|
||||
int flooding = 0;
|
||||
long ignore_type;
|
||||
char *ptr;
|
||||
char *to;
|
||||
char *high;
|
||||
ChannelList *channel = NULL;
|
||||
NickList *tmpnick = NULL;
|
||||
|
||||
if (!from)
|
||||
return;
|
||||
|
||||
PasteArgs(Args, 1);
|
||||
to = Args[0];
|
||||
ptr = Args[1];
|
||||
if (!to || !ptr)
|
||||
{ fake(); return; }
|
||||
|
||||
doing_privmsg = 1;
|
||||
|
||||
ptr = do_ctcp(from, to, ptr);
|
||||
@@ -570,33 +568,27 @@ static void p_privmsg(char *from, char **Args)
|
||||
}
|
||||
|
||||
#ifdef WANT_TCL
|
||||
{
|
||||
int x = 0;
|
||||
char *cmd = NULL;
|
||||
switch (list_type)
|
||||
{
|
||||
case MSG_LIST:
|
||||
case MSG_GROUP_LIST:
|
||||
{
|
||||
char *ctcp_ptr;
|
||||
ctcp_ptr = LOCAL_COPY(ptr);
|
||||
cmd = next_arg(ctcp_ptr, &ctcp_ptr);
|
||||
x = check_tcl_msg(cmd, from, FromUserHost, from, ctcp_ptr);
|
||||
if (!x)
|
||||
char *ctcp_ptr = LOCAL_COPY(ptr);
|
||||
char *cmd = next_arg(ctcp_ptr, &ctcp_ptr);
|
||||
if (!check_tcl_msg(cmd, from, FromUserHost, from, ctcp_ptr))
|
||||
check_tcl_msgm(cmd, from, FromUserHost, from, ctcp_ptr);
|
||||
break;
|
||||
}
|
||||
|
||||
case PUBLIC_MSG_LIST:
|
||||
case PUBLIC_LIST:
|
||||
case PUBLIC_OTHER_LIST:
|
||||
{
|
||||
x = check_tcl_pub(from, FromUserHost, to, ptr);
|
||||
if (!x)
|
||||
if (!check_tcl_pub(from, FromUserHost, to, ptr))
|
||||
check_tcl_pubm(from, FromUserHost, to, ptr);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
update_stats(PUBLICLIST, tmpnick, channel, 0);
|
||||
|
||||
@@ -606,30 +598,29 @@ static void p_privmsg(char *from, char **Args)
|
||||
int blah = 0;
|
||||
if (is_other_flood(channel, tmpnick, PUBLIC_FLOOD, &blah))
|
||||
{
|
||||
no_flood = 0;
|
||||
flooding = 1;
|
||||
flood_prot(tmpnick->nick, FromUserHost, flood_type, get_cset_int_var(channel->csets, PUBFLOOD_IGNORE_TIME_CSET), channel->channel);
|
||||
}
|
||||
}
|
||||
else
|
||||
no_flood = check_flooding(from, flood_type, ptr, NULL);
|
||||
flooding = !check_flooding(from, flood_type, ptr, NULL);
|
||||
|
||||
{
|
||||
int added_to_tab = 0;
|
||||
if (list_type == PUBLIC_LIST || list_type == PUBLIC_OTHER_LIST || list_type == PUBLIC_MSG_LIST)
|
||||
{
|
||||
if (check_auto_reply(ptr))
|
||||
{
|
||||
addtabkey(from, "msg", 1);
|
||||
ar_true = 1;
|
||||
added_to_tab = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (!flooding)
|
||||
{
|
||||
int do_beep = 0;
|
||||
|
||||
switch (list_type)
|
||||
{
|
||||
case PUBLIC_MSG_LIST:
|
||||
{
|
||||
if (!no_flood)
|
||||
break;
|
||||
if (do_hook(list_type, "%s %s %s", from, to, ptr))
|
||||
{
|
||||
logmsg(LOG_PUBLIC, from, 0, "%s %s", to, ptr);
|
||||
@@ -637,11 +628,8 @@ static void p_privmsg(char *from, char **Args)
|
||||
do_beep = 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case MSG_GROUP_LIST:
|
||||
{
|
||||
if (!no_flood)
|
||||
break;
|
||||
if (do_hook(list_type, "%s %s %s", from, to, ptr))
|
||||
{
|
||||
logmsg(LOG_PUBLIC, from, 0,"%s %s", FromUserHost, ptr);
|
||||
@@ -649,11 +637,8 @@ static void p_privmsg(char *from, char **Args)
|
||||
do_beep = 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case MSG_LIST:
|
||||
{
|
||||
if (!no_flood)
|
||||
break;
|
||||
set_server_recv_nick(from_server, from);
|
||||
#ifdef WANT_CDCC
|
||||
if ((msgcdcc(from, to, ptr)) == NULL)
|
||||
@@ -675,7 +660,6 @@ static void p_privmsg(char *from, char **Args)
|
||||
else
|
||||
do_beep = 1;
|
||||
put_it("%s", convert_output_format(fget_string_var(FORMAT_MSG_FSET), "%s %s %s %s", update_clock(GET_TIME), from, FromUserHost, ptr));
|
||||
if (!added_to_tab)
|
||||
addtabkey(from, "msg", 0);
|
||||
logmsg(LOG_MSG, from, 0,"%s %s", FromUserHost, ptr);
|
||||
}
|
||||
@@ -686,11 +670,8 @@ static void p_privmsg(char *from, char **Args)
|
||||
my_send_to_server(from_server, "NOTICE %s :%s", from, stripansicodes(convert_output_format(fget_string_var(FORMAT_SEND_AWAY_FSET), "%l %l %s", now, get_server_awaytime(from_server), get_int_var(MSGLOG_VAR)?"On":"Off")));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case PUBLIC_LIST:
|
||||
{
|
||||
if (!no_flood)
|
||||
break;
|
||||
annoy_kicks(list_type, to, from, ptr, tmpnick);
|
||||
if (ar_true)
|
||||
list_type = PUBLIC_AR_LIST;
|
||||
@@ -702,11 +683,8 @@ static void p_privmsg(char *from, char **Args)
|
||||
do_beep = 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case PUBLIC_OTHER_LIST:
|
||||
{
|
||||
if (!no_flood)
|
||||
break;
|
||||
annoy_kicks(list_type, to, from, ptr, tmpnick);
|
||||
if (ar_true)
|
||||
list_type = PUBLIC_OTHER_AR_LIST;
|
||||
@@ -718,15 +696,14 @@ static void p_privmsg(char *from, char **Args)
|
||||
do_beep = 1;
|
||||
}
|
||||
break;
|
||||
} /* case */
|
||||
} /* switch */
|
||||
}
|
||||
|
||||
if ((beep_on_level & log_type) && do_beep)
|
||||
beep_em(1);
|
||||
|
||||
if (no_flood)
|
||||
grab_http(from, to, ptr);
|
||||
}
|
||||
|
||||
set_lastlog_msg_level(level);
|
||||
reset_display_target();
|
||||
doing_privmsg = 0;
|
||||
|
||||
Reference in New Issue
Block a user