5749370 [rkeene@sledge /home/rkeene/projects/ircbot/bot]$ cat -n bot.h
  1 /* bot.h version 0.333 */
  2 /* all versions previous to 0.333 are completely public domain */
  3 /* all contributed code falls under the same BSD style license as */
  4 /* noted below unless the contributing author places a copyright */
  5 /* notice in their file/s. */
  6 
  7 
  8 /*
  9  *  * Copyright (c) 2001 David T. Stiles
 10  *  * All rights reserved.
 11  *  *
 12  *  * Redistribution and use in source and binary forms, with or without
 13  *  * modification, are permitted provided that the following conditions
 14  *  * are met:
 15  *  * 1. Redistributions of source code must retain the above copyright
 16  *  *    notice, this list of conditions and the following disclaimer.
 17  *  * 2. Redistributions in binary form must reproduce the above copyright
 18  *  *    notice, this list of conditions and the following disclaimer in the
 19  *  *    documentation and/or other materials provided with the distribution.
 20  *  * 3. All advertising materials mentioning features or use of this software
 21  *  *    must display the following acknowledgement:
 22  *  *      This product includes software developed by David T. Stiles
 23  *  * 4. The name David T. Stiles may not be used to endorse or promote
 24  *  *    products derived from this software without specific prior written
 25  *  *    permission.
 26  *  *
 27  *  * THIS SOFTWARE IS PROVIDED BY DAVID T. STILES `AS IS'' AND ANY
 28  *  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 29  *  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 30  *  * ARE DISCLAIMED.  IN NO EVENT SHALL DAVID T. STILES BE LIABLE
 31  *  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 32  *  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 33  *  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 34  *  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 35  *  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 36  *  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 37  *  * SUCH DAMAGE.
 38  *  */
 39 
 40 /* this code would not be possible without the patience and intelligence */
 41 /* provided by many of the people from #c/efnet. I thank all of you sincerely. */
 42 
 43 #ifndef _BOT_H
 44 #define _BOT_H 1
 45 
 46 #include <sys/types.h>
 47 #include <stdio.h>
 48 #include <stdlib.h>
 49 #include <string.h>
 50 #include <sys/socket.h>
 51 #include <netdb.h>
 52 #include <netinet/in.h>
 53 #include <errno.h>
 54 #include <sys/time.h>
 55 #include <time.h>
 56 #include <unistd.h>
 57 #include <signal.h>
 58 #include <ctype.h>
 59 
 60 
 61 
 62 #define MAXDATASIZE 515
 63 #define NEWLINE '\n'
 64 
 65 
 66 
 67 void send_irc_message( char *sndmsg );
 68 void parse_incoming( char *ptr );
 69 void make_a_decision( void);
 70 void main_loop( void );
 71 void reply_ping( char *ptr );
 72 int prep( void );
 73 int load_cfg( void );
 74 int process_out( void );
 75 int host_connect( char *exthost, int extport, int extsockfd );
 76 int chop( char *in, char *out, int position, char separator );
 77 int process_in( void );
 78 int irc_connect( void );
 79 int load_cfg( void );
 80 int main(int argc, char *argv[]);
 81 void do_ctcp( void );
 82 void clean_message( char *msg );
 83 int prep( void );
 84 int dcalc_stub( void );
 85 void rawirc( void );
 86 int rpn_stub( void );
 87 void help( void );
 88 void chpass_stub( void );
 89 void docalc_stub( void );
 90 void oppeople_stub( void );
 91 void owncalc_stub( void );
 92 void whois_stub( void );
 93 void adduser_stub( void );
 94 void rmuser_stub( void );
 95 void rmcalc_stub( void );
 96 void mkcalc_stub( void );
 97 void listcalc_stub( void );
 98 void searchcalc_stub( void );
 99 
100 
101 /* this is what an irc message will be broken down to */
102 
103 struct message {
104    char nick[MAXDATASIZE];
105    char userline[MAXDATASIZE];
106    char msgtype[MAXDATASIZE];
107    char msgto[MAXDATASIZE];
108    char fulltext[MAXDATASIZE];
109    char logname[MAXDATASIZE];
110    char hostname[MAXDATASIZE];
111    char msgarg1[MAXDATASIZE];
112    char msgarg2[MAXDATASIZE];
113    char msgarg3[MAXDATASIZE];
114    char msgarg4[MAXDATASIZE];
115    char msgarg5[MAXDATASIZE];
116    char msgarg6[MAXDATASIZE];
117    char msgarg7[MAXDATASIZE];
118    char msgarg8[MAXDATASIZE];
119    char msgarg9[MAXDATASIZE];
120   };
121 
122 
123 
124 #define HELPHELP "you should /msg me help commands or help <command-name>."
125 #define COMMANDS "calc, op, chpass, whois, rmcalc, mkcalc, owncalc, searchcalc, listcalc, rmuser, adduser, rawirc. Try,
	help syntax or help commandname."
126 #define SYNTAX "Most user commands take the form of COMMAND PASSWORD USERNAME ARGUMENT/S. The op command requires only a
	password if your nick is the same as your username."
127 #define ADDUSER "adduser yourpass yourlogin newpass newlogin"
128 #define CHPASS "chpass yourpass yourlogin newpass"
129 #define RMUSER "rmuser yourpass yourlogin username-to-delete"
130 #define RMCALC "rmcalc yourpass yourlogname calc-to-delete"
131 #define MKCALC "mkcalc yourpass yourlogname calckey calcdata"
132 #define OP "op #channel yourpass yourlogin, or merely, op yourpass, if your nick, username, and default channel all
	synchronize."
133 #define CHATTR "chattr yourpass yourlogin username attributes."
134 #define RAWIRC "rawirc yourpass yourlogin raw-irc-protocol   no leading / is needed."
135 #define OWNCALC "owncalc calcname index. will print who the owner of a calc is. will detect erroneus duplicates as well.
	index can be used to start the search at other than the beginning of the database."
136 #define LISTCALC "listcalc username index. will print a list of calcs owned by username. index can be used to start the
	search at other than the beginning of the database."
137 #define SEARCHCALC "searchcalc substring index. will search the calc data field for an occurrence of substring. index
	can be used to start the search at other than the beginning of the database."
138 #define WHOIS "whois username."
139 
140 #define DEF_CHAN "#c"
141 
142 #endif /* !_BOT_H */
5749371 [rkeene@sledge /home/rkeene/projects/ircbot/bot]$

Click here to go back to the directory listing.
Click here to download this file.
last modified: 2003-12-11 08:06:35