diff options
author | Zido <Zido@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-04-17 23:03:58 +0000 |
---|---|---|
committer | Zido <Zido@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-04-17 23:03:58 +0000 |
commit | f14c4c6e1c603640792e09164cb0ed7be9dae32f (patch) | |
tree | f838476c1c13f0bd31b12af7cff59ba1a6242ac2 /src | |
parent | efec0b2a3ba13e5c0e53910fc7728eee551a9409 (diff) | |
download | hercules-f14c4c6e1c603640792e09164cb0ed7be9dae32f.tar.gz hercules-f14c4c6e1c603640792e09164cb0ed7be9dae32f.tar.bz2 hercules-f14c4c6e1c603640792e09164cb0ed7be9dae32f.tar.xz hercules-f14c4c6e1c603640792e09164cb0ed7be9dae32f.zip |
- Added @users command to the IRC Bot. Checks no. online users.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6143 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r-- | src/map/irc.c | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/src/map/irc.c b/src/map/irc.c index 72b9dc8a4..4712acf3f 100644 --- a/src/map/irc.c +++ b/src/map/irc.c @@ -210,6 +210,10 @@ void irc_parse_sub(int fd, char *incoming_string) char cmd1[256];
char cmd2[256];
+ char cmdname[256];
+ char cmdargs[256];
+
+ int users=0;
memset(source,'\0',256);
memset(command,'\0',256);
@@ -219,6 +223,8 @@ void irc_parse_sub(int fd, char *incoming_string) memset(cmd1,'\0',256);
memset(cmd2,'\0',256);
+ memset(cmdname,'\0',256);
+ memset(cmdargs,'\0',256);
sscanf(incoming_string, ":%255s %255s %255s :%4095[^\r\n]", source, command, target, message);
if (source != NULL) {
@@ -263,15 +269,22 @@ void irc_parse_sub(int fd, char *incoming_string) else if((strcmpi(target,irc_channel)==0)||(strcmpi(target,irc_channel+1)==0)) {
// Broadcast [Zido] (Work in Progress)
- if((strcmpi(command,"privmsg")==0)&&(sscanf(message,"@kami %255[^\r\n]",cmd1)>0)&&(target[0]=='#')) {
- if(get_access(source_nick)<ACCESS_OP)
- sprintf(send_string,"NOTICE %s :Access Denied",source_nick);
- else {
- sprintf(send_string,"%s: %s",source_nick,cmd1);
- intif_GMmessage(send_string,strlen(send_string)+1,0);
- sprintf(send_string,"NOTICE %s :Message Sent",source_nick);
+ if((strcmpi(command,"privmsg")==0)&&(sscanf(message,"@%s[^ ] %255[^\r\n]",cmdname,cmdargs)>0)&&(target[0]=='#')) {
+ if(strcmpi(cmdname,"kami")==0) {
+ if(get_access(source_nick)<ACCESS_OP)
+ sprintf(send_string,"NOTICE %s :Access Denied",source_nick);
+ else {
+ sscanf(cmdargs,"%255[^\r\n]",cmd1);
+ sprintf(send_string,"%s: %s",source_nick,cmd1);
+ intif_GMmessage(send_string,strlen(send_string)+1,0);
+ sprintf(send_string,"NOTICE %s :Message Sent",source_nick);
+ }
+ irc_send(send_string);
+ } else if(strcmpi(cmdname,"users")==0) {
+ map_getallusers(&users);
+ sprintf(send_string,"PRIVMSG %s :Users Online: %d",irc_channel,users);
+ irc_send(send_string);
}
- irc_send(send_string);
}
// Refresh Names [Zido]
|