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

📄 irc_connection_generic.h

📁 这是一款2d游戏引擎
💻 H
字号:
/*  $Id: irc_connection_generic.h,v 1.9 2003/12/31 15:47:27 mbn Exp $
**
**  ClanLib Game SDK
**  Copyright (C) 2003  The ClanLib Team
**  For a total list of contributers see the file CREDITS.
**
**  This library is free software; you can redistribute it and/or
**  modify it under the terms of the GNU Lesser General Public
**  License as published by the Free Software Foundation; either
**  version 2.1 of the License, or (at your option) any later version.
**
**  This library 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
**  Lesser General Public License for more details.
**
**  You should have received a copy of the GNU Lesser General Public
**  License along with this library; if not, write to the Free Software
**  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
*/

#ifndef header_irc_connection_generic
#define header_irc_connection_generic

#if _MSC_VER > 1000
#pragma once
#endif

#include "API/Network/Socket/socket.h"
#include "API/Network/IRC/irc_connection.h"
#include "API/Core/System/thread.h"
#include "API/Core/System/keep_alive.h"
#include "API/Core/System/mutex.h"
#include "API/Core/System/event_trigger.h"

class CL_IRCConnection_Generic : private CL_Runnable, private CL_KeepAlive
{
//! Construction:
public:
	CL_IRCConnection_Generic(const std::string &server, const std::string &port);

	~CL_IRCConnection_Generic();

//! Attributes:
public:
	//: sig_socket_error(std::string error_message)
	CL_Signal_v1<const std::string &> sig_socket_error;

	//: sig_command_received(prefix, command, params)
	CL_Signal_v3<const std::string &, const std::string &, const std::vector<std::string> &> sig_command_received;

	//: sig_unknown_command_received(prefix, command, params)
	CL_Signal_v3<const std::string &, const std::string &, const std::vector<std::string> &> sig_unknown_command_received;

	//: sig_numeric_reply(prefix, code, params)
	CL_Signal_v3<const std::string &, int, const std::vector<std::string> &> sig_numeric_reply;
	
	//: sig_name_reply(self, channel, users)
	CL_Signal_v3<const std::string &, const std::string &, const std::vector<std::string> &> sig_name_reply;

	//: sig_nick(old_nick, new_nick)
	CL_Signal_v2<const std::string &, const std::string &> sig_nick;

	//: sig_join(nick, channel)
	CL_Signal_v2<const std::string &, const std::string &> sig_join;
	
	//: sig_part(nick, channel, reason)
	CL_Signal_v3<const std::string &, const std::string &, const std::string &> sig_part;
	
	//: sig_mode(prefix, receiver, mode, params)
	CL_Signal_v4<const std::string &, const std::string &, const std::string &, const std::vector<std::string> &> sig_mode;

	//: sig_topic(prefix, channel, topic)
	CL_Signal_v3<const std::string &, const std::string &, const std::string &> sig_topic;
	
	//: sig_invite(prefix, nick, channel)
	CL_Signal_v3<const std::string &, const std::string &, const std::string &> sig_invite;

	//: sig_kick(prefix, chan, user, comment)
	CL_Signal_v4<const std::string &, const std::string &, const std::string &, const std::string &> sig_kick;

	//: sig_privmsg(prefix, receiver, text)
	CL_Signal_v3<const std::string &, const std::string &, const std::string &> sig_privmsg;

	//: sig_notice(prefix, receiver, text)
	CL_Signal_v3<const std::string &, const std::string &, const std::string &> sig_notice;

	//: sig_privmsg_ctcp(prefix, receiver, command, data)
	CL_Signal_v4<const std::string &, const std::string &, const std::string &, const std::string &> sig_privmsg_ctcp;

	//: sig_notice_ctcp(prefix, receiver, command, data)
	CL_Signal_v4<const std::string &, const std::string &, const std::string &, const std::string &> sig_notice_ctcp;

	//: sig_ping(daemon1, daemon2)
	CL_Signal_v2<const std::string &, const std::string &> sig_ping;

	CL_Thread thread;
	
	CL_Mutex mutex;
	
	CL_Socket sock;

	std::queue<std::string> received_queue;

	std::string nick, username, hostname, servername, realname;
	
	CL_EventTrigger quit_trigger;

//! Operations:
public:
	void add_ref();

	void release_ref();

//! Implementation:
private:
	virtual void run();
	
	virtual void keep_alive();
	
	bool signal_error;
	
	std::string error_message;
	
	int ref_count;
};

#endif

⌨️ 快捷键说明

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