⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 inbound.c

📁 The major functionality added in this release includes: - Rootless mode in X11 - Widget Templt
💻 C
📖 第 1 页 / 共 3 页
字号:
	case 319:		EMIT_SIGNAL (XP_TE_WHOIS2, serv->front_session, word[4],						 word_eol[5] + 1, NULL, NULL, 0);		break;	case 321:		if (!fe_is_chanwindow (sess->server))			EMIT_SIGNAL(XP_TE_CHANLISTHEAD, sess, NULL, NULL, NULL, NULL, 0);		break;	case 322:		if (fe_is_chanwindow (sess->server))		{			fe_add_chan_list (sess->server, word[4],									word[5],									word_eol[6] + 1);		} else		{			sprintf (outbuf, "%-16.16s %-7d %s\017\n",						word[4],						atoi (word[5]),						word_eol[6] + 1);			PrintText (sess, outbuf);		}		break;	case 323:		if (!fe_is_chanwindow (sess->server))			goto def;		fe_chan_list_end (sess->server);		break;	case 324:		sess = find_session_from_channel (word[4], serv);		if (!sess)			sess = serv->front_session;		if (sess->ignore_mode)		{			sess->ignore_mode = FALSE;		} else		{			EMIT_SIGNAL (XP_TE_CHANMODES, sess, word[4], word_eol[5],							 NULL, NULL, 0);		}		fe_update_mode_buttons (sess, 't', '-');		fe_update_mode_buttons (sess, 'n', '-');		fe_update_mode_buttons (sess, 's', '-');		fe_update_mode_buttons (sess, 'i', '-');		fe_update_mode_buttons (sess, 'p', '-');		fe_update_mode_buttons (sess, 'm', '-');		fe_update_mode_buttons (sess, 'l', '-');		fe_update_mode_buttons (sess, 'k', '-');		handle_mode (serv, outbuf, word, word_eol, "", TRUE);		break;	case 329:		sess = find_session_from_channel (word[4], serv);		if (sess)		{			if (sess->ignore_date)				sess->ignore_date = FALSE;			else				channel_date (sess, word[4], word[5]);		}		break;	case 332:		topic (serv, text);		break;	case 333:		topic_nametime (serv, word[4], word[5], word[6]);		break;	case 341:						  /* INVITE ACK */		if (prefs.show_invite_in_front_session)			if (menu_sess)				sess = menu_sess;		EMIT_SIGNAL (XP_TE_UINVITE, sess, word[4], word[5], serv->servername,						 NULL, 0);		break;	case 352:						  /* WHO */		if (!serv->skip_next_who)		{			struct session *who_sess;			who_sess = find_session_from_channel (word[4], serv);			if (who_sess)			{				sprintf (outbuf, "%s@%s", word[5], word[6]);				if (!userlist_add_hostname					 (who_sess, word[8], outbuf, word_eol[11], word[7]))				{					if (!who_sess->doing_who)						goto def;				}			} else			{				if (serv->doing_who)					do_dns (sess, outbuf, word[8], word[6]);				else					goto def;			}		} else		{			if (!strcasecmp (word[8], serv->nick))			{				struct hostent *HostAddr;				HostAddr = gethostbyname (word[6]);				if (HostAddr)				{					prefs.dcc_ip = ((struct in_addr *) HostAddr->h_addr)->s_addr;					EMIT_SIGNAL (XP_TE_FOUNDIP, sess,									 inet_ntoa (*													((struct in_addr *) HostAddr->h_addr)),									 NULL, NULL, NULL, 0);				}			}		}		break;	case 315:						  /* END OF WHO */		if (serv->skip_next_who)		{			serv->skip_next_who = FALSE;		} else		{			struct session *who_sess;			who_sess = find_session_from_channel (word[4], serv);			if (who_sess)			{				if (who_sess->doing_who)					who_sess->doing_who = FALSE;				else					goto def;			} else			{				if (serv->doing_who)					serv->doing_who = FALSE;				else					goto def;			}		}		break;	case 353:						  /* NAMES */		{			char *names, *chan;			chan = word[5];			names = word_eol[6];			if (*names == ':')				names++;			names_list (serv, chan, names);		}		break;	case 366:		if (!end_of_names (serv, word[4]))			goto def;		break;	case 367: /* banlist entry */		{			time_t ban_time = atol (word[7]);			char *time_str = ctime (&ban_time);			time_str[19] = 0;	/* get rid of the \n */			if (ban_time == 0)				time_str = "";			sess = find_session_from_channel (word[4], serv);			if (!sess)				sess = serv->front_session;		   if (!fe_is_banwindow (sess))				EMIT_SIGNAL (XP_TE_BANLIST, sess, word[4], word[5], word[6], time_str, 0);			else				fe_add_ban_list (sess, word[5], word[6], time_str);		}		break;	 case 368:		sess = find_session_from_channel (word[4], serv);		if (!sess)			sess = serv->front_session;		if (!fe_is_banwindow (sess))			goto def;		fe_ban_list_end (sess);		break;	case 376:	case 422:						  /* end of motd */		if (!serv->end_of_motd)		{			if (prefs.ip_from_server)			{				serv->skip_next_who = TRUE;				sprintf (outbuf, "WHO %s\r\n", serv->nick);				tcp_send (serv, outbuf);			}			set_default_modes (serv, outbuf);			check_willjoin_channels (serv, outbuf);			if (serv->supports_watch)				notify_send_watches (serv);			if (serv->eom_cmd)			{				handle_command (serv->eom_cmd, sess, FALSE, FALSE);				free (serv->eom_cmd);				serv->eom_cmd = NULL;			}			serv->end_of_motd = TRUE;		}		goto def;	case 433:		if (serv->end_of_motd)			goto def;		next_nick (sess, outbuf, word[4]);		break;	case 437:		if (!is_channel (serv, word[4]) && !serv->end_of_motd)			next_nick (sess, outbuf, word[4]);		else			goto def;		break;	case 471:		EMIT_SIGNAL (XP_TE_USERLIMIT, sess, word[4], NULL, NULL, NULL, 0);		break;	case 473:		EMIT_SIGNAL (XP_TE_INVITE, sess, word[4], NULL, NULL, NULL, 0);		break;	case 474:		EMIT_SIGNAL (XP_TE_BANNED, sess, word[4], NULL, NULL, NULL, 0);		break;	case 475:		EMIT_SIGNAL (XP_TE_KEYWORD, sess, word[4], NULL, NULL, NULL, 0);		break;	case 601:		notify_set_offline (serv, word[4], FALSE);		break;	case 605:		notify_set_offline (serv, word[4], TRUE);		break;	case 600:	case 604:		notify_set_online (serv, word[4]);		break;	default:	 def:		if (prefs.skipmotd && !serv->motd_skipped)		{			if (n == 375 || n == 372)				return;			if (n == 376)			{				serv->motd_skipped = TRUE;				EMIT_SIGNAL (XP_TE_MOTDSKIP, sess, NULL, NULL, NULL, NULL, 0);				return;			}		}		if (n == 375 || n == 372 || n == 376 || n == 422)		{			EMIT_SIGNAL (XP_TE_MOTD, serv->front_session, text, NULL,							 NULL, NULL, 0);			return;		}		if (is_channel (serv, text))		{			char *chan = word[3];			if (!strncasecmp (serv->nick, chan, strlen (serv->nick)))				chan += strlen (serv->nick) + 1;			if (*chan == ':')				chan++;			realsess = find_session_from_channel (chan, serv);			if (!realsess)				realsess = sess;			EMIT_SIGNAL (XP_TE_SERVTEXT, realsess, text, NULL, NULL, NULL, 0);		} else		{			EMIT_SIGNAL (XP_TE_SERVTEXT, serv->front_session, text, NULL,							 NULL, NULL, 0);		}	}}/* process_line() */voidprocess_line (struct server *serv, char *buf){	session *sess;#ifdef USE_PERL	session *tmp_sess;	char *type;#endif	char pdibuf[522];				  /* 1 line can't exceed 512 bytes!! */	char outbuf[4096];	char ip[128], nick[NICKLEN];	char *word[PDIWORDS];	char *word_eol[PDIWORDS];	char *text, *ex, *cmd;	int n;	sess = serv->front_session;	if (!sess)	{		/*fprintf (stderr,					"*** XCHAT WARNING: process_line(), sess=0x0 for data: %s\n",					buf);*/		return;	}	fe_add_rawlog (serv, buf, FALSE);	fe_checkurl (buf);	/* split line into words and words_to_end_of_line */	if (*buf == ':')		process_data_init (pdibuf, buf + 1, word, word_eol, FALSE);	else		process_data_init (pdibuf, buf, word, word_eol, FALSE);#ifdef USE_PERL	/* tell perl that we got a line of data */	if (*buf == ':' && is_channel (serv, word[3]))		tmp_sess = find_session_from_channel (word[3], serv);	else		tmp_sess = sess;	if (!tmp_sess)		tmp_sess = sess;	/* for server messages, the 2nd word is the "message type" */	if (*buf == ':')		type = word[2];	else		type = pdibuf;	if (perl_inbound (tmp_sess, serv, buf, type))		return;#endif	if (EMIT_SIGNAL (XP_INBOUND, sess, serv, buf, NULL, NULL, 0) == 1)		return;	if (*buf != ':')	{		if (!strncmp (buf, "NOTICE ", 7))		{			buf += 7;		}		if (!strncmp (buf, "PING ", 5))		{			sprintf (outbuf, "PONG %s\r\n", buf + 5);			tcp_send (serv, outbuf);			return;		}		if (!strncmp (buf, "ERROR", 5))		{			EMIT_SIGNAL (XP_TE_SERVERERROR, sess, buf + 7, NULL, NULL, NULL, 0);			return;		}		EMIT_SIGNAL (XP_TE_SERVERGENMESSAGE, sess, buf, NULL, NULL, NULL, 0);		return;	}	buf++;	/* see if the second word is a numeric */	n = atoi (word[2]);	if (n)	{		text = word_eol[3];		if (*text)		{			if (!strncasecmp (serv->nick, text, strlen (serv->nick)))				text += strlen (serv->nick) + 1;			if (*text == ':')				text++;			process_numeric (serv, sess, outbuf, n, word, word_eol, text);		}		return;	}	/* fill in the "ip" and "nick" buffers */	ex = strchr (pdibuf, '!');	if (!ex)							  /* no '!', must be a server message */	{		safe_strcpy (ip, pdibuf, sizeof (ip));		safe_strcpy (nick, pdibuf, sizeof (nick));	} else	{		safe_strcpy (ip, ex + 1, sizeof (ip));		safe_strcpy (nick, pdibuf, sizeof (nick));		if ((ex - pdibuf) < sizeof (nick))			nick[ex - pdibuf] = 0; /* cut the buffer at the '!' */	}	cmd = word[2];	if (!strcmp ("INVITE", cmd))	{		if (ignore_check (pdibuf, 0, 0, 0, 0, 1))			return;		if (prefs.show_invite_in_front_session)			if (menu_sess)				sess = menu_sess;		EMIT_SIGNAL (XP_TE_INVITED, sess, word[4] + 1, nick, serv->servername,						 NULL, 0);		return;	}	if (!strcmp ("JOIN", cmd))	{		char *chan = word[3];		if (*chan == ':')			chan++;		if (!strcasecmp (nick, serv->nick))			you_joined (serv, outbuf, chan, nick, ip);		else			user_joined (serv, chan, nick, ip);		return;	}	if (!strcmp ("MODE", cmd))	{		handle_mode (serv, outbuf, word, word_eol, nick, FALSE);	/* modes.c */		return;	}	if (!strcmp ("NICK", cmd))	{		user_new_nick (serv, nick, word_eol[3], FALSE);		return;	}	if (!strcmp ("NOTICE", cmd))	{		char *to = word[3];		if (*to)		{			char *msg = word_eol[4];			if (*msg == ':')				msg++;			if (prefs.fudgeservernotice && (strcmp (nick, serv->servername) == 0 || strchr (nick, '.')))			{				EMIT_SIGNAL (XP_TE_SERVERGENMESSAGE, sess, msg, NULL,								 NULL, NULL, 0);			} else			{				if (ignore_check (pdibuf, 0, 1, 0, 0, 0))					return;				notice (serv, outbuf, to, nick, msg, ip);			}			return;		}	}	if (!strcmp ("PART", cmd))	{		char *chan = cmd + 5;		char *reason = word_eol[4];		if (*chan == ':')			chan++;		if (*reason == ':')			reason++;		if (!strcmp (nick, serv->nick))			you_parted (serv, chan, ip, reason);		else			user_parted (serv, chan, nick, ip, reason);		return;	}	if (!strcmp ("PRIVMSG", cmd))	{		char *to = word[3];		if (*to)		{			char *msg = word_eol[4];			if (*msg == ':')				msg++;			if (msg[0] == 1 && msg[strlen (msg) - 1] == 1)	/* ctcp */			{				if (strncasecmp (msg + 1, "ACTION", 6) != 0)					flood_check (nick, ip, serv, sess, 0);				if (ignore_check (pdibuf, 0, 0, 0, 1, 0))					return;				if (strncasecmp (msg + 1, "DCC ", 4) == 0)					/* redo this with handle_quotes TRUE */					process_data_init (pdibuf, buf, word, word_eol, TRUE);				handle_ctcp (sess, outbuf, to, nick, msg + 1, word, word_eol);			} else			{				if (is_channel (serv, to))				{					if (ignore_check (pdibuf, 0, 0, 1, 0, 0))						return;					channel_msg (serv, outbuf, to, nick, msg, FALSE);				} else				{					if (ignore_check (pdibuf, 1, 0, 0, 0, 0))						return;					private_msg (serv, outbuf, nick, ip, msg);				}			}			return;		}	}	if (!strcmp ("PONG", cmd))	{		char *timestring = word[4];		if (*timestring == ':')			timestring++;		got_ping_reply (serv->front_session, outbuf,								timestring, word[3]);		return;	}	if (!strcmp ("QUIT", cmd))	{		user_quit (serv, nick, ip,			(word_eol[3][0] == ':') ? word_eol[3] + 1 : word_eol[3]);		return;	}	if (!strcmp ("TOPIC", cmd))	{		new_topic (serv, nick, word[3],			(word_eol[4][0] == ':') ? word_eol[4] + 1 : word_eol[4]);		return;	}	if (!strcmp ("KICK", cmd))	{		char *kicked = word[4];		char *reason = word_eol[5];		if (*kicked)		{			if (*reason == ':')				reason++;			if (!strcmp (kicked, serv->nick)) 				you_kicked (serv, outbuf, word[3], nick, reason);			else				user_kicked (serv, word[3], kicked, nick, reason);			return;		}	}	if (!strcmp ("KILL", cmd))	{		EMIT_SIGNAL (XP_TE_KILL, sess, nick, word_eol[5], NULL, NULL, 0);		return;	}	if (!strcmp ("WALLOPS", cmd))	{		text = word_eol[3];		if (*text == ':')			text++;		EMIT_SIGNAL (XP_TE_WALLOPS, sess, nick, text, NULL, NULL, 0);		return;	}	sprintf (outbuf, "(%s/%s) %s\n", nick, ip, word_eol[2]);	PrintText (sess, outbuf);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -