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)
|
static void p_privmsg(char *from, char **Args)
|
||||||
{
|
{
|
||||||
int level,
|
int level;
|
||||||
list_type,
|
int list_type;
|
||||||
flood_type,
|
int flood_type;
|
||||||
log_type,
|
int log_type;
|
||||||
ar_true = 0,
|
int ar_true = 0;
|
||||||
no_flood = 1,
|
int flooding = 0;
|
||||||
do_beep = 0;
|
long ignore_type;
|
||||||
|
char *ptr;
|
||||||
unsigned char ignore_type;
|
char *to;
|
||||||
|
char *high;
|
||||||
char *ptr = NULL,
|
|
||||||
*to,
|
|
||||||
*high;
|
|
||||||
|
|
||||||
ChannelList *channel = NULL;
|
ChannelList *channel = NULL;
|
||||||
NickList *tmpnick = NULL;
|
NickList *tmpnick = NULL;
|
||||||
|
|
||||||
if (!from)
|
if (!from)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
PasteArgs(Args, 1);
|
PasteArgs(Args, 1);
|
||||||
to = Args[0];
|
to = Args[0];
|
||||||
ptr = Args[1];
|
ptr = Args[1];
|
||||||
if (!to || !ptr)
|
if (!to || !ptr)
|
||||||
{ fake(); return; }
|
{ fake(); return; }
|
||||||
|
|
||||||
doing_privmsg = 1;
|
doing_privmsg = 1;
|
||||||
|
|
||||||
ptr = do_ctcp(from, to, ptr);
|
ptr = do_ctcp(from, to, ptr);
|
||||||
@@ -570,33 +568,27 @@ static void p_privmsg(char *from, char **Args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WANT_TCL
|
#ifdef WANT_TCL
|
||||||
{
|
switch (list_type)
|
||||||
int x = 0;
|
|
||||||
char *cmd = NULL;
|
|
||||||
switch(list_type)
|
|
||||||
{
|
{
|
||||||
case MSG_LIST:
|
case MSG_LIST:
|
||||||
case MSG_GROUP_LIST:
|
case MSG_GROUP_LIST:
|
||||||
{
|
{
|
||||||
char *ctcp_ptr;
|
char *ctcp_ptr = LOCAL_COPY(ptr);
|
||||||
ctcp_ptr = LOCAL_COPY(ptr);
|
char *cmd = next_arg(ctcp_ptr, &ctcp_ptr);
|
||||||
cmd = next_arg(ctcp_ptr, &ctcp_ptr);
|
if (!check_tcl_msg(cmd, from, FromUserHost, from, ctcp_ptr))
|
||||||
x = check_tcl_msg(cmd, from, FromUserHost, from, ctcp_ptr);
|
|
||||||
if (!x)
|
|
||||||
check_tcl_msgm(cmd, from, FromUserHost, from, ctcp_ptr);
|
check_tcl_msgm(cmd, from, FromUserHost, from, ctcp_ptr);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case PUBLIC_MSG_LIST:
|
case PUBLIC_MSG_LIST:
|
||||||
case PUBLIC_LIST:
|
case PUBLIC_LIST:
|
||||||
case PUBLIC_OTHER_LIST:
|
case PUBLIC_OTHER_LIST:
|
||||||
{
|
{
|
||||||
x = check_tcl_pub(from, FromUserHost, to, ptr);
|
if (!check_tcl_pub(from, FromUserHost, to, ptr))
|
||||||
if (!x)
|
|
||||||
check_tcl_pubm(from, FromUserHost, to, ptr);
|
check_tcl_pubm(from, FromUserHost, to, ptr);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
update_stats(PUBLICLIST, tmpnick, channel, 0);
|
update_stats(PUBLICLIST, tmpnick, channel, 0);
|
||||||
|
|
||||||
@@ -606,30 +598,29 @@ static void p_privmsg(char *from, char **Args)
|
|||||||
int blah = 0;
|
int blah = 0;
|
||||||
if (is_other_flood(channel, tmpnick, PUBLIC_FLOOD, &blah))
|
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);
|
flood_prot(tmpnick->nick, FromUserHost, flood_type, get_cset_int_var(channel->csets, PUBFLOOD_IGNORE_TIME_CSET), channel->channel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
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 (list_type == PUBLIC_LIST || list_type == PUBLIC_OTHER_LIST || list_type == PUBLIC_MSG_LIST)
|
||||||
{
|
{
|
||||||
if (check_auto_reply(ptr))
|
if (check_auto_reply(ptr))
|
||||||
{
|
{
|
||||||
addtabkey(from, "msg", 1);
|
addtabkey(from, "msg", 1);
|
||||||
ar_true = 1;
|
ar_true = 1;
|
||||||
added_to_tab = 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!flooding)
|
||||||
|
{
|
||||||
|
int do_beep = 0;
|
||||||
|
|
||||||
switch (list_type)
|
switch (list_type)
|
||||||
{
|
{
|
||||||
case PUBLIC_MSG_LIST:
|
case PUBLIC_MSG_LIST:
|
||||||
{
|
|
||||||
if (!no_flood)
|
|
||||||
break;
|
|
||||||
if (do_hook(list_type, "%s %s %s", from, to, ptr))
|
if (do_hook(list_type, "%s %s %s", from, to, ptr))
|
||||||
{
|
{
|
||||||
logmsg(LOG_PUBLIC, from, 0, "%s %s", 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;
|
do_beep = 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case MSG_GROUP_LIST:
|
case MSG_GROUP_LIST:
|
||||||
{
|
|
||||||
if (!no_flood)
|
|
||||||
break;
|
|
||||||
if (do_hook(list_type, "%s %s %s", from, to, ptr))
|
if (do_hook(list_type, "%s %s %s", from, to, ptr))
|
||||||
{
|
{
|
||||||
logmsg(LOG_PUBLIC, from, 0,"%s %s", FromUserHost, 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;
|
do_beep = 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case MSG_LIST:
|
case MSG_LIST:
|
||||||
{
|
|
||||||
if (!no_flood)
|
|
||||||
break;
|
|
||||||
set_server_recv_nick(from_server, from);
|
set_server_recv_nick(from_server, from);
|
||||||
#ifdef WANT_CDCC
|
#ifdef WANT_CDCC
|
||||||
if ((msgcdcc(from, to, ptr)) == NULL)
|
if ((msgcdcc(from, to, ptr)) == NULL)
|
||||||
@@ -675,7 +660,6 @@ static void p_privmsg(char *from, char **Args)
|
|||||||
else
|
else
|
||||||
do_beep = 1;
|
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));
|
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);
|
addtabkey(from, "msg", 0);
|
||||||
logmsg(LOG_MSG, from, 0,"%s %s", FromUserHost, ptr);
|
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")));
|
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;
|
break;
|
||||||
}
|
|
||||||
case PUBLIC_LIST:
|
case PUBLIC_LIST:
|
||||||
{
|
|
||||||
if (!no_flood)
|
|
||||||
break;
|
|
||||||
annoy_kicks(list_type, to, from, ptr, tmpnick);
|
annoy_kicks(list_type, to, from, ptr, tmpnick);
|
||||||
if (ar_true)
|
if (ar_true)
|
||||||
list_type = PUBLIC_AR_LIST;
|
list_type = PUBLIC_AR_LIST;
|
||||||
@@ -702,11 +683,8 @@ static void p_privmsg(char *from, char **Args)
|
|||||||
do_beep = 1;
|
do_beep = 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case PUBLIC_OTHER_LIST:
|
case PUBLIC_OTHER_LIST:
|
||||||
{
|
|
||||||
if (!no_flood)
|
|
||||||
break;
|
|
||||||
annoy_kicks(list_type, to, from, ptr, tmpnick);
|
annoy_kicks(list_type, to, from, ptr, tmpnick);
|
||||||
if (ar_true)
|
if (ar_true)
|
||||||
list_type = PUBLIC_OTHER_AR_LIST;
|
list_type = PUBLIC_OTHER_AR_LIST;
|
||||||
@@ -718,15 +696,14 @@ static void p_privmsg(char *from, char **Args)
|
|||||||
do_beep = 1;
|
do_beep = 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
} /* case */
|
|
||||||
} /* switch */
|
} /* switch */
|
||||||
}
|
|
||||||
|
|
||||||
if ((beep_on_level & log_type) && do_beep)
|
if ((beep_on_level & log_type) && do_beep)
|
||||||
beep_em(1);
|
beep_em(1);
|
||||||
|
|
||||||
if (no_flood)
|
|
||||||
grab_http(from, to, ptr);
|
grab_http(from, to, ptr);
|
||||||
|
}
|
||||||
|
|
||||||
set_lastlog_msg_level(level);
|
set_lastlog_msg_level(level);
|
||||||
reset_display_target();
|
reset_display_target();
|
||||||
doing_privmsg = 0;
|
doing_privmsg = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user