Example #1
0
static void numeric_userhost(struct socket_info *sinfo, char *data)
{
	struct userlist *user;
	clientinfo client;
	char *tmp;

	strip_char_from_end('\r', data);

	tmp = strtok(data, " ");

	client.nick = strtok(NULL, "=");
	strip_char_from_end(':', client.nick);
	//not in mela
	strip_char_from_end('*', client.nick);

	client.ident = strtok(NULL, "@");
	strip_char_from_end('+', client.ident);

	client.address = client.address = strtok(NULL, " ");

	client.server = GetServerBySocket(sinfo);

	user = UpdateUser(&client);
	UpdateAccess(user, NULL);
}
Example #2
0
static void numeric_ready(struct socket_info *sinfo, char *params)
{
	char *channel, *info;

	strtok(params, " "); /* strip of username */
	channel = strtok(NULL, " ");
	info    = strtok(NULL, "");

	strip_char_from_end(':', info);
	strip_char_from_end('\r', info);

	botevent(EV_ENTERED,sinfo,NULL,channel,info);

}
Example #3
0
static int sm_topic(socket_info *sinfo, struct inputstruct *is)
{
	char *channel, *topic;
	clientinfo client;

	convert_clientinfo(sinfo,is->prefix, &client);

	channel = strtok(is->params, " ");	/* channel */
	topic = strtok(NULL, "");	/* topic */

	if (strlen(topic) <= 2)
		return(0) ; 

	strip_char_from_end(':', topic);
	strip_char_from_end('\r', topic);

	info_log("%s TOPIC %s by %s\n", channel, topic, client.nick);
	
	botevent(EV_TOPIC,sinfo,client.nick,channel,topic) ;	
	
	return (0);
}
Example #4
0
int handle_ctcp(struct userlist *user, char *params)
{
	char *command;
	char *rest;
	int result;
	struct commandlist *listptr;

	if(user->access < 0) {
		/* banned users get nothing */
		return(0);
	}
 
	if (botinfo->ctcp == 0) {
		return (0);
	}

	if(user->access > botinfo->floodexempt) {
		if(botinfo->ctcpdelay != 0 && botinfo->ctcpdelay+user->lastctcp >= currtime) {
			time(&user->lastctcp);
			return(0);
		}
	}
	
	time(&user->lastctcp);	
	strip_char_from_end(CTCP_DELIM_CHAR, params);
	command = strtok(params, " ");
	rest = strtok(NULL, "");
	
	listptr=ctcplist;
	
	while(listptr!=NULL) {
		if (strcaseeq(command, listptr->cmd)) {
			result=listptr->function(user, rest);
			if(result<0) 
				return(result);
		}
		listptr = listptr->next;
	}
	return (0);
}