irc_connection.h

Go to the documentation of this file.
00001 /*
00002 **  ClanLib SDK
00003 **  Copyright (c) 1997-2009 The ClanLib Team
00004 **
00005 **  This software is provided 'as-is', without any express or implied
00006 **  warranty.  In no event will the authors be held liable for any damages
00007 **  arising from the use of this software.
00008 **
00009 **  Permission is granted to anyone to use this software for any purpose,
00010 **  including commercial applications, and to alter it and redistribute it
00011 **  freely, subject to the following restrictions:
00012 **
00013 **  1. The origin of this software must not be misrepresented; you must not
00014 **     claim that you wrote the original software. If you use this software
00015 **     in a product, an acknowledgment in the product documentation would be
00016 **     appreciated but is not required.
00017 **  2. Altered source versions must be plainly marked as such, and must not be
00018 **     misrepresented as being the original software.
00019 **  3. This notice may not be removed or altered from any source distribution.
00020 **
00021 **  Note: Some of the libraries ClanLib may link to may have additional
00022 **  requirements or restrictions.
00023 **
00024 **  File Author(s):
00025 **
00026 **    Magnus Norddahl
00027 */
00028 
00031 
00032 #pragma once
00033 
00034 #ifdef _MSC_VER
00035 #pragma warning (disable:4786)
00036 #endif
00037 
00038 #include "../api_network.h"
00039 #include "../../Core/Text/string_types.h"
00040 #include <vector>
00041 #include <list>
00042 #include <queue>
00043 #include "../../Core/Signals/signal_v1.h"
00044 #include "../../Core/Signals/signal_v2.h"
00045 #include "../../Core/Signals/signal_v3.h"
00046 #include "../../Core/Signals/signal_v4.h"
00047 #include "irc_numerics.h"
00048 
00049 class CL_IRCConnection_Generic;
00050 
00077 class CL_API_NETWORK CL_IRCConnection
00078 {
00081 
00082 public:
00087         CL_IRCConnection();
00088 
00093         CL_IRCConnection(const CL_String &server, const CL_String &port = cl_text("6667"));
00094 
00098         CL_IRCConnection(const CL_IRCConnection &copy);
00099 
00100         ~CL_IRCConnection();
00101 
00105 
00106 public:
00108         const CL_String8 &get_nick() const;
00109 
00111         const CL_String8 &get_username() const;
00112 
00114         const CL_String8 &get_hostname() const;
00115 
00117         const CL_String8 &get_servername() const;
00118 
00120         const CL_String8 &get_realname() const;
00121 
00125 
00126 public:
00127         CL_IRCConnection &operator =(const CL_IRCConnection &copy);
00128 
00137         void send_command(const CL_String8 &prefix, const CL_String8 &command, const std::vector<CL_String8> &params);
00138 
00143         void send_pass(const CL_String8 &password);
00144 
00150         void send_nick(const CL_String8 &nick, int hopcount = -1);
00151 
00161         void send_user(const CL_String8 &username, const CL_String8 &hostname, const CL_String8 &servername, const CL_String8 &realname);
00162 
00167         void send_oper(const CL_String8 &user, const CL_String8 &password);
00168 
00170         void send_quit(const CL_String8 &quitmessage = "");
00171 
00178         void send_join(const CL_String8 &channel, const CL_String8 &key = "");
00179 
00184         void send_join(const std::list<CL_String8> &channels, const std::list<CL_String8> &keys);
00185 
00191         void send_part(const CL_String8 &channel, const CL_String8 &reason = "");
00192 
00197         void send_part(const std::list<CL_String8> &channels, const CL_String8 &reason = "");
00198 
00204         void send_mode(const CL_String8 &target, const CL_String8 &mode, const std::vector<CL_String8> &args);
00205 
00212         void send_topic(const CL_String8 &channel, const CL_String8 &topic);
00213 
00217         void send_topic(const CL_String8 &channel);
00218 
00222         void send_names(const CL_String8 &channel = "");
00223 
00227         void send_names(const std::list<CL_String8> &channels);
00228 
00233         void send_list(const CL_String8 &channel = "", const CL_String8 &server = "");
00234 
00239         void send_list(const std::list<CL_String8> &channels, const CL_String8 &server = "");
00240 
00245         void send_invite(const CL_String8 &nickname, const CL_String8 &channel);
00246 
00248         void send_kick(const CL_String8 &channel, const CL_String8 &user, const CL_String8 &comment = "");
00249 
00255         void send_kick(const std::list<CL_String8> &channels, const std::list<CL_String8> &users, const CL_String8 &comment = "");
00256 
00258         void send_version(const CL_String8 &server = "");
00259 
00261         void send_stats(const CL_String8 &query = "", const CL_String8 &server = "");
00262 
00264         void send_links(const CL_String8 &remote_server = "", const CL_String8 &server_mask = "");
00265 
00267         void send_time(const CL_String8 &server = "");
00268 
00270         void send_connect(const CL_String8 &target_server, int port = 0, const CL_String8 &remote_server = "");
00271 
00273         void send_trace(const CL_String8 &server = CL_String8());
00274 
00276         void send_admin(const CL_String8 &server = CL_String8());
00277 
00279         void send_info(const CL_String8 &server = CL_String8());
00280 
00285         void send_privmsg(const CL_String8 &receiver, const CL_String8 &text);
00286 
00291         void send_privmsg(const std::list<CL_String8> &receivers, const CL_String8 &text);
00292 
00298         void send_privmsg_ctcp(const CL_String8 &receiver, const CL_String8 &command, const CL_String8 &data);
00299 
00305         void send_privmsg_ctcp(std::list<CL_String8> &receivers, const CL_String8 &command, const CL_String8 &data);
00306 
00311         void send_notice(const CL_String8 &nickname, const CL_String8 &text);
00312 
00318         void send_notice_ctcp(const CL_String8 &nickname, const CL_String8 &command, const CL_String8 &data);
00319 
00324         void send_who(const CL_String8 &name, bool oper = false);
00325 
00330         void send_whois(const CL_String8 &nickmask);
00331 
00336         void send_whois(const CL_String8 &server, const CL_String8 &nickmask);
00337 
00341         void send_whois(const std::list<CL_String8> &nickmasks);
00342 
00347         void send_whois(const CL_String8 &server, const std::list<CL_String8> &nickmasks);
00348 
00354         void send_whowas(const CL_String8 &nickname, int count = 0, const CL_String8 &server = "");
00355 
00360         void send_kill(const CL_String8 &nickname, const CL_String8 &comment);
00361 
00366         void send_ping(const CL_String8 &server, const CL_String8 &server2 = "");
00367 
00372         void send_pong(const CL_String8 &daemon, const CL_String8 &daemon2 = "");
00373 
00375         static CL_String8 extract_nick(const CL_String8 &str);
00376 
00378         static CL_String8 extract_user(const CL_String8 &str);
00379 
00381         static CL_String8 extract_address(const CL_String8 &str);
00382 
00386 
00387 public:
00389         CL_Signal_v1<const CL_String &> &sig_socket_error();
00390 
00392         CL_Signal_v3<const CL_String8 &, const CL_String8 &, const std::vector<CL_String8> &> &sig_command_received();
00393 
00395         CL_Signal_v3<const CL_String8 &, const CL_String8 &, const std::vector<CL_String8> &> &sig_unknown_command_received();
00396 
00398         CL_Signal_v3<const CL_String8 &, int, const std::vector<CL_String8> &> &sig_numeric_reply();
00399 
00401         CL_Signal_v3<const CL_String8 &, const CL_String8 &, const std::vector<CL_String8> &> &sig_name_reply();
00402 
00404         CL_Signal_v2<const CL_String8 &, const CL_String8 &> &sig_nick();
00405 
00407         CL_Signal_v2<const CL_String8 &, const CL_String8 &> &sig_join();
00408 
00410         CL_Signal_v3<const CL_String8 &, const CL_String8 &, const CL_String8 &> &sig_part();
00411 
00413         CL_Signal_v4<const CL_String8 &, const CL_String8 &, const CL_String8 &, const std::vector<CL_String8> &> &sig_mode();
00414 
00416         CL_Signal_v3<const CL_String8 &, const CL_String8 &, const CL_String8 &> &sig_topic();
00417 
00419         CL_Signal_v3<const CL_String8 &, const CL_String8 &, const CL_String8 &> &sig_invite();
00420 
00422         CL_Signal_v4<const CL_String8 &, const CL_String8 &, const CL_String8 &, const CL_String8 &> &sig_kick();
00423 
00425         CL_Signal_v3<const CL_String8 &, const CL_String8 &, const CL_String8 &> &sig_privmsg();
00426 
00428         CL_Signal_v3<const CL_String8 &, const CL_String8 &, const CL_String8 &> &sig_notice();
00429 
00431         CL_Signal_v4<const CL_String8 &, const CL_String8 &, const CL_String8 &, const CL_String8 &> &sig_privmsg_ctcp();
00432 
00434         CL_Signal_v4<const CL_String8 &, const CL_String8 &, const CL_String8 &, const CL_String8 &> &sig_notice_ctcp();
00435 
00437         CL_Signal_v2<const CL_String8 &, const CL_String8 &> &sig_ping();
00438 
00442 
00443 private:
00444         CL_SharedPtr<CL_IRCConnection_Generic> impl;
00446 };
00447 

Generated on Thu Dec 3 02:39:29 2009 for ClanLib by  doxygen 1.4.6