summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZido <Zido@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-04-08 07:51:27 +0000
committerZido <Zido@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-04-08 07:51:27 +0000
commit2cc906601b811c4059f3fe9922f4ab3cee732dcb (patch)
treea9501db4282b1007ab314e81886d285f6d3252fc
parentb2ad735efc1798101018d4e0973d7bea681a1310 (diff)
downloadhercules-2cc906601b811c4059f3fe9922f4ab3cee732dcb.tar.gz
hercules-2cc906601b811c4059f3fe9922f4ab3cee732dcb.tar.bz2
hercules-2cc906601b811c4059f3fe9922f4ab3cee732dcb.tar.xz
hercules-2cc906601b811c4059f3fe9922f4ab3cee732dcb.zip
- Fixed irc.c, no more crashes
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@5954 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r--Changelog-Trunk.txt3
-rw-r--r--src/map/irc.c56
2 files changed, 36 insertions, 23 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index 7c391faa5..21daf919d 100644
--- a/Changelog-Trunk.txt
+++ b/Changelog-Trunk.txt
@@ -3,6 +3,9 @@ Date Added
AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
+2006/04/08
+ * Fixed up irc.c, no more crashes :D [Zido]
+
2006/04/07
* Likely fixed a mob not returning to their original class view on respawn
after they changed class in their previous life. [Skotlex]
diff --git a/src/map/irc.c b/src/map/irc.c
index 0731004c4..79c5bd640 100644
--- a/src/map/irc.c
+++ b/src/map/irc.c
@@ -256,30 +256,38 @@ void irc_parse_sub(int fd, char *incoming_string)
sprintf(send_string, "PONG %s", command);
irc_send(send_string);
}
- }
- // 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);
+ 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);
+ }
+ irc_send(send_string);
+ }
+
+ // Refresh Names [Zido]
+ else if((strcmpi(command,"join")==0)||(strcmpi(command,"part")==0)||(strcmpi(command,"mode")==0)||(strcmpi(command,"nick")==0)) {
+ ShowInfo("IRC: Refreshing User List");
+ irc_rmnames();
+ printf("...");
+ sprintf(send_string,"NAMES %s",irc_channel);
+ printf("...");
+ irc_send(send_string);
+ printf("Done\n");
+ }
}
- irc_send(send_string);
- }
-
- // Names Reply [Zido]
- if((strcmpi(command,"353")==0)) {
- parse_names_packet(incoming_string);
- }
- // Refresh Names [Zido]
- if((strcmpi(command,"join")==0)||(strcmpi(command,"part")==0)||(strcmpi(command,"mode")==0)) {
- irc_rmnames();
- sprintf(send_string,"NAMES %s",irc_channel);
- irc_send(send_string);
+ // Names Reply [Zido]
+ else if((strcmpi(command,"353")==0)) {
+ ShowInfo("IRC: NAMES recieved\n");
+ parse_names_packet(incoming_string);
+ }
}
return;
@@ -439,14 +447,16 @@ int get_access(char *nick) {
return -1;
}
-int irc_rmnames(void) {
+int irc_rmnames() {
int i=0;
for(i=0;i<=MAX_CHANNEL_USERS;i++) {
- memset(cd.user[i].name,'\0',256);
+ //memset(cd.user[i].name,'\0',256);
cd.user[i].level=0;
}
+
last_cd_user=0;
+
return 0;
}