diff options
author | Zido <Zido@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-04-18 21:13:13 +0000 |
---|---|---|
committer | Zido <Zido@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-04-18 21:13:13 +0000 |
commit | 8eb561a6c0ec23aa31e46aee768e1dacee9ebe90 (patch) | |
tree | bcc0b483b31029ea44183d70f6ee4ed256cac634 | |
parent | 259f3f754a08af807ce64565ea1606831370a112 (diff) | |
download | hercules-8eb561a6c0ec23aa31e46aee768e1dacee9ebe90.tar.gz hercules-8eb561a6c0ec23aa31e46aee768e1dacee9ebe90.tar.bz2 hercules-8eb561a6c0ec23aa31e46aee768e1dacee9ebe90.tar.xz hercules-8eb561a6c0ec23aa31e46aee768e1dacee9ebe90.zip |
- Added @who to IRC Bot, Refer to changelog.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6169 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r-- | Changelog-Trunk.txt | 1 | ||||
-rw-r--r-- | src/map/irc.c | 19 |
2 files changed, 19 insertions, 1 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index e443c3e3c..9c1d5e365 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -4,6 +4,7 @@ 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/18
+ * Added @who to the IRC Bot, outputs all online characters. [Zido]
* Changed the memory manager fatal errors when allocating memory to print
out the size request as well as the file and line where they originated.
[Skotlex]
diff --git a/src/map/irc.c b/src/map/irc.c index 6fef716fb..fa464a33a 100644 --- a/src/map/irc.c +++ b/src/map/irc.c @@ -214,6 +214,9 @@ void irc_parse_sub(int fd, char *incoming_string) char cmdargs[256];
int users=0;
+ int i=0;
+
+ struct map_session_data **allsd;
memset(source,'\0',256);
memset(command,'\0',256);
@@ -274,15 +277,29 @@ void irc_parse_sub(int fd, char *incoming_string) if(get_access(source_nick)<ACCESS_OP)
sprintf(send_string,"NOTICE %s :Access Denied",source_nick);
else {
- sprintf(send_string,"%s: %s",source_nick,cmdargs);
intif_GMmessage(send_string,strlen(send_string)+1,0);
sprintf(send_string,"NOTICE %s :Message Sent",source_nick);
}
irc_send(send_string);
+ // Number of users online [Zido]
} else if(strcmpi(cmdname,"users")==0) {
map_getallusers(&users);
sprintf(send_string,"PRIVMSG %s :Users Online: %d",irc_channel,users);
irc_send(send_string);
+ // List all users online [Zido]
+ } else if(strcmpi(cmdname,"who")==0) {
+ allsd=map_getallusers(&users);
+ if(users>0) {
+ sprintf(send_string,"NOTICE %s :%d Users Online",source_nick,users);
+ irc_send(send_string);
+ for(i=0;i<users;i++) {
+ sprintf(send_string,"NOTICE %s :Name: \"%s\"",source_nick,allsd[i]->status.name);
+ irc_send(send_string);
+ }
+ } else {
+ sprintf(send_string,"NOTICE %s :No Users Online",source_nick);
+ irc_send(send_string);
+ }
}
}
|