-void ShowMOTD(userrec *user)
-{
- if (!Config->MOTD.size())
- {
- user->WriteServ("422 %s :Message of the day file is missing.",user->nick);
- return;
- }
- user->WriteServ("375 %s :%s message of the day", user->nick, Config->ServerName);
-
- for (unsigned int i = 0; i < Config->MOTD.size(); i++)
- user->WriteServ("372 %s :- %s",user->nick,Config->MOTD[i].c_str());
-
- user->WriteServ("376 %s :End of message of the day.", user->nick);
-}
-
-void ShowRULES(userrec *user)
-{
- if (!Config->RULES.size())
- {
- user->WriteServ("NOTICE %s :Rules file is missing.",user->nick);
- return;
- }
- user->WriteServ("NOTICE %s :%s rules",user->nick,Config->ServerName);
-
- for (unsigned int i = 0; i < Config->RULES.size(); i++)
- user->WriteServ("NOTICE %s :%s",user->nick,Config->RULES[i].c_str());
-
- user->WriteServ("NOTICE %s :End of %s rules.",user->nick,Config->ServerName);
-}
-
-// this returns 1 when all modules are satisfied that the user should be allowed onto the irc server
-// (until this returns true, a user will block in the waiting state, waiting to connect up to the
-// registration timeout maximum seconds)
-bool AllModulesReportReady(userrec* user)
-{
- if (!Config->global_implementation[I_OnCheckReady])
- return true;
-
- for (int i = 0; i <= MODCOUNT; i++)
- {
- if (Config->implement_lists[i][I_OnCheckReady])
- {
- int res = modules[i]->OnCheckReady(user);
- if (!res)
- return false;
- }
- }
-
- return true;
-}
-
-/* Make Sure Modules Are Avaliable!
- * (BugFix By Craig.. See? I do work! :p)
- * Modified by brain, requires const char*
- * to work with other API functions
- */
-
-/* XXX - Needed? */
-bool FileExists (const char* file)
-{
- FILE *input;
- if ((input = fopen (file, "r")) == NULL)
- {
- return(false);
- }
- else
- {
- fclose (input);
- return(true);
- }
-}
-
-char* CleanFilename(char* name)
-{
- char* p = name + strlen(name);
- while ((p != name) && (*p != '/')) p--;
- return (p != name ? ++p : p);
-}
-
-bool DirValid(char* dirandfile)
-{
- char work[MAXBUF];
- char buffer[MAXBUF];
- char otherdir[MAXBUF];
- int p;
-
- strlcpy(work, dirandfile, MAXBUF);
- p = strlen(work);
-
- // we just want the dir
- while (*work)
- {
- if (work[p] == '/')
- {
- work[p] = '\0';
- break;
- }
-
- work[p--] = '\0';
- }
-
- // Get the current working directory
- if (getcwd(buffer, MAXBUF ) == NULL )
- return false;
-
- chdir(work);
-
- if (getcwd(otherdir, MAXBUF ) == NULL )
- return false;
-
- chdir(buffer);
-
- size_t t = strlen(work);
-
- if (strlen(otherdir) >= t)
- {
- otherdir[t] = '\0';
-
- if (!strcmp(otherdir,work))
- {
- return true;
- }
-
- return false;
- }
- else
- {
- return false;
- }
-}
-
-std::string GetFullProgDir(char** argv, int argc)
-{
- char work[MAXBUF];
- char buffer[MAXBUF];
- char otherdir[MAXBUF];
- int p;
-
- strlcpy(work,argv[0],MAXBUF);
- p = strlen(work);
-
- // we just want the dir
- while (*work)
- {
- if (work[p] == '/')
- {
- work[p] = '\0';
- break;
- }
-
- work[p--] = '\0';
- }
-
- // Get the current working directory
- if (getcwd(buffer, MAXBUF) == NULL)
- return "";
-
- chdir(work);
-
- if (getcwd(otherdir, MAXBUF) == NULL)
- return "";
-
- chdir(buffer);
- return otherdir;
-}
-
-int InsertMode(std::string &output, const char* mode, unsigned short section)
-{
- unsigned short currsection = 1;
- unsigned int pos = output.find("CHANMODES=", 0) + 10; // +10 for the length of "CHANMODES="
-
- if(section > 4 || section == 0)
- {
- log(DEBUG, "InsertMode: CHANMODES doesn't have a section %dh :/", section);
- return 0;
- }
-
- for(; pos < output.size(); pos++)
- {
- if(section == currsection)
- break;
-
- if(output[pos] == ',')
- currsection++;
- }
-
- output.insert(pos, mode);
- return 1;
-}
-
-bool IsValidChannelName(const char *chname)