#include "stdafx.h" #include "globals.h" #include "fstream.h" #include "direct.h" #include #include #include "comp.h" #include "ib.h" extern CString rootPath;// = GetGlobal("Root"); extern CString configName;// = GetGlobal("CustomizationList"); extern CString configPath;// = rootPath + "Configs\\" + configName; extern CString cdPath ;// = configPath + "\\CD"; extern CString workspacePath;// = configPath + "\\Workspace"; extern CString cdshellPath; //CString CDout="CD_output"; // This function creates the file "mailaccount.rdf" to customize the Mail account void CreateIspMenu(void) { CString root = GetGlobal("Root"); CString config = GetGlobal("CustomizationList"); CString IspPath = root + "\\Configs\\" + config + "\\Temp\\";//ISpPath=CCKTool\Configs\configname\Temp _mkdir (IspPath); CString ispDomainName = GetGlobal("DomainName"); CString ispPrettyName = GetGlobal("PrettyName"); CString ispLongName = GetGlobal("LongName"); CString ispInServer = GetGlobal("IncomingServer"); CString ispOutServer = GetGlobal("OutgoingServer"); CString ispPortNumber = GetGlobal("PortNumber"); CString serverType; // Determine whether the server type is POP or IMAP CString pop = GetGlobal("pop"); if (pop == "1") serverType = "pop3"; else serverType = "imap"; CString popMessage = GetGlobal("PopMessages"); // check if "leave pop messages on server" option is set if (popMessage == "0") popMessage = "false"; else if (popMessage == "1") popMessage = "true"; // mailaccount.rdf file is created only if values are entered for all the fields in the CCK mail UI if (!( (ispDomainName.IsEmpty()) || (ispPrettyName.IsEmpty()) || (ispLongName.IsEmpty()) || (ispInServer.IsEmpty()) || (ispOutServer.IsEmpty()) || (ispPortNumber.IsEmpty()) )) { CString IspFile = IspPath +"mailaccount.rdf"; ofstream Isp(IspFile); char *shortname; char tempdomain[25]; strcpy(tempdomain,ispDomainName); shortname = strtok(tempdomain,"."); if (!Isp) { cout << "The file cannot be opened \n"; } else { Isp <<"<\?xml version=\"1.0\"\?>\n"; Isp <<"\n\n"; Isp <<"\n"; Isp <<" \n"; Isp <<" \n\n"; Isp <<" \n"; Isp <<" \n"; Isp <<" \n"; Isp <<" " << ispPrettyName << "\n"; Isp <<" " << ispInServer << "\n"; Isp <<" " << serverType << "\n"; Isp <<" " << ispPortNumber << "\n"; Isp <<" false\n"; if (serverType == "pop3") { Isp <<" \n"; Isp <<" \n"; Isp <<" " << popMessage << "\n"; Isp <<" false\n"; Isp <<" \n"; Isp <<" \n"; } Isp <<" \n"; Isp <<" \n\n"; Isp <<" \n"; Isp <<" \n"; Isp <<" \n"; Isp <<" false\n"; Isp <<" false\n"; Isp <<" \n"; Isp <<" \n\n"; Isp <<" \n"; Isp <<" \n"; Isp <<" " << ispOutServer << "\n"; Isp <<" \n"; Isp <<" \n\n"; Isp <<" true\n"; Isp <<" ture\n"; Isp <<" true\n\n"; Isp <<" true\n"; Isp <<" " << shortname << "\n"; Isp <<" " << ispLongName << "\n"; Isp <<" true\n"; Isp <<" true\n"; Isp <<" " << ispDomainName << "\n"; Isp <<" username@" << ispDomainName << "\n"; Isp <<" username\n"; Isp <<" user name\n"; Isp <<" User name:\n"; Isp <<" false\n"; Isp <<" \n"; Isp <<" \n"; Isp <<"\n\n"; Isp <<"\n"; } Isp.close(); } } // This function creates the file "newsaccount.rdf" to customize the News account void CreateNewsMenu(void) { CString root = GetGlobal("Root"); CString config = GetGlobal("CustomizationList"); CString NewsPath = root + "\\Configs\\" + config + "\\Temp\\";//NewsPath=CCKTool\Configs\configname\Temp _mkdir (NewsPath); CString newsDomainName = GetGlobal("nDomainName"); CString newsPrettyName = GetGlobal("nPrettyName"); CString newsLongName = GetGlobal("nLongName"); CString newsServer = GetGlobal("nServer"); CString newsPortNumber = GetGlobal("nPortNumber"); // newsaccount.rdf file is created only if values are entered for all the fields in the CCK News UI if (!( (newsDomainName.IsEmpty()) || (newsPrettyName.IsEmpty()) || (newsLongName.IsEmpty()) || (newsServer.IsEmpty()) || (newsPortNumber.IsEmpty()) )) { CString NewsFile = NewsPath +"newsaccount.rdf"; ofstream News(NewsFile); char *shortname; char tempdomain[25]; strcpy(tempdomain,newsDomainName); shortname = strtok(tempdomain,"."); if (!News) { cout << "The file cannot be opened \n"; } else { News <<"<\?xml version=\"1.0\"\?>\n"; News <<"\n\n"; News <<"\n"; News <<" \n"; News <<" \n\n"; News <<" \n"; News <<" \n"; News <<" \n"; News <<" " << newsPrettyName << "\n"; News <<" " << newsServer << "\n"; News <<" nntp\n"; News <<" " << newsPortNumber << "\n"; News <<" false\n"; News <<" \n"; News <<" \n\n"; News <<" \n"; News <<" \n"; News <<" \n"; News <<" false\n"; News <<" false\n"; News <<" \n"; News <<" \n\n"; News <<" true\n"; News <<" " << shortname << "\n"; News <<" " << newsLongName << "\n"; News <<" true\n"; News <<" true\n"; News <<" " << newsDomainName << "\n"; News <<" username@" << newsDomainName << "\n"; News <<" username\n"; News <<" user name\n"; News <<" User name:\n"; News <<" false\n"; News <<" \n"; News <<" \n"; News <<"\n\n"; News <<"\n"; } News.close(); } }