diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2004-04-19 01:02:57 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2004-04-19 01:02:57 +0000 |
commit | 7a51b2bed1cdc0e6c2522f2b2d10f3f787ff677d (patch) | |
tree | be64a38b2f6837ef132619868864081010043f36 /src/message.cpp | |
parent | b53d255cf447acd55709f90bdd51949beaf0f94c (diff) |
Moving yet more stuff into message.cpp
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@665 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/message.cpp')
-rw-r--r-- | src/message.cpp | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/src/message.cpp b/src/message.cpp index 2aba4908e..1c2bd4cf4 100644 --- a/src/message.cpp +++ b/src/message.cpp @@ -406,4 +406,78 @@ int has_channel(userrec *u, chanrec *c) } +void TidyBan(char *ban) +{ + if (!ban) { + log(DEFAULT,"*** BUG *** TidyBan was given an invalid parameter"); + return; + } + + char temp[MAXBUF],NICK[MAXBUF],IDENT[MAXBUF],HOST[MAXBUF]; + + strcpy(temp,ban); + + char* pos_of_pling = strchr(temp,'!'); + char* pos_of_at = strchr(temp,'@'); + + pos_of_pling[0] = '\0'; + pos_of_at[0] = '\0'; + pos_of_pling++; + pos_of_at++; + + strncpy(NICK,temp,NICKMAX); + strncpy(IDENT,pos_of_pling,IDENTMAX+1); + strncpy(HOST,pos_of_at,160); + + sprintf(ban,"%s!%s@%s",NICK,IDENT,HOST); +} + +char lst[MAXBUF]; + +char* chlist(userrec *user) +{ + int i = 0; + char cmp[MAXBUF]; + + log(DEBUG,"chlist: %s",user->nick); + strcpy(lst,""); + if (!user) + { + return lst; + } + for (int i = 0; i != MAXCHANS; i++) + { + if (user->chans[i].channel != NULL) + { + if (user->chans[i].channel->name) + { + strcpy(cmp,user->chans[i].channel->name); + strcat(cmp," "); + if (!strstr(lst,cmp)) + { + if ((!user->chans[i].channel->c_private) && (!user->chans[i].channel->secret)) + { + strcat(lst,cmode(user,user->chans[i].channel)); + strcat(lst,user->chans[i].channel->name); + strcat(lst," "); + } + } + } + } + } + if (strlen(lst)) + { + lst[strlen(lst)-1] = '\0'; // chop trailing space + } + return lst; +} + + +void send_network_quit(const char* nick, const char* reason) +{ + char buffer[MAXBUF]; + snprintf(buffer,MAXBUF,"Q %s :%s",nick,reason); + NetSendToAll(buffer); +} + |