Esempio n. 1
0
int delay_opz (void *arg, char *sub)
{
char * args = (char *)arg;
char * from = NULL;
char * host = NULL;
char * channel = NULL;	
char * mode = NULL;
char * serv_num = NULL;
ChannelList *chan = NULL;
int	this_server = from_server;
char *p = (char *) arg; /* original args unmodified  so we can free them */
	

	channel = next_arg(args, &args);
	from = next_arg(args, &args);
	host = next_arg(args, &args);
	mode = next_arg(args, &args);

	if ((serv_num = next_arg(args, &args)))
		this_server = my_atol(serv_num);
	chan = lookup_channel(channel, this_server, 0);
	if (chan && is_on_channel(channel, this_server, from) && chan->chop) 
	{
		NickList *nick;
		for (nick = next_nicklist(chan, NULL); nick; nick = next_nicklist(chan, nick))
		{
			if (!my_stricmp(nick->nick, from))
			{
				if (!my_stricmp(host, nick->host))
					break;
				else
				{
					new_free(&p); new_free(&sub);
					return 0;
				}
			}
		}
		if (nick && ((!nick_isop(nick) && *mode == 'o') || (!nick_isvoice(nick) && *mode == 'v')))
		{
			my_send_to_server(this_server, "MODE %s +%s %s", channel, mode, from); 
			if (get_int_var(SEND_OP_MSG_VAR))
				my_send_to_server(this_server, "NOTICE %s :You have been delay Auto-%s'd", from, *mode == 'o'? "op":"voice");
		}
	}
	new_free(&p); new_free(&sub);
	return 0;
}
Esempio n. 2
0
static	void
cannot_join_channel(u_char *from, u_char **ArgList)
{
	u_char	*chan;
	u_char	buffer[BIG_BUFFER_SIZE];

	if (ArgList[0])
		chan = ArgList[0];
	else
		return;

	if (!is_on_channel(chan, parsing_server(),
			server_get_nickname(parsing_server())))
		remove_channel(chan, parsing_server());
	else
		return;

	PasteArgs(ArgList, 0);
	if (do_hook(current_numeric(), "%s %s", from, *ArgList)) {
		my_strmcpy(buffer, ArgList[0], sizeof buffer);
		switch(-current_numeric())
		{
		case 471:		/* #define ERR_CHANNELISFULL    471 */
			my_strmcat(buffer, " (Channel is full)", sizeof buffer);
			break;
		case 473:		/* #define ERR_INVITEONLYCHAN   473 */
			my_strmcat(buffer, " (Invite only channel)", sizeof buffer);
			break;
		case 474:		/* #define ERR_BANNEDFROMCHAN   474 */
			my_strmcat(buffer, " (Banned from channel)", sizeof buffer);
			break;
		case 475: 		/* #define ERR_BADCHANNELKEY    475 */
			my_strmcat(buffer, " (Bad channel key)", sizeof buffer);
			break;
		case 476:		/* #define ERR_BADCHANMASK      476 */
			my_strmcat(buffer, " (Bad channel mask)", sizeof buffer);
			break;
		}
		put_it("%s %s", numeric_banner(), buffer);
	}
}
Esempio n. 3
0
void userhost_ban(UserhostItem *stuff, char *nick1, char *args)
{
	char *temp;
	char *str= NULL;
	char *channel;
	ChannelList *c = NULL;
	NickList *n = NULL;

	char *ob = "-o+b";
	char *b = "+b";

	char *host = NULL, *nick = NULL, *user = NULL, *chan = NULL;
	WhowasList *whowas = NULL;
		
	int f**k = 0;
	int set_ignore = 0;
	
	
	channel = next_arg(args, &args);
	temp = next_arg(args, &args);

	f**k = !my_stricmp("F**K", args);
	set_ignore = !my_stricmp("BKI", args);
	
	if (!stuff || !stuff->nick || !nick1 || !strcmp(stuff->user, "<UNKNOWN>") || my_stricmp(stuff->nick, nick1))
	{
		if (nick1 && channel && (whowas = check_whowas_nick_buffer(nick1, channel, 0)))
		{
			nick = whowas->nicklist->nick;
			user = m_strdup(clear_server_flags(whowas->nicklist->host));
			host = strchr(user, '@');
			*host++ = 0;
			bitchsay("Using WhoWas info for ban of %s ", nick1);
			n = whowas->nicklist;
		}
		else if (nick1)
		{
			bitchsay("No match for the %s of %s on %s", f**k ? "F**k":"Ban", nick1, channel);
			return;
		}
	} 
	else
	{
		nick = stuff->nick;
		user = m_strdup(clear_server_flags(stuff->user));
		host = stuff->host;
	}

	if (!(my_stricmp(nick, get_server_nickname(from_server))))
	{
		bitchsay("Try to kick yourself again!!");
		new_free(&user);
		return;
	}

	if (is_on_channel(channel, from_server, nick))
		chan = channel;
	c = lookup_channel(channel, from_server, 0);
	if (c && !n)
		n = find_nicklist_in_channellist(nick, c, 0);
	send_to_server("MODE %s %s %s %s", channel, chan ? ob : b, chan?nick:empty_string, ban_it(nick, user, host, (n && n->ip)?n->ip:NULL));
	if (f**k)
	{
		malloc_sprintf(&str, "%s!*%s@%s %s 3 Auto-Shit", nick, user, host, channel);
#ifdef WANT_USERLIST
		add_shit(NULL, str, NULL, NULL);
#endif
		new_free(&str);
	} else if (set_ignore)
		ignore_nickname(ban_it("*", user, host, NULL)	, IGNORE_ALL, 0);
	new_free(&user);
}
Esempio n. 4
0
static void p_privmsg(char *from, char **Args)
{
    int level, list_type, flood_type, log_type, no_flood = 1, do_beep = 1;

    unsigned char ignore_type;
    char *ptr = NULL, *to;
    char *high;
    struct channel *channel = NULL;
    struct nick_list *tmpnick = NULL;

    if (!from)
	return;
    PasteArgs(Args, 1);
    to = Args[0];
    ptr = Args[1];
    if (!to || !ptr) {
	fake();
	return;
    }
    doing_privmsg = 1;

    if (is_channel(to) && im_on_channel(to)) {
	message_from(to, LOG_MSG);
	malloc_strcpy(&public_nick, from);
	log_type = LOG_PUBLIC;
	ignore_type = IGNORE_PUBLIC;
	flood_type = PUBLIC_FLOOD;

	if (!is_on_channel(to, from_server, from))
	    list_type = PUBLIC_MSG_LIST;
	else {
	    if (is_current_channel(to, from_server, 0))
		list_type = PUBLIC_LIST;
	    else
		list_type = PUBLIC_OTHER_LIST;
	    channel = lookup_channel(to, from_server, CHAN_NOUNLINK);
	    if (channel)
		tmpnick = find_nicklist_in_channellist(from, channel, 0);
	}
    } else {
	message_from(from, LOG_MSG);
	flood_type = MSG_FLOOD;
	if (my_stricmp(to, get_server_nickname(from_server))) {
	    log_type = LOG_WALL;
	    ignore_type = IGNORE_WALLS;
	    list_type = MSG_GROUP_LIST;
	} else {
	    log_type = LOG_MSG;
	    ignore_type = IGNORE_MSGS;
	    list_type = MSG_LIST;
	}
    }
    switch (check_ignore(from, FromUserHost, to, ignore_type, ptr)) {
    case IGNORED:
	if ((list_type == MSG_LIST) && get_int_var(SEND_IGNORE_MSG_VAR))
	    send_to_server(SERVER(from_server), "NOTICE %s :%s is ignoring you", from, get_server_nickname(from_server));
	doing_privmsg = 0;
	return;
    case HIGHLIGHTED:
	high = highlight_char;
	break;
    case CHANNEL_GREP:
	high = highlight_char;
	break;
    default:
	high = empty_str;
	break;
    }

    ptr = do_ctcp(from, to, ptr);
    if (!ptr || !*ptr) {
	doing_privmsg = 0;
	return;
    }

    level = set_lastlog_msg_level(log_type);
    if (flood_type == PUBLIC_FLOOD) {
	int blah = 0;

	if (is_other_flood(channel, tmpnick, PUBLIC_FLOOD, &blah)) {
	    no_flood = 0;
	    flood_prot(tmpnick->nick, FromUserHost, "PUBLIC", flood_type, get_int_var(PUBFLOOD_TIME_VAR), channel->channel);
	}
    } else
	no_flood = check_flooding(from, flood_type, ptr, NULL);

    {
	switch (list_type) {
	case PUBLIC_MSG_LIST:
	    logmsg(LOG_PUBLIC, from, ptr, 0);
	    if (no_flood && do_hook(list_type, "%s %s %s", from, to, ptr))
		put_it("%s",
		       convert_output_format(get_format(FORMAT_PUBLIC_MSG_FSET), "%s %s %s %s %s", update_clock(GET_TIME), from,
					     FromUserHost, to, get_int_var(MIRCS_VAR) ? mircansi(ptr) : ptr));
	    break;
	case MSG_GROUP_LIST:
	    logmsg(LOG_PUBLIC, from, ptr, 0);
	    if (no_flood && do_hook(list_type, "%s %s %s", from, to, ptr))
		put_it("%s",
		       convert_output_format(get_format(FORMAT_MSG_GROUP_FSET), "%s %s %s %s", update_clock(GET_TIME), from, to,
					     get_int_var(MIRCS_VAR) ? mircansi(ptr) : ptr));
	    break;
	case MSG_LIST:
	    {
		if (!no_flood)
		    break;
		malloc_strcpy(&recv_nick, from);
		if (away_set) {
		    do_beep = 0;
		    beep_em(get_int_var(BEEP_WHEN_AWAY_VAR));
		    set_int_var(MSGCOUNT_VAR, get_int_var(MSGCOUNT_VAR) + 1);
		}
		logmsg(LOG_MSG, from, ptr, 0);
		addtabkey(from, "msg");

		if (do_hook(list_type, "%s %s", from, ptr))
		    put_it("%s",
			   convert_output_format(get_format(FORMAT_MSG_FSET), "%s %s %s %s", update_clock(GET_TIME), from,
						 FromUserHost, get_int_var(MIRCS_VAR) ? mircansi(ptr) : ptr));

		if (from_server > -1 && get_server_away(from_server) && get_int_var(SEND_AWAY_MSG_VAR)) {
		    send_to_server(SERVER(from_server), "NOTICE %s :%s", from,
				   stripansicodes(convert_output_format
						  (get_format(FORMAT_SEND_AWAY_FSET), "%l %l %s", time(NULL),
						   server_list[from_server].awaytime, get_int_var(MSGLOG_VAR) ? "On" : "Off")));
		}
		break;
	    }
	case PUBLIC_LIST:{
		logmsg(LOG_PUBLIC, from, ptr, 0);
		if (no_flood && do_hook(list_type, "%s %s %s", from, to, ptr))
		    put_it("%s",
			   convert_output_format(get_format(FORMAT_PUBLIC_FSET), "%s %s %s %s", update_clock(GET_TIME), from, to,
						 get_int_var(MIRCS_VAR) ? mircansi(ptr) : ptr));
		break;
	    }
	case PUBLIC_OTHER_LIST:{
		logmsg(LOG_PUBLIC, from, ptr, 0);
		if (no_flood && do_hook(list_type, "%s %s %s", from, to, ptr))
		    put_it("%s",
			   convert_output_format(get_format(FORMAT_PUBLIC_OTHER_FSET), "%s %s %s %s", update_clock(GET_TIME), from, to,
						 get_int_var(MIRCS_VAR) ? mircansi(ptr) : ptr));
		break;
	    }			/* case */
	}			/* switch */
    }
    if (beep_on_level & log_type && do_beep)
	beep_em(1);
    set_lastlog_msg_level(level);
    message_from(NULL, LOG_CRAP);
    doing_privmsg = 0;
}