Пример #1
0
static void p_part(char *from, char **ArgList)
{
    char *channel;

    if (!from || !*from)
	return;
    channel = ArgList[0];

    PasteArgs(ArgList, 1);
    message_from(channel, LOG_CRAP);
    in_on_who = 1;

    if ((check_ignore(from, FromUserHost, channel, IGNORE_PARTS | IGNORE_CRAP, NULL) != IGNORED) &&
	do_hook(LEAVE_LIST, "%s %s %s %s", from, channel, FromUserHost, ArgList[1] ? ArgList[1] : empty_str))
	put_it("%s",
	       convert_output_format(get_format(FORMAT_LEAVE_FSET), "%s %s %s %s %s", update_clock(GET_TIME), from, FromUserHost,
				     channel, ArgList[1] ? ArgList[1] : empty_str));
    if (!my_stricmp(from, get_server_nickname(from_server))) {
	remove_channel(channel, from_server);
	remove_from_mode_list(channel, from_server);
	remove_from_join_list(channel, from_server);
	set_input_prompt(curr_scr_win, get_string_var(INPUT_PROMPT_VAR), 0);
    } else {
	remove_from_channel(channel, from, from_server, 0, NULL);
    }
    update_all_status(curr_scr_win, NULL, 0);
    update_input(UPDATE_ALL);
    message_from(NULL, LOG_CRAP);
    in_on_who = 0;
}
Пример #2
0
int cmd_check_ignore(int argc, const char **argv, const char *prefix)
{
	int num_ignored;

	git_config(git_default_config, NULL);

	argc = parse_options(argc, argv, prefix, check_ignore_options,
			     check_ignore_usage, 0);

	if (stdin_paths) {
		if (argc > 0)
			die(_("cannot specify pathnames with --stdin"));
	} else {
		if (null_term_line)
			die(_("-z only makes sense with --stdin"));
		if (argc == 0)
			die(_("no path specified"));
	}
	if (quiet) {
		if (argc > 1)
			die(_("--quiet is only valid with a single pathname"));
		if (verbose)
			die(_("cannot have both --quiet and --verbose"));
	}

	if (stdin_paths) {
		num_ignored = check_ignore_stdin_paths(prefix);
	} else {
		num_ignored = check_ignore(prefix, argv);
		maybe_flush_or_die(stdout, "ignore to stdout");
	}

	return !num_ignored;
}
Пример #3
0
static int check_ignore_stdin_paths(const char *prefix)
{
	struct strbuf buf, nbuf;
	char **pathspec = NULL;
	size_t nr = 0, alloc = 0;
	int line_termination = null_term_line ? 0 : '\n';
	int num_ignored;

	strbuf_init(&buf, 0);
	strbuf_init(&nbuf, 0);
	while (strbuf_getline(&buf, stdin, line_termination) != EOF) {
		if (line_termination && buf.buf[0] == '"') {
			strbuf_reset(&nbuf);
			if (unquote_c_style(&nbuf, buf.buf, NULL))
				die("line is badly quoted");
			strbuf_swap(&buf, &nbuf);
		}
		ALLOC_GROW(pathspec, nr + 1, alloc);
		pathspec[nr] = xcalloc(strlen(buf.buf) + 1, sizeof(*buf.buf));
		strcpy(pathspec[nr++], buf.buf);
	}
	ALLOC_GROW(pathspec, nr + 1, alloc);
	pathspec[nr] = NULL;
	num_ignored = check_ignore(prefix, (const char **)pathspec);
	maybe_flush_or_die(stdout, "attribute to stdout");
	strbuf_release(&buf);
	strbuf_release(&nbuf);
	free(pathspec);
	return num_ignored;
}
Пример #4
0
/* in response to a TOPIC message from the server */
static void p_topic(char *from, char **ArgList)
{
    struct channel *tmp;

    if (!ArgList[1]) {
	fake();
	return;
    }
    tmp = lookup_channel(ArgList[0], from_server, CHAN_NOUNLINK);
    malloc_strcpy(&tmp->topic, ArgList[1]);
    if (check_ignore(from, FromUserHost, tmp->channel, IGNORE_TOPICS | IGNORE_CRAP, NULL) != IGNORED) {
	message_from(ArgList[0], LOG_CRAP);
	if (do_hook(TOPIC_LIST, "%s %s %s", from, ArgList[0], ArgList[1])) {
	    if (ArgList[1] && *ArgList[1]) {
		if (get_format(FORMAT_TOPIC_CHANGE_HEADER_FSET))
		    put_it("%s",
			   convert_output_format(get_format(FORMAT_TOPIC_CHANGE_HEADER_FSET), "%s %s %s %s", update_clock(GET_TIME),
						 from, ArgList[0], ArgList[1]));
		put_it("%s",
		       convert_output_format(get_format(FORMAT_TOPIC_CHANGE_FSET), "%s %s %s %s", update_clock(GET_TIME), from,
					     ArgList[0], ArgList[1]));
	    } else
		put_it("%s",
		       convert_output_format(get_format(FORMAT_TOPIC_UNSET_FSET), "%s %s %s", update_clock(GET_TIME), from,
					     ArgList[0]));
	}

	message_from(NULL, LOG_CRAP);
    }
    update_all_status(curr_scr_win, NULL, 0);
}
Пример #5
0
static void p_quit(char *from, char **ArgList)
{
    int one_prints = 0;
    char *chan = NULL;
    char *Reason;
    int netsplit = 0;
    int ignore;

    PasteArgs(ArgList, 0);
    if (ArgList[0]) {
	Reason = ArgList[0];
	netsplit = check_split(from, Reason, chan);
    } else
	Reason = "?";

    ignore = check_ignore(from, FromUserHost, NULL, (netsplit ? IGNORE_SPLITS : IGNORE_QUITS) | IGNORE_ALL, NULL);
    for (chan = walk_channels(from, 1, from_server); chan; chan = walk_channels(from, 0, -1)) {
	if (ignore != IGNORED) {
	    message_from(chan, LOG_CRAP);
	    if (do_hook(CHANNEL_SIGNOFF_LIST, "%s %s %s", chan, from, Reason))
		one_prints = 1;
	    message_from(NULL, LOG_CURRENT);
	}
    }
    if (one_prints) {
	chan = what_channel(from, from_server);

	ignore = check_ignore(from, FromUserHost, chan, (netsplit ? IGNORE_SPLITS : IGNORE_QUITS) | IGNORE_ALL, NULL);

	message_from(chan, LOG_CRAP);
	if ((ignore != IGNORED) && do_hook(SIGNOFF_LIST, "%s %s", from, Reason) && !netsplit)
	    put_it("%s",
		   convert_output_format(get_format(FORMAT_CHANNEL_SIGNOFF_FSET), "%s %s %s %s %s", update_clock(GET_TIME), from,
					 FromUserHost, chan, Reason));
	message_from(NULL, LOG_CURRENT);
    }
    if (!netsplit)
	check_orig_nick(from);
    notify_mark(from, NULL, NULL, 0);
    remove_from_channel(NULL, from, from_server, netsplit, Reason);
    message_from(NULL, LOG_CRAP);
    update_all_status(curr_scr_win, NULL, 0);
}
Пример #6
0
/*
 * The client apparantly never was adapted to handle the new NOTE syntax.
 * So i had to kludge this up to work with it.  Currently, NOTEs are sent
 * something like this:
 *
 *	NOTICE yournick :Note from nick!user@host /xxxd:xxh:xxm/ [N] message
 *
 * and parse() calls parse_notice(), who notices that there is no pefix
 * and passes it off to parse_local_server_notice(), who checks to see 
 * if it is a note (it is), blows away the "Note from" part, and re-sets 
 * the "from" and "FromUserHost" parts with the nick!user@host part and 
 * passes us the buck with 'line' pointing at the time description 
 * (the /.../ part)
 */
static void 	parse_note (char *from, char *line)
{
	char	*date,
		*flags,
		*high;
	time_t	when;
	int 	level;

	switch (check_ignore(from, FromUserHost, IGNORE_NOTES))
	{
		case IGNORED:
			return;
		case HIGHLIGHTED:
			high = highlight_char;
			break;
		default:
			high = empty_string;
	}

	if (check_flooding(from, FromUserHost, NOTE_FLOOD, line))
		return;

/* 
	at this point, line looks like:
	"/xxxd:xxh:xxm/ [FLAGS] message goes here"
 */
	date = next_arg(line, &line);
	flags = next_arg(line, &line);

	when = convert_note_time_to_real_time(date);
	level = set_lastlog_msg_level(LOG_NOTES);

	if (do_hook(NOTE_LIST, "%s %lu %s", from, when, line))
	{
		if (time(NULL) - when > 60)	/* not just sent */
			put_it("%s[%s]%s %s (%s)", high, from, high, 
						   line, my_ctime(when));
		else
			put_it("%s[%s]%s %s", high, from, high, line);
	}

	if (beep_on_level & LOG_NOTES)
		beep_em(1);
	set_lastlog_msg_level(level);
}
Пример #7
0
int check_ignore_notice(char *from, char *to, unsigned long type, char *line, char **high)
{
int flag;
	switch ((flag = check_ignore(from, FromUserHost, to, type, line)))
	{
		case IGNORED:
		{
			doing_notice = 0;
			return flag;
		}
		case HIGHLIGHTED:
			*high = highlight_char;
			break;
		default:
			*high = empty_string;
	}
	return flag;
}
Пример #8
0
static void p_nick(char *from, char **ArgList)
{
    int one_prints = 0, ign = 0, its_me = 0;
    struct channel *chan;
    char *line;

    line = ArgList[0];
    if (!my_stricmp(from, get_server_nickname(from_server))) {
	accept_server_nickname(from_server, line);
	its_me = 1;
	user_changing_nickname = 0;
    }
    ign = check_ignore(from, FromUserHost, NULL, IGNORE_NICKS | IGNORE_CRAP, NULL);
    for (chan = server_list[from_server].chan_list; chan; chan = chan->next) {
	message_from(chan->channel, LOG_CRAP);
	if (ign != IGNORED && do_hook(CHANNEL_NICK_LIST, "%s %s %s", chan->channel, from, line))
	    one_prints = 1;
    }
    if (one_prints) {
	if (its_me) {
	    message_from(NULL, LOG_CRAP);
	} else
	    message_from(what_channel(from, from_server), LOG_CRAP);
	if (ign != IGNORED && do_hook(NICKNAME_LIST, "%s %s", from, line))
	    put_it("%s",
		   convert_output_format(get_format
					 (its_me ? FORMAT_NICKNAME_USER_FSET : im_on_channel(what_channel(from, from_server)) ?
					  FORMAT_NICKNAME_FSET : FORMAT_NICKNAME_OTHER_FSET), "%s %s %s %s", update_clock(GET_TIME),
					 from, "-", line));
    }
    rename_nick(from, line, from_server);
    if (!its_me) {
	char *user, *host;

	user = m_strdup(FromUserHost);
	host = strchr(user, '@');
	*host++ = '\0';

	notify_mark(from, user, host, 0);
	notify_mark(line, user, host, 1);
	new_free(&user);
    }
}
Пример #9
0
void 
ChemistryMulti::deposit (const symbol chem, const double flux, Treelog& msg)
{
  bool found = false;

  for (size_t c = 0; c < combine.size (); c++)
    if (combine[c]->know (chem))
      {
	if (found)
	  msg.error ("Duplicate chemical '" + chem + "' detected");

	Chemical& chemical = combine[c]->find (chem);
        chemical.deposit (flux);
	found = true;
      }
  
  if (found)
    return;

  check_ignore (chem, msg);
}
Пример #10
0
static void p_pong(char *from, char **ArgList)
{
    int is_server = 0;
    int i;

    if (!ArgList[0])
	return;
    is_server = match("*.*", ArgList[0]);
    if (in_server_ping && is_server) ;
    {
	int old_from_server = from_server;

	for (i = 0; i < number_of_servers; i++) {
	    if ((!my_stricmp(ArgList[0], get_server_name(i)) || !my_stricmp(ArgList[0], get_server_itsname(i)))
		&& is_server_connected(i)) {
		int old_lag = server_list[i].lag;

		from_server = i;
		server_list[i].lag = time(NULL) - server_list[i].lag_time;
		in_server_ping--;
		if (old_lag != server_list[i].lag)
		    status_update(1);
		from_server = old_from_server;
		return;
	    }
	}
	from_server = old_from_server;
    }
    if (check_ignore(from, FromUserHost, NULL, IGNORE_PONGS | IGNORE_CRAP, NULL) != IGNORED) {
	if (!is_server)
	    return;
	if (!ArgList[1])
	    say("%s: PONG received from %s", ArgList[0], from);
	else
	    say("%s: PING received from %s %s", ArgList[0], from, ArgList[1]);
    }
}
Пример #11
0
static void p_invite(char *from, char **ArgList)
{
    char *high;

    switch (check_ignore(from, FromUserHost, ArgList[1] ? ArgList[1] : NULL, IGNORE_INVITES, NULL)) {
    case IGNORED:
	if (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));
	return;
    case HIGHLIGHTED:
	high = highlight_char;
	break;
    default:
	high = empty_str;
	break;
    }
    if (ArgList[0] && ArgList[1]) {
	struct channel *chan = NULL;
	struct whowas_chan_list *w_chan = NULL;

	message_from(from, LOG_CRAP);
	malloc_strcpy(&invite_channel, ArgList[1]);
	if (check_flooding(from, INVITE_FLOOD, ArgList[1], NULL) && do_hook(INVITE_LIST, "%s %s", from, ArgList[1])) {
	    put_it("%s", convert_output_format(get_format(FORMAT_INVITE_FSET), "%s %s %s", update_clock(GET_TIME), from, ArgList[1]));
	}
	if (!(chan = lookup_channel(invite_channel, from_server, 0)))
	    if ((w_chan = check_whowas_chan_buffer(invite_channel, 0)))
		chan = w_chan->channellist;
	if (chan && get_int_var(AUTO_REJOIN_VAR) && invite_channel) {
	    if (!in_join_list(invite_channel, from_server))
		send_to_server(SERVER(from_server), "JOIN %s %s", invite_channel, ArgList[2] ? ArgList[2] : "");
	}

	malloc_strcpy(&recv_nick, from);
    }
}
Пример #12
0
void 
ChemistryMulti::incorporate (const Geometry& geo,
			     const symbol chem, const double amount,
                             const Volume& volume,
			     Treelog& msg)
{
  bool found = false;

  for (size_t c = 0; c < combine.size (); c++)
    if (combine[c]->know (chem))
      {
	if (found)
	  msg.error ("Duplicate chemical '" + chem + "' detected");

	Chemical& chemical = combine[c]->find (chem);
        chemical.incorporate (geo, amount, volume);
	found = true;
      }
  
  if (found)
    return;

  check_ignore (chem, msg);
}
Пример #13
0
static void p_wallops(char *from, char **ArgList)
{
    char *line;
    int from_server = strchr(from, '.') ? 1 : 0;

    if (!(line = PasteArgs(ArgList, 0))) {
	fake();
	return;
    }

    if (from_server || check_flooding(from, WALLOP_FLOOD, line, NULL)) {
	/* The old server check, don't use the whois stuff for servers */
	int level;
	char *high;

	switch (check_ignore(from, FromUserHost, NULL, IGNORE_WALLOPS, NULL)) {
	case (IGNORED):
	    return;
	case (HIGHLIGHTED):
	    high = highlight_char;
	    break;
	default:
	    high = empty_str;
	    break;
	}
	message_from(from, LOG_WALLOP);
	level = set_lastlog_msg_level(LOG_WALLOP);
	if (do_hook(WALLOP_LIST, "%s %c %s", from, from_server ? 'S' : '*', line))
	    put_it("%s", convert_output_format(get_format(from_server ? FORMAT_WALLOP_FSET : FORMAT_WALL_FSET),
					       "%s %s %s %s", update_clock(GET_TIME), from, from_server ? "!" : "*", line));
	if (beep_on_level & LOG_WALLOP)
	    beep_em(1);
	set_lastlog_msg_level(level);
	message_from(NULL, LOG_CRAP);
    }
}
Пример #14
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;
}
Пример #15
0
static void p_kick(char *from, char **ArgList)
{
    char *channel, *who, *comment;
    char *chankey = NULL;
    struct channel *chan = NULL;
    struct nick_list *tmpnick = NULL;
    int t = 0;

    channel = ArgList[0];
    who = ArgList[1];
    comment = ArgList[2] ? ArgList[2] : "(no comment)";

    if ((chan = lookup_channel(channel, from_server, CHAN_NOUNLINK)))
	tmpnick = find_nicklist_in_channellist(from, chan, 0);
    message_from(channel, LOG_CRAP);
    if (channel && who && chan) {
	if (!my_stricmp(who, get_server_nickname(from_server))) {
	    Window *window = chan->window;

	    if (chan->key)
		malloc_strcpy(&chankey, chan->key);
	    if (get_int_var(AUTO_REJOIN_VAR)) {
		send_to_server(SERVER(from_server), "JOIN %s %s", channel, chankey ? chankey : empty_str);
		add_to_join_list(channel, from_server, window ? window->refnum : 0);
	    }
	    new_free(&chankey);
	    remove_channel(channel, from_server);
	    update_all_status(curr_scr_win, NULL, 0);
	    update_input(UPDATE_ALL);
	    if (do_hook(KICK_LIST, "%s %s %s %s", who, from, channel, comment ? comment : empty_str))
		put_it("%s",
		       convert_output_format(get_format(FORMAT_KICK_USER_FSET), "%s %s %s %s %s", update_clock(GET_TIME), from,
					     channel, who, comment));
	} else {
	    int itsme = 0;

	    itsme = !my_stricmp(get_server_nickname(from_server), from) ? 1 : 0;

	    if ((check_ignore(from, FromUserHost, channel, IGNORE_KICKS | IGNORE_CRAP, NULL) != IGNORED) &&
		do_hook(KICK_LIST, "%s %s %s %s", who, from, channel, comment))
		put_it("%s",
		       convert_output_format(get_format(FORMAT_KICK_FSET), "%s %s %s %s %s", update_clock(GET_TIME), from, channel,
					     who, comment));
	    if (!itsme) {
		struct nick_list *f_nick = NULL;

		f_nick = find_nicklist_in_channellist(who, chan, 0);
		if (chan->chop && tmpnick && is_other_flood(chan, tmpnick, KICK_FLOOD, &t)) {
		    if (get_int_var(KICK_ON_KICKFLOOD_VAR) > get_int_var(DEOP_ON_KICKFLOOD_VAR))
			send_to_server(SERVER(from_server), "MODE %s -o %s", chan->channel, from);
		    else if (!f_nick->kickcount++)
			send_to_server(SERVER(from_server), "KICK %s %s :\002Mass kick detected - (%d kicks in %dsec%s)\002",
				       chan->channel, from, get_int_var(KICK_ON_KICKFLOOD_VAR), t, plural(t));
		}
	    }
	    remove_from_channel(channel, who, from_server, 0, NULL);
	}

    }
    update_all_status(curr_scr_win, NULL, 0);
    message_from(NULL, LOG_CRAP);
}
Пример #16
0
static void p_mode(char *from, char **ArgList)
{
    char *channel;
    char *line;
    int flag;

    struct channel *chan = NULL;
    char buffer[BIG_BUFFER_SIZE + 1];
    char *smode;

#ifdef COMPRESS_MODES
    char *tmpbuf = NULL;
#endif
    PasteArgs(ArgList, 1);
    channel = ArgList[0];
    line = ArgList[1];
    smode = strchr(from, '.');

    flag = check_ignore(from, FromUserHost, channel, (smode ? IGNORE_SMODES : IGNORE_MODES) | IGNORE_CRAP, NULL);

    message_from(channel, LOG_CRAP);
    if (channel && line) {
	strcpy(buffer, line);
	if (get_int_var(MODE_STRIPPER_VAR))
	    strip_modes(from, channel, line);
	if (is_channel(channel)) {
#ifdef COMPRESS_MODES
	    chan = (struct channel *) find_in_list((struct list **) &server_list[from_server].chan_list, channel, 0);
	    if (get_int_var(COMPRESS_MODES_VAR)) {
		tmpbuf = compress_modes(from_server, channel, line);
		if (tmpbuf)
		    strcpy(line, tmpbuf);
		else
		    goto end_p_mode;
	    }
#endif
	    /* CDE handle mode protection here instead of later */
	    update_channel_mode(from, channel, from_server, buffer, chan);

	    if (flag != IGNORED && do_hook(MODE_LIST, "%s %s %s", from, channel, line))
		put_it("%s",
		       convert_output_format(get_format(smode ? FORMAT_SMODE_FSET : FORMAT_MODE_FSET), "%s %s %s %s %s",
					     update_clock(GET_TIME), from, smode ? "*" : FromUserHost, channel, line));
	} else {
	    if (flag != IGNORED && do_hook(MODE_LIST, "%s %s %s", from, channel, line)) {
		if (!my_stricmp(from, channel)) {
		    if (!my_stricmp(from, get_server_nickname(from_server)))
			put_it("%s",
			       convert_output_format(get_format(FORMAT_USERMODE_FSET), "%s %s %s %s %s", update_clock(GET_TIME), from,
						     "*", channel, line));
		    else
			put_it("%s",
			       convert_output_format(get_format(FORMAT_USERMODE_FSET), "%s %s %s %s %s", update_clock(GET_TIME), from,
						     smode ? "*" : FromUserHost, channel, line));
		} else
		    put_it("%s",
			   convert_output_format(get_format(FORMAT_MODE_FSET), "%s %s %s %s %s", update_clock(GET_TIME), from,
						 smode ? "*" : FromUserHost, channel, line));
	    }
	    update_user_mode(line);
	}
#ifdef COMPRESS_MODES
      end_p_mode:
#endif
	update_all_status(curr_scr_win, NULL, 0);
    }
    message_from(NULL, LOG_CRAP);
}
Пример #17
0
static void p_channel(char *from, char **ArgList)
{
    char *channel;
    char *user, *host;
    struct channel *chan = NULL;
    struct whowas_list *whowas = NULL;
    int its_me = 0;

    if (!strcmp(ArgList[0], "0")) {
	fake();
	return;
    }

    channel = ArgList[0];
    message_from(channel, LOG_CRAP);
    malloc_strcpy(&joined_nick, from);

    if (!my_stricmp(from, get_server_nickname(from_server))) {
	int refnum;
	Window *old_window = curr_scr_win;
	int switched = 0;

	if (!in_join_list(channel, from_server))
	    add_to_join_list(channel, from_server, curr_scr_win->refnum);
	else {

	    if (curr_scr_win->refnum != (refnum = get_win_from_join_list(channel, from_server))) {
		switched = 1;
		set_current_window(get_window_by_refnum(refnum));
	    }
	}

	if (*channel != '+')
	    send_to_server(SERVER(from_server), "MODE %s\r\nMODE %s b", channel, channel, channel);

	(void) do_hook(JOIN_ME_LIST, "%s", channel);
	its_me = 1;
	chan = add_channel(channel, from_server);
	if (*channel == '+') {
	    got_info(channel, from_server, GOTBANS);
	    got_info(channel, from_server, GOTMODE);
	}
	if (switched)
	    set_current_window(old_window);
    } else {
	int op = 0, vo = 0;
	char *c;

	/* 
	 * Workaround for gratuitous protocol change in ef2.9
	 */
	if ((c = strchr(channel, '\007'))) {
	    for (*c++ = 0; *c; c++) {
		if (*c == 'o')
		    op = 1;
		else if (*c == 'v')
		    vo = 1;
	    }
	}

	chan = add_to_channel(channel, from, from_server, op, vo, FromUserHost, NULL, NULL);
    }

    flush_mode_all(chan);

    user = m_strdup(FromUserHost);
    host = strchr(user, '@');
    *host++ = '\0';

    if (check_ignore(from, FromUserHost, channel, IGNORE_JOINS | IGNORE_CRAP, NULL) != IGNORED && chan) {
	irc_server *irc_serv = NULL;
	char *tmp2 = NULL;

	if (get_int_var(AUTO_NSLOOKUP_VAR) && isdigit(*(host + strlen(host) - 1)))
	    tmp2 = do_nslookup(host);
	message_from(channel, LOG_CRAP);
	if ((whowas = check_whosplitin_buffer(from, FromUserHost, channel, 0)) && (irc_serv = check_split_server(whowas->server1))) {
	    if (do_hook(LLOOK_JOIN_LIST, "%s %s", irc_serv->name, irc_serv->link))
		put_it("%s",
		       convert_output_format(get_format(FORMAT_NETJOIN_FSET), "%s %s %s %d", update_clock(GET_TIME), irc_serv->name,
					     irc_serv->link, 0));
	    remove_split_server(whowas->server1);
	}
	if (do_hook(JOIN_LIST, "%s %s %s", from, channel, tmp2 ? tmp2 : FromUserHost ? FromUserHost : "UnKnown")) {
	    put_it("%s",
		   convert_output_format(get_format(FORMAT_JOIN_FSET), "%s %s %s %s", update_clock(GET_TIME), from,
					 tmp2 ? tmp2 : FromUserHost ? FromUserHost : "UnKnown", channel));
	}
	message_from(NULL, LOG_CRAP);
    }
    set_input_prompt(curr_scr_win, get_string_var(INPUT_PROMPT_VAR), 0);
    update_all_status(curr_scr_win, NULL, 0);
    notify_mark(from, user, host, 1);
    new_free(&user);
}