Przeglądaj źródła

Started work on commands for the IRC Bot.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@5827 54d463be-8e91-2dee-dedb-b68131a5f0ec
zido 19 lat temu
rodzic
commit
3fe10a51be
3 zmienionych plików z 26 dodań i 0 usunięć
  1. 4 0
      Changelog-Trunk.txt
  2. 16 0
      src/map/irc.c
  3. 6 0
      src/map/irc.h

+ 4 - 0
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/03/31
+	* Started work on commands for the IRC Bot, At the moment you can use !eakami <message>
+	  to broadcast a message, edit ALLOWED_NICK in irc.c to change the nickname
+	  of the person that is allowed to use it (Shitty authentication method, I know,
+	  but i'll make user/pass method soon enough.) [Zido]
 	* Modified a bit the skill packets of Sharp-Shooting and Brandish Spear in
 	  hopes of fixing it. [Skotlex]
 	* Should fix a bug in GM stealth mode (@hide). [Lance]

+ 16 - 0
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;
 }
 

+ 6 - 0
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;