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

📄 ircprocessor.h

📁 J-Alice是一个用C++实现的Ailcebot的克隆。它可以做为一个mini-http服务器在控制台或irc聊天。目前
💻 H
字号:
/**
 * IrcProcessor - Configures and connects to IRC
 *
 * @author	Jonathan Roewen
 */
#ifndef IRC_PROCESSOR_H
#define IRC_PROCESSOR_H

#include "AimlProcessor.h"
#include "IrcResponder.h"
#include "Kernel.h"

#include <string>

using namespace std;

class IrcProcessor : public AimlProcessor
{
public:
	~IrcProcessor() { }
	
	string getName() const {
		return "irc";
	}
	string getVersion() const {
		return "1.0";
	}
	string process(Match *m, PElement e, Responder *r, const string &id) {
		string nick = Kernel::process(m, e->getChild("nick"), r, id);
		string server = Kernel::process(m, e->getChild("server"), r, id);
		int port = atoi(Kernel::process(m, e->getChild("port"), r, id).c_str());
		string channel = Kernel::process(m, e->getChild("channel"), r, id);
		new IrcResponder(server, port, nick, channel);
		
	/*	static IrcClient *ic = NULL;
		if (e->getTagname() == "topic" && ic) {
			return ic->getTopic();
		} else
		if (e->getTagname() == "channel" && ic) {
			return ic->getChannel();
		} else
		if (e->getTagname() == "lastnick" && ic) {
			return ic->getLastnick();
		} else
		if (e->getTagname() == "command" && ic) {
			ic->sendCommand(Kernel::process(m, e, r, id));
		} else {
			string nick = Kernel::process(m, e->getChild("nick"), r, id);
			string server = Kernel::process(m, e->getChild("server"), r, id);
			int port = atoi(Kernel::process(m, e->getChild("port"), r, id).c_str());
			string channel = Kernel::process(m, e->getChild("channel"), r, id);
			
			ic = new IrcClient(server, port);
			ic->connect(nick, channel);
		}*/
		return "";
	}
};

#endif

⌨️ 快捷键说明

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