summary refs log tree commit diff stats
path: root/IRC.h
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2013-08-10 12:50:50 -0400
committerKelly Rauchenberger <fefferburbia@gmail.com>2013-08-10 12:50:50 -0400
commit17dec0f70d683ffe217173f9de4ad2a92128487c (patch)
treeb0b3d3ea999e5a4790e39b15e7877f548cef37dd /IRC.h
downloadkankri-17dec0f70d683ffe217173f9de4ad2a92128487c.tar.gz
kankri-17dec0f70d683ffe217173f9de4ad2a92128487c.tar.bz2
kankri-17dec0f70d683ffe217173f9de4ad2a92128487c.zip
first commit
Diffstat (limited to 'IRC.h')
-rwxr-xr-xIRC.h101
1 files changed, 101 insertions, 0 deletions
diff --git a/IRC.h b/IRC.h new file mode 100755 index 0000000..09df766 --- /dev/null +++ b/IRC.h
@@ -0,0 +1,101 @@
1/*
2 cpIRC - C++ class based IRC protocol wrapper
3 Copyright (C) 2003 Iain Sheppard
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
19 Contacting the author:
20 ~~~~~~~~~~~~~~~~~~~~~~
21
22 email: iainsheppard@yahoo.co.uk
23 IRC: #magpie @ irc.quakenet.org
24*/
25
26#include <stdio.h>
27#include <stdarg.h>
28
29#define __CPIRC_VERSION__ 0.1
30#define __IRC_DEBUG__ 1
31
32#define IRC_USER_VOICE 1
33#define IRC_USER_HALFOP 2
34#define IRC_USER_OP 4
35
36struct irc_reply_data
37{
38 char* nick;
39 char* ident;
40 char* host;
41 char* target;
42};
43
44struct irc_command_hook
45{
46 char* irc_command;
47 int (*function)(char*, irc_reply_data*, void*);
48 irc_command_hook* next;
49};
50
51struct channel_user
52{
53 char* nick;
54 char* channel;
55 char flags;
56 channel_user* next;
57};
58
59class IRC
60{
61public:
62 IRC();
63 ~IRC();
64 int start(char* server, int port, char* nick, char* user, char* name, char* pass);
65 void disconnect();
66 int privmsg(char* target, char* message);
67 int privmsg(char* fmt, ...);
68 int notice(char* target, char* message);
69 int notice(char* fmt, ...);
70 int join(char* channel);
71 int part(char* channel);
72 int kick(char* channel, char* nick);
73 int kick(char* channel, char* nick, char* message);
74 int mode(char* modes);
75 int mode(char* channel, char* modes, char* targets);
76 int nick(char* newnick);
77 int quit(char* quit_message);
78 int raw(char* data);
79 void hook_irc_command(char* cmd_name, int (*function_ptr)(char*, irc_reply_data*, void*));
80 int message_loop();
81 int is_op(char* channel, char* nick);
82 int is_voice(char* channel, char* nick);
83 char* current_nick();
84private:
85 void call_hook(char* irc_command, char*params, irc_reply_data* hostd);
86 /*void call_the_hook(irc_command_hook* hook, char* irc_command, char*params, irc_host_data* hostd);*/
87 void parse_irc_reply(char* data);
88 void split_to_replies(char* data);
89 void insert_irc_command_hook(irc_command_hook* hook, char* cmd_name, int (*function_ptr)(char*, irc_reply_data*, void*));
90 void delete_irc_command_hook(irc_command_hook* cmd_hook);
91 int irc_socket;
92 bool connected;
93 bool sentnick;
94 bool sentpass;
95 bool sentuser;
96 char* cur_nick;
97 FILE* dataout;
98 FILE* datain;
99 channel_user* chan_users;
100 irc_command_hook* hooks;
101};