예제 #1
0
파일: socket.c 프로젝트: Antonito/Tekdoom
void		*glisten_server(void *datb)
{
  int		len;
  t_data	*data;

  data = (t_data *)datb;
  data->message.indice_foreign = -1;
  data->sock.run = 1;
  while (data->sock.run)
    {
      glisten_server_more(data, &len);
      if (data->sock.msg[0] == '/')
	{
	  if (data->sock.msg[0] == '\0')
	    continue;
	  gcheck_msg(data, data->sock.msg);
	}
      else
	{
	  my_strncpy(data->message.foreign[data->message.indice_foreign],
		     data->sock.msg, my_strlen(data->sock.msg));
	  data->message.foreign[data->message.indice_foreign][len] = '\0';
	  write_chat(data);
	}
    }
  return ((void *)0);
}
예제 #2
0
int cmd_chat(int cn,char *text)
{
	int n,len;
	char buf[80];

	for (n=0; n<33; n++) {
		if (!cname[n].name) continue;
		
		sprintf(buf,"c%d",n);
		if ((len=cmdcmp(text,buf))) {
			return write_chat(cn,n,text+len);
		}
		if ((len=cmdcmp(text,cname[n].name))) {
			return write_chat(cn,n,text+len);
		}
	}
	return 0;
}
예제 #3
0
void npc_chat(int cn,int channel,char *format,...)
{
        va_list args;
        char buf[1024];

        va_start(args,format);
        vsnprintf(buf,1024,format,args);
        va_end(args);

	write_chat(cn,channel,buf);
}