From a8aadf64c9e04ac2572a22f94c89bf54aee0edf1 Mon Sep 17 00:00:00 2001 From: zido Date: Fri, 31 Mar 2006 15:38:42 +0000 Subject: Started work on commands for the IRC Bot. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@5827 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/irc.c | 16 ++++++++++++++++ src/map/irc.h | 6 ++++++ 2 files changed, 22 insertions(+) (limited to 'src') diff --git a/src/map/irc.c b/src/map/irc.c index 0104fcfb7..f1f6b0e0a 100644 --- a/src/map/irc.c +++ b/src/map/irc.c @@ -35,6 +35,7 @@ typedef int socklen_t; #include "map.h" #include "pc.h" #include "irc.h" +#include "intif.h" //For GM Broadcast [Zido] short use_irc=0; @@ -48,6 +49,9 @@ IRC_SI *irc_si=NULL; char irc_nick[30]=""; char irc_password[32]=""; +// #define AUTH_PASS "setpasshere" //(WIP, don't remove) Password to use commands) [Zido] +#define ALLOWED_NICK "" //Allowed nickname to use commands [Zido] + char irc_channel[32]=""; char irc_trade_channel[32]=""; @@ -195,6 +199,9 @@ void irc_send(char *buf) void irc_parse_sub(int fd, char *incoming_string) { + int i=0; + int authed=0; + char kami[256]; //[Zido] char source[256]; char command[256]; char target[256]; @@ -250,6 +257,15 @@ void irc_parse_sub(int fd, char *incoming_string) } } + //if((strcmpi(command,"privmsg")==0)&&(strcmpi(message,"pass "AUTH_PASS"")==0)&&(target[0]!='#')) + + // Broadcast [Zido] (Work in Progress) + if((strcmpi(command,"privmsg")==0)&&(sscanf(message,"!eakami %s",kami)>0)&&(strcmp(ALLOWED_NICK,source_nick)==0)) { + intif_GMmessage(kami,strlen(kami)+1,0); + sprintf(send_string,"NOTICE %s :Message Sent",source_nick); + irc_send(send_string); + } + return; } diff --git a/src/map/irc.h b/src/map/irc.h index fe48c51ff..044aeddf9 100644 --- a/src/map/irc.h +++ b/src/map/irc.h @@ -1,5 +1,7 @@ #include "map.h" +#define MAX_ADMINS 25 // [Zido] + extern short use_irc; extern short irc_announce_flag; @@ -24,4 +26,8 @@ struct IRC_Session_Info { char username[30]; char password[33]; }; + +/*struct IRC_Authed { + char host[256]; +};*/ //(WIP, Don't remove) [Zido] typedef struct IRC_Session_Info IRC_SI; -- cgit v1.2.3-70-g09d2