From f2ebcf306b3163894618b869aa676e1684db5b98 Mon Sep 17 00:00:00 2001 From: Zido Date: Thu, 6 Apr 2006 18:34:45 +0000 Subject: git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@5935 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog-Trunk.txt | 4 ++ src/map/irc.c | 155 +++++++++++++++++++++++++++++++++++++++++++++++----- src/map/irc.h | 26 +++++++-- 3 files changed, 166 insertions(+), 19 deletions(-) diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index ecda39262..dfa82f75b 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -4,6 +4,10 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK. 2006/04/06 + * The IRC Bot is now able to check each users access level prefix + in the channel (~/&/@/%/+), the IRC command @kami now requires the + user to be at least channel operator(@). Now I need to make it store + the users access level on every nick/mode change. [Zido] * Changed the default of skill_add_range to 0, said value now disables skill-range checking when casting ends. [Skotlex] * Corrected the Soul Drain formula, thanks to Haplo for pointing it out. diff --git a/src/map/irc.c b/src/map/irc.c index fc375ff2d..9cbc25dff 100644 --- a/src/map/irc.c +++ b/src/map/irc.c @@ -14,6 +14,7 @@ typedef int socklen_t; #include #include #include +#include #ifndef SIOCGIFCONF #include // SIOCGIFCONF on Solaris, maybe others? [Shinomori] @@ -37,7 +38,7 @@ typedef int socklen_t; #include "irc.h" #include "intif.h" //For GM Broadcast [Zido] -short use_irc=0; +short use_irc=1; short irc_announce_flag=1; short irc_announce_mvp_flag=1; @@ -46,20 +47,20 @@ short irc_announce_shop_flag=1; IRC_SI *irc_si=NULL; -char irc_nick[30]=""; +char irc_nick[30]="Zido[eABot]"; 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_channel[32]="#ROsucks"; char irc_trade_channel[32]=""; -unsigned char irc_ip_str[128]=""; -unsigned long irc_ip=0; +unsigned char irc_ip_str[128]="irc.deltaanime.net"; +unsigned long irc_ip=6667; unsigned short irc_port = 6667; int irc_fd=0; +struct channel_data cd; +int last_cd_user=0; + int irc_connect_timer(int tid, unsigned int tick, int id, int data) { if(irc_si && session[irc_si->fd]) @@ -199,7 +200,6 @@ void irc_send(char *buf) void irc_parse_sub(int fd, char *incoming_string) { - char kami[256]; //[Zido] char source[256]; char command[256]; char target[256]; @@ -210,13 +210,19 @@ void irc_parse_sub(int fd, char *incoming_string) char *source_host=NULL; char *state_mgr=NULL; + char cmd1[256]; + char cmd2[256]; + memset(source,'\0',256); memset(command,'\0',256); memset(target,'\0',256); memset(message,'\0',8192); memset(send_string,'\0',8192); - sscanf(incoming_string, ":%255s %255s %255s :%4095[^\n]", source, command, target, message); + memset(cmd1,'\0',256); + memset(cmd2,'\0',256); + + sscanf(incoming_string, ":%255s %255s %255s :%4095[^\r\n]", source, command, target, message); if (source != NULL) { if (strstr(source,"!") != NULL) { source_nick = strtok_r(source,"!",&state_mgr); @@ -255,15 +261,23 @@ 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); + if((strcmpi(command,"privmsg")==0)&&(sscanf(message,"@kami %255[^\r\n]",cmd1)>0)&&(target[0]=='#')) { + if(get_access(source_nick)