SQWEBMAIL PATCH
Please Note: This patch is not actively maintained. It has been tested only on pre-.28 versions of sqwebmail and may not apply to your version of sqwebmail.
Q: How do I modify sqwebmail to accomodate relative path to templates which allows different virtual domains on the same host to use different HTML templates?
A: The HTML Templates in sqwebmail work great. But, you may want to have the same executable serve multiple domains with different templates for each domain.
Here's how to modify sqwebmail.c to take a relative path as of version 0.24. Changes are very similar for .26 and .27:
1. Add a global working dir variable to sqwebmail.c at about line 59
char workingdir[512];2. Added pushdir code to the start of sqwebmail.c/open_langform(...) at about line 298
char szPushedDir[512]; getcwd( szPushedDir, 512 );2a. Pick up the working directory anywhere in sqwebmail.c/main2() at about line 1003
getcwd(workingdir, 512);
3. Surround the fopen call in sqwebmail.c/open_langform(...) with chdir's to the correct template location at about line 308:chdir(workingdir); // Add this line f=fopen(formpath, "r"); chdir(szPushedDir); // Add this line
4. Added extern reference to workingdir in newmsg.c at about line 34extern char workingdir[];
5. Added pushdir code to the start of newmsg.c/dosendmsg(...) at about line 438char szPushedDir[512]; getcwd( szPushedDir, 512 );6. Surrounded call to execl sendit.sh in newmsg.c/dosendmsg(...) at about line 515
chdir(workingdir); // Add this line execl(HTMLLIBDIR "/sendit.sh", "sendit.sh", returnaddr, sqwebmail_mailboxid, NULL); chdir(szPushedDir); // Add this line