diff options
author | Zido <Zido@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-04-08 07:51:27 +0000 |
---|---|---|
committer | Zido <Zido@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-04-08 07:51:27 +0000 |
commit | 2cc906601b811c4059f3fe9922f4ab3cee732dcb (patch) | |
tree | a9501db4282b1007ab314e81886d285f6d3252fc /src | |
parent | b2ad735efc1798101018d4e0973d7bea681a1310 (diff) | |
download | hercules-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
Diffstat (limited to 'src')
-rw-r--r-- | src/map/irc.c | 56 |
1 files changed, 33 insertions, 23 deletions
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;
}
|