亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? handle_irc.c

?? 打魔獸戰網的都知道他是什么
?? C
?? 第 1 頁 / 共 4 頁
字號:
/* * Copyright (C) 2001  Marco Ziech (mmz@gmx.net) * Copyright (C) 2005  Bryan Biedenkapp (gatekeep@gmail.com) * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. */ #define CONNECTION_INTERNAL_ACCESS#include "common/setup_before.h"#include "common/util.h"#ifdef STDC_HEADERS# include <stdlib.h>#else# ifdef HAVE_MALLOC_H#  include <malloc.h># endif#endif#ifdef HAVE_STRING_H# include <string.h>#else# ifdef HAVE_STRINGS_H#  include <strings.h># endif# ifdef HAVE_MEMORY_H#  include <memory.h># endif#endif#include "compat/strdup.h"#include "compat/strcasecmp.h"#include <errno.h>#include "compat/strerror.h"#include "common/irc_protocol.h"#include "common/packet.h"#include "common/eventlog.h"#include "connection.h"#include "common/bn_type.h"#include "common/field_sizes.h"#include "common/addr.h"#include "common/version.h"#include "common/queue.h"#include "common/list.h"#include "common/bnethash.h"#include "common/bnethashconv.h"#include "message.h"#include "account.h"#include "account_wrap.h"#include "channel.h"#include "irc.h"#include "prefs.h"#include "tick.h"#include "timer.h"#include "server.h"#include "command.h"#include "handle_irc.h"#include "topic.h"#include "command_groups.h"#include "common/tag.h"#include "common/xalloc.h"#include "ctype.h"#include "common/setup_after.h"typedef int (* t_irc_command)(t_connection * conn, int numparams, char ** params, char * text);typedef struct {	const char     * irc_command_string;	t_irc_command    irc_command_handler;} t_irc_command_table_row;static int _handle_nick_command(t_connection * conn, int numparams, char ** params, char * text);static int _handle_user_command(t_connection * conn, int numparams, char ** params, char * text);static int _handle_ping_command(t_connection * conn, int numparams, char ** params, char * text);static int _handle_pong_command(t_connection * conn, int numparams, char ** params, char * text);static int _handle_pass_command(t_connection * conn, int numparams, char ** params, char * text);static int _handle_privmsg_command(t_connection * conn, int numparams, char ** params, char * text);static int _handle_notice_command(t_connection * conn, int numparams, char ** params, char * text);static int _handle_quit_command(t_connection * conn, int numparams, char ** params, char * text);static int _handle_who_command(t_connection * conn, int numparams, char ** params, char * text);static int _handle_list_command(t_connection * conn, int numparams, char ** params, char * text);static int _handle_topic_command(t_connection * conn, int numparams, char ** params, char * text);static int _handle_join_command(t_connection * conn, int numparams, char ** params, char * text);static int _handle_names_command(t_connection * conn, int numparams, char ** params, char * text);static int _handle_mode_command(t_connection * conn, int numparams, char ** params, char * text);static int _handle_userhost_command(t_connection * conn, int numparams, char ** params, char * text);static int _handle_ison_command(t_connection * conn, int numparams, char ** params, char * text);static int _handle_whois_command(t_connection * conn, int numparams, char ** params, char * text);static int _handle_part_command(t_connection * conn, int numparams, char ** params, char * text);static int _handle_cvers_command(t_connection * conn, int numparams, char ** params, char * text);static int _handle_verchk_command(t_connection * conn, int numparams, char ** params, char * text);static int _handle_lobcount_command(t_connection * conn, int numparams, char ** params, char * text);static int _handle_whereto_command(t_connection * conn, int numparams, char ** params, char * text);static int _handle_apgar_command(t_connection * conn, int numparams, char ** params, char * text);static int _handle_serial_command(t_connection * conn, int numparams, char ** params, char * text);static int _handle_squadinfo_command(t_connection * conn, int numparams, char ** params, char * text);static int _handle_setopt_command(t_connection * conn, int numparams, char ** params, char * text);static int _handle_setcodepage_command(t_connection * conn, int numparams, char ** params, char * text);static int _handle_setlocale_command(t_connection * conn, int numparams, char ** params, char * text);static int _handle_getcodepage_command(t_connection * conn, int numparams, char ** params, char * text);static int _handle_getlocale_command(t_connection * conn, int numparams, char ** params, char * text);static int _handle_joingame_command(t_connection * conn, int numparams, char ** params, char * text);static int _handle_gameopt_command(t_connection * conn, int numparams, char ** params, char * text);static int _handle_finduserex_command(t_connection * conn, int numparams, char ** params, char * text);static int _handle_page_command(t_connection * conn, int numparams, char ** params, char * text);static int _handle_startg_command(t_connection * conn, int numparams, char ** params, char * text);static int _handle_listsearch_command(t_connection * conn, int numparams, char ** params, char * text);/* state "connected" handlers */static const t_irc_command_table_row irc_con_command_table[] ={	{ "NICK"		, _handle_nick_command },	{ "USER"		, _handle_user_command },	{ "PING"		, _handle_ping_command },	{ "PONG"		, _handle_pong_command },	{ "PASS"		, _handle_pass_command },	{ "PRIVMSG"		, _handle_privmsg_command },	{ "NOTICE"		, _handle_notice_command },	{ "QUIT"		, _handle_quit_command },	{ "CVERS"		, _handle_cvers_command },		{ "VERCHK"		, _handle_verchk_command },		{ "LOBCOUNT"	, _handle_lobcount_command },	{ "WHERETO"		, _handle_whereto_command },	{ "APGAR"		, _handle_apgar_command },		{ "SERIAL"		, _handle_serial_command },		{ NULL			, NULL }};/* state "logged in" handlers */static const t_irc_command_table_row irc_log_command_table[] ={	{ "WHO"			, _handle_who_command },	{ "LIST"		, _handle_list_command },	{ "TOPIC"		, _handle_topic_command },	{ "JOIN"		, _handle_join_command },	{ "NAMES"		, _handle_names_command },	{ "MODE"		, _handle_mode_command },	{ "USERHOST"		, _handle_userhost_command },	{ "ISON"		, _handle_ison_command },	{ "WHOIS"		, _handle_whois_command },	{ "PART"		, _handle_part_command },	{ "SQUADINFO"	, _handle_squadinfo_command },		{ "SETOPT"		, _handle_setopt_command },			{ "SETCODEPAGE"	, _handle_setcodepage_command },	{ "SETLOCALE"	, _handle_setlocale_command },		{ "GETCODEPAGE"	, _handle_getcodepage_command },	{ "GETLOCALE"	, _handle_getlocale_command },		{ "JOINGAME"	, _handle_joingame_command },		{ "GAMEOPT"		, _handle_gameopt_command },		{ "FINDUSEREX"	, _handle_finduserex_command },		{ "PAGE"		, _handle_page_command },			{ "STARTG"		, _handle_startg_command },			{ "LISTSEARCH"	, _handle_listsearch_command },	{ NULL			, NULL }};static int handle_irc_con_command(t_connection * conn, char const * command, int numparams, char ** params, char * text){  t_irc_command_table_row const *p;  for (p = irc_con_command_table; p->irc_command_string != NULL; p++) {    if (strcasecmp(command, p->irc_command_string)==0) {	  if (p->irc_command_handler != NULL) 		  return ((p->irc_command_handler)(conn,numparams,params,text));	}  }  return -1;}static int handle_irc_log_command(t_connection * conn, char const * command, int numparams, char ** params, char * text){  t_irc_command_table_row const *p;  for (p = irc_log_command_table; p->irc_command_string != NULL; p++) {    if (strcasecmp(command, p->irc_command_string)==0) {	  if (p->irc_command_handler != NULL) 		  return ((p->irc_command_handler)(conn,numparams,params,text));	}  }  return -1;}static int handle_irc_line(t_connection * conn, char const * ircline){   	/* [:prefix] <command> [[param1] [param2] ... [paramN]] [:<text>] */    char * line; /* copy of ircline */    char * prefix = NULL; /* optional; mostly NULL */    char * command; /* mandatory */    char ** params = NULL; /* optional (array of params) */    char * text = NULL; /* optional */	char * bnet_command = NULL;  /* amadeo: used for battle.net.commands */    int unrecognized_before = 0;	int linelen; /* amadeo: counter for stringlenghts */    int numparams = 0;    char * tempparams;	int i; 	char paramtemp[MAX_IRC_MESSAGE_LEN*2];	int first = 1;    if (!conn) {	eventlog(eventlog_level_error,__FUNCTION__,"got NULL connection");	return -1;    }    if (!ircline) {	eventlog(eventlog_level_error,__FUNCTION__,"got NULL ircline");	return -1;    }    if (ircline[0] == '\0') {	eventlog(eventlog_level_error,__FUNCTION__,"got empty ircline");	return -1;    }	//amadeo: code was sent by some unknown fellow of pvpgn, prevents buffer-overflow for	// too long irc-lines    if (strlen(ircline)>254) {        char * tmp = (char *)ircline;	eventlog(eventlog_level_warn,__FUNCTION__,"line to long, truncation...");	tmp[254]='\0';    }        line = xstrdup(ircline);    /* split the message */    if (line[0] == ':') {	/* The prefix is optional and is rarely provided */	prefix = line;	if (!(command = strchr(line,' '))) {	    eventlog(eventlog_level_warn,__FUNCTION__,"got malformed line (missing command)");	    xfree(line);	    return -1;	}	*command++ = '\0';    } 	else {	/* In most cases command is the first thing on the line */	command = line;    }        tempparams = strchr(command,' ');    if (tempparams) {	*tempparams++ = '\0';	 if (tempparams[0]==':') {	    text = tempparams+1; /* theres just text, no params. skip the colon */	} else {	    for (i=0;tempparams[i]!='\0';i++) {	    	if ((tempparams[i]==' ')&&(tempparams[i+1]==':')) {		    text = tempparams+i; 		    *text++ = '\0';		    text++; /* skip the colon */		    break; /* text found, stop search */	    	}	    }	    params = irc_get_paramelems(tempparams);	}    }    if (params) {	/* count parameters */	for (numparams=0;params[numparams];numparams++);    }	memset(paramtemp,0,sizeof(paramtemp));    	for (i=0;((numparams>0)&&(params[i]));i++) {		if (!first) 			strcat(paramtemp," ");	    strcat(paramtemp,"\"");	    strcat(paramtemp,params[i]);	    strcat(paramtemp,"\"");	    first = 0;    	}    	eventlog(eventlog_level_debug,__FUNCTION__,"[%d] got \"%s\" \"%s\" [%s] \"%s\"",conn_get_socket(conn),((prefix)?(prefix):("")),command,paramtemp,((text)?(text):("")));    if (conn_get_state(conn)==conn_state_connected) {	t_timer_data temp;		conn_set_state(conn,conn_state_bot_username);	temp.n = prefs_get_irc_latency();	conn_test_latency(conn,time(NULL),temp);    }	if (handle_irc_con_command(conn, command, numparams, params, text)!=-1) {}    else if (conn_get_state(conn)!=conn_state_loggedin) {	char temp[MAX_IRC_MESSAGE_LEN+1];		if ((38+strlen(command)+16+1)<sizeof(temp)) {	    sprintf(temp,":Unrecognized command \"%s\" (before login)",command);	    irc_send(conn,ERR_UNKNOWNCOMMAND,temp);	} else {	    irc_send(conn,ERR_UNKNOWNCOMMAND,":Unrecognized command (before login)");	}    } else {        /* command is handled later */	unrecognized_before = 1;    }    /* --- The following should only be executable after login --- */    if ((conn_get_state(conn)==conn_state_loggedin)&&(unrecognized_before)) {		if (handle_irc_log_command(conn, command, numparams, params, text)!=-1) {}		else if ((strstart(command,"LAG")!=0)&&(strstart(command,"JOIN")!=0)){			linelen = strlen (ircline);			bnet_command = xmalloc(linelen + 2);			bnet_command[0]='/';			strcpy(bnet_command + 1, ircline);			handle_command(conn,bnet_command); 			xfree((void*)bnet_command);		}    } /* loggedin */    if (params)	irc_unget_paramelems(params);    xfree(line);    return 0;}extern int handle_irc_packet(t_connection * conn, t_packet const * const packet){    unsigned int i;    char ircline[MAX_IRC_MESSAGE_LEN];    int ircpos;    char const * data;    if (!packet) {	eventlog(eventlog_level_error,__FUNCTION__,"got NULL packet");	return -1;    }    if ((conn_get_class(conn) != conn_class_irc) &&		(conn_get_class(conn) != conn_class_wol)) {	eventlog(eventlog_level_error,__FUNCTION__,"FIXME: handle_irc_packet without any reason (conn->class != conn_class_irc)");	return -1;    }	    /* eventlog(eventlog_level_debug,__FUNCTION__,"got \"%s\"",packet_get_raw_data_const(packet,0)); */    memset(ircline,0,sizeof(ircline));    data = conn_get_ircline(conn); /* fetch current status */    if (data)	strcpy(ircline,data);    ircpos = strlen(ircline);    data = packet_get_raw_data_const(packet,0);	    for (i=0; i < packet_get_size(packet); i++) {	if ((data[i] == '\r')||(data[i] == '\0')) {	    /* kindly ignore \r and NUL ... */	} else if (data[i] == '\n') {	    /* end of line */	    handle_irc_line(conn,ircline);	    memset(ircline,0,sizeof(ircline));	    ircpos = 0;	} else {	    if (ircpos < MAX_IRC_MESSAGE_LEN-1)		ircline[ircpos++] = data[i];	    else {		ircpos++; /* for the statistic :) */	    	eventlog(eventlog_level_warn,__FUNCTION__,"[%d] client exceeded maximum allowed message length by %d characters",conn_get_socket(conn),ircpos-MAX_IRC_MESSAGE_LEN);		if ((ircpos-MAX_IRC_MESSAGE_LEN)>100) {		    /* automatic flood protection */		    eventlog(eventlog_level_error,__FUNCTION__,"[%d] excess flood",conn_get_socket(conn));		    return -1;		}	    }	}    }    conn_set_ircline(conn,ircline); /* write back current status */    return 0;}static int _handle_nick_command(t_connection * conn, int numparams, char ** params, char * text){	/* FIXME: more strict param checking */	if ((conn_get_loggeduser(conn))&&	    (conn_get_state(conn)!=conn_state_bot_password && 	     conn_get_state(conn)!=conn_state_bot_username)) {	    irc_send(conn,ERR_RESTRICTED,":You can't change your nick after login");	} 	else {	    if ((params)&&(params[0])) {			if (conn_get_loggeduser(conn))			    irc_send_cmd2(conn,conn_get_loggeduser(conn),"NICK","",params[0]);			conn_set_loggeduser(conn,params[0]);	    }	    else if (text) {			if (conn_get_loggeduser(conn))			    irc_send_cmd2(conn,conn_get_loggeduser(conn),"NICK","",text);			conn_set_loggeduser(conn,text);	    }	    else	        irc_send(conn,ERR_NEEDMOREPARAMS,":Too few arguments to NICK");	    if ((conn_get_user(conn))&&(conn_get_loggeduser(conn)))

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品久久久久久久久免费桃花| 欧洲激情一区二区| 日韩久久精品一区| 日本伊人色综合网| 欧美一级淫片007| 婷婷六月综合亚洲| 日韩视频在线你懂得| 久久www免费人成看片高清| 欧美xxxx在线观看| 国产剧情一区二区| 中文字幕永久在线不卡| 色婷婷久久久久swag精品| 亚洲黄色尤物视频| 欧美精品自拍偷拍动漫精品| 激情综合网av| 国产精品久久久久7777按摩| 在线国产电影不卡| 日本伊人精品一区二区三区观看方式| 欧美mv和日韩mv国产网站| 国产成人在线网站| 亚洲蜜臀av乱码久久精品| 欧美日本一区二区三区| 精品在线播放免费| 亚洲视频在线一区观看| 欧美日韩国产三级| 久久国产尿小便嘘嘘| 国产精品水嫩水嫩| 欧美精品久久99久久在免费线 | 美女视频一区在线观看| 国产亚洲精品bt天堂精选| 色婷婷综合久久久中文字幕| 日韩电影免费在线| 国产精品欧美一区喷水| 欧美嫩在线观看| 成人亚洲一区二区一| 亚洲成人动漫在线免费观看| 欧美成人艳星乳罩| 日本高清免费不卡视频| 麻豆精品蜜桃视频网站| 亚洲精品乱码久久久久久久久 | 图片区小说区区亚洲影院| 亚洲精品一区二区精华| 色综合天天视频在线观看 | 国产在线视视频有精品| 亚洲国产你懂的| 国产欧美精品一区二区三区四区| 欧美日韩中文字幕一区| 成人动漫一区二区三区| 免费在线观看一区| 亚洲激情男女视频| 国产精品女上位| 精品国免费一区二区三区| 欧美怡红院视频| 99在线精品视频| 国产精品1区2区3区在线观看| 亚洲成a人片在线观看中文| 国产精品剧情在线亚洲| 日韩精品一区二区三区四区视频 | 日韩国产一区二| 亚洲欧美日韩小说| 欧美国产国产综合| 欧美成人午夜电影| 91精品国产综合久久国产大片| 91麻豆产精品久久久久久 | 久久久久国色av免费看影院| 欧美日韩aaaaa| 欧美天天综合网| 色综合久久久久| 99re成人精品视频| jlzzjlzz亚洲女人18| 国产在线乱码一区二区三区| 免费一区二区视频| 日韩国产精品久久| 日韩高清在线一区| 日韩电影免费在线看| 日本中文在线一区| 美女www一区二区| 青椒成人免费视频| 波多野结衣中文字幕一区 | 一区二区三区在线视频观看58| 久久久噜噜噜久久中文字幕色伊伊| 欧美一区二区免费观在线| 91麻豆精品国产无毒不卡在线观看| 欧美亚洲综合久久| 欧美久久久影院| 欧美一区二区三区男人的天堂| 91麻豆精品国产自产在线观看一区| 欧美精品一级二级| 91麻豆精品国产91久久久久久久久| 欧美女孩性生活视频| 欧美一区二区美女| 26uuu色噜噜精品一区| 久久久久国产精品人| 中文在线免费一区三区高中清不卡| 国产精品久久久久久久久免费丝袜| 成人免费在线播放视频| 一区二区三区日本| 午夜精品久久久久久久99水蜜桃| 免费成人在线观看视频| 韩日av一区二区| av亚洲产国偷v产偷v自拍| 色综合久久综合| 制服丝袜亚洲播放| 久久九九久精品国产免费直播| 麻豆成人在线观看| 欧美mv和日韩mv的网站| 国产亚洲成年网址在线观看| 中文字幕免费一区| 一区二区欧美国产| 日本网站在线观看一区二区三区 | 首页国产丝袜综合| 国产在线视频一区二区三区| 波多野结衣中文一区| 欧美日韩一区二区三区高清| 欧美videossexotv100| 国产精品国产精品国产专区不蜜| 亚洲国产精品一区二区www在线 | 美国av一区二区| 成人午夜在线视频| 欧美日韩午夜在线视频| 亚洲精品一区二区三区精华液| 亚洲三级理论片| 久久精品国产一区二区三| 高清beeg欧美| 欧美日韩电影在线| 国产精品高清亚洲| 美日韩一区二区| 91麻豆蜜桃一区二区三区| 精品99一区二区三区| 亚洲一级二级在线| 国产精品1区2区| 欧美一区二区三级| 亚洲黄色录像片| 国产99精品国产| 欧美一区二区三区啪啪| 亚洲日本免费电影| 狠狠色丁香久久婷婷综合丁香| 91成人在线免费观看| 国产亚洲欧美日韩俺去了| 午夜不卡av免费| 成人久久18免费网站麻豆 | 亚洲欧美日韩国产综合在线| 狠狠狠色丁香婷婷综合激情 | 激情欧美一区二区| 欧美性猛交xxxxxx富婆| 国产精品久久久久久久久免费相片| 久久精品国产亚洲高清剧情介绍| 欧美性猛交xxxx乱大交退制版| 国产精品久久网站| 国产高清在线观看免费不卡| 欧美一区二区三区爱爱| 亚洲第一狼人社区| 色诱亚洲精品久久久久久| 国产精品免费观看视频| 国产精品一区二区三区乱码| 欧美videos中文字幕| 日韩av一二三| 欧美日本一区二区| 亚洲一区二区黄色| 在线中文字幕不卡| 亚洲乱码国产乱码精品精可以看| 成人激情免费视频| 国产欧美视频在线观看| 国产做a爰片久久毛片| 欧美tickling网站挠脚心| 日本欧洲一区二区| 91麻豆精品国产自产在线观看一区| 亚洲综合成人在线| 欧美无乱码久久久免费午夜一区| 一区二区三区**美女毛片| 色88888久久久久久影院野外| 亚洲日本丝袜连裤袜办公室| 色呦呦国产精品| 一区二区国产视频| 欧美性生交片4| 五月婷婷综合激情| 欧美另类高清zo欧美| 午夜精品福利在线| 91精品国产欧美日韩| 免费成人在线视频观看| 欧美不卡激情三级在线观看| 国产综合久久久久久鬼色| 26uuu久久天堂性欧美| 国产一区二区毛片| 国产欧美一区二区精品性色| 成人精品免费视频| 亚洲精品免费一二三区| 欧美日韩精品欧美日韩精品 | 午夜国产不卡在线观看视频| 欧美高清视频www夜色资源网| 日韩av电影天堂| 欧美不卡在线视频| 成人一区二区三区视频| 亚洲乱码国产乱码精品精的特点 | 99精品视频在线观看| 亚洲精品乱码久久久久| 7777精品伊人久久久大香线蕉的 | 日韩精品一区第一页| 日韩美一区二区三区| 成人一区二区三区|