Mercurial > DynamicMail
changeset 2:730c0ad1bc29
Updated to a slightly later revision with some changes by CrazyBonz.
author | Brian Smith <brian@dbsoft.org> |
---|---|
date | Fri, 18 Feb 2011 02:26:53 -0600 |
parents | e62c9115d17e |
children | be012e47e7f0 |
files | dmail.c dmail.h dmail.rc dmailextr.h os2/chkmail.bmp os2/dmail-chrome.bmp os2/dmail005.ico os2/sndmail1.bmp site.h |
diffstat | 9 files changed, 299 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/dmail.c Fri Jan 21 19:48:07 2011 -0600 +++ b/dmail.c Fri Feb 18 02:26:53 2011 -0600 @@ -1,9 +1,11 @@ -/* $Id: dmail.c,v 1.19 2005/04/17 10:55:55 nuke Exp $ */ +/* $Id: dmail.c,v 1.20 2005/06/08 15:53:52 crazybonz Exp $ */ #include "compat.h" #include "dw.h" #include "backend.h" #include "dmail.h" +#include "site.h" +#include "dmailextr.h" #include "sendrecv.h" #include "parse.h" @@ -17,6 +19,7 @@ HMTX mutex; char empty_string[] = ""; +HWND in_about = 0, hwndNBK; HWND stext1, stext2, stext3; ULONG fileicon, foldericon, linkicon; @@ -25,6 +28,7 @@ char *contexttext = NULL; int message_dialog(MailParsed *mp, int readonly, int reply, char *text); int modal_account_dialog(AccountSettings *as); +int currentpage=-1, pagescreated = 0, newpage = -1, firstpage = TRUE; void DWSIGNAL account_dialog(HWND handle, void *data); typedef struct _ip { @@ -335,6 +339,23 @@ dw_window_set_data(stext1, "count", (void *)count); } +int DWSIGNAL generic_cancel(HWND window, void *data) +{ + UserEntry *param = (UserEntry *)data; + + if(param) + { + dw_window_destroy(param->window); + if(param->busy) + *param->busy = 0; + if(param->data) + free(param->data); + free(param); + } + return FALSE; +} + + /* Open a mail viewer window when double clicking on a mail item */ int DWSIGNAL deleteitem(HWND hwnd, void *data) { @@ -851,7 +872,88 @@ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, (void *)show_raw, - NULL, NULL }; + NULL, (void *)abouttab }; + + +/* Create the about box */ +void about(void) +{ + HWND infowindow, mainbox, logo, okbutton, buttonbox, stext, mle; + UserEntry *param = malloc(sizeof(UserEntry)); + ULONG flStyle = DW_FCF_TITLEBAR | DW_FCF_SHELLPOSITION | DW_FCF_DLGBORDER; + ULONG point = -1; + char *greets = "Thanks to the OS/2 Netlabs, OS2.org, " \ + "\r\nAnd of course Brian for starting it. ;)"; + + if(in_about) + { + dw_window_show(in_about); + return; + } + + in_about = infowindow = dw_window_new(HWND_DESKTOP, locale_string("About DMail", 54), flStyle); + + mainbox = dw_box_new(BOXVERT, 5); + + dw_box_pack_start(infowindow, mainbox, 0, 0, TRUE, TRUE, 0); + + buttonbox = dw_box_new(BOXHORZ, 0); + + dw_box_pack_start(mainbox, buttonbox, 0, 0, TRUE, FALSE, 0); + + logo = dw_bitmap_new(100); + + dw_window_set_bitmap(logo, LOGO, NULL); + + dw_box_pack_start(buttonbox, 0, 50, 30, TRUE, FALSE, 0); + dw_box_pack_start(buttonbox, logo, 324, 172, FALSE, FALSE, 2); + dw_box_pack_start(buttonbox, 0, 50, 30, TRUE, FALSE, 0); + + stext = dw_text_new("DynamicMail (c) 2000-2005 Brian Smith", 0); + dw_window_set_style(stext, DW_DT_CENTER | DW_DT_VCENTER, DW_DT_CENTER | DW_DT_VCENTER); + dw_box_pack_start(mainbox, stext, 10, 20, TRUE, TRUE, 0); + + mle = dw_mle_new(100L); + + dw_box_pack_start(mainbox, mle, 130, 150, TRUE, TRUE, 2); + + dw_mle_set_editable(mle, FALSE); +#if __WIN32__ + dw_window_set_color(mle, DW_CLR_BLACK, DW_CLR_WHITE); +#endif + dw_mle_set_word_wrap(mle, TRUE); + + /* Buttons */ + buttonbox = dw_box_new(BOXHORZ, 0); + + dw_box_pack_start(mainbox, buttonbox, 0, 0, TRUE, TRUE, 0); + + okbutton = dw_button_new("Ok", 1001L); + + dw_box_pack_start(buttonbox, 0, 50, 30, TRUE, FALSE, 0); + dw_box_pack_start(buttonbox, okbutton, 50, 40, FALSE, FALSE, 2); + dw_box_pack_start(buttonbox, 0, 50, 30, TRUE, FALSE, 0); + + param->window = infowindow; + param->data = NULL; + param->busy = &in_about; + + point = dw_mle_import(mle, greets, point); + + dw_signal_connect(okbutton, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(generic_cancel), (void *)param); + + dw_window_set_size(infowindow, 460, 441); + + dw_window_show(infowindow); +} + +/* IDM_ABOUT */ +int DWSIGNAL abouttab(HWND hwnd, void *data) +{ +/* if(validatecurrentpage()) */ + about(); + return FALSE; +} /* Generic multi-use function for creating mail reading and composing windows */ int message_dialog(MailParsed *mp, int readonly, int reply, char *text) @@ -1249,7 +1351,7 @@ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL }; + NULL, (void *)abouttab }; /* Create the main window with a notebook and a menu. */ void dmail_init(void) @@ -1413,7 +1515,6 @@ menuitem = dw_menu_append_item(menubar, locale_string("~Help", 2), IDM_HELP, 0L, TRUE, FALSE, menu); } - /* Save settings */ void saveconfig(void) { @@ -1487,7 +1588,7 @@ /* The main entry point. Notice we don't use WinMain() on Windows */ int main(int argc, char *argv[]) { - int cx, cy, z = 0; + int cx, cy, rc, z = 0; dw_init(TRUE, argc, argv); @@ -1513,10 +1614,10 @@ * broken by default. */ if(!config.plugins[0]) - config.plugins[0] = strdup("minimal"); + config.plugins[0] = strdup("mysqlplg"); while(config.plugins[z] && z < PLUGIN_MAX) - { + { if(load_backend(config.plugins[z])) dw_messagebox("DynamicMail", DW_MB_OK | DW_MB_ERROR, "Could not load backend \"%s\"!", config.plugins[z]); z++;
--- a/dmail.h Fri Jan 21 19:48:07 2011 -0600 +++ b/dmail.h Fri Feb 18 02:26:53 2011 -0600 @@ -1,4 +1,4 @@ -/* $Id: dmail.h,v 1.3 2003/12/11 21:07:55 nuke Exp $ */ +/* $Id: dmail.h,v 1.4 2005/06/08 15:53:52 crazybonz Exp $ */ #ifndef _DMAIL_H #define _DMAIL_H @@ -58,6 +58,8 @@ #define FOLDERICON 357 #define LINKICON 365 +#define DLG_ABOUT 1202 + #define TB_SEPARATOR -1 #define LOGO 1300
--- a/dmail.rc Fri Jan 21 19:48:07 2011 -0600 +++ b/dmail.rc Fri Feb 18 02:26:53 2011 -0600 @@ -1,4 +1,4 @@ -/* $Id: dmail.rc,v 1.1 2002/12/21 09:12:24 nuke Exp $ */ +/* $Id: dmail.rc,v 1.2 2005/06/08 15:53:52 crazybonz Exp $ */ /* OS/2 Warp Resource Script File - Created by Universal Resource Editor */ @@ -14,8 +14,8 @@ #include "dmail.h" -BITMAP NEWTAB "os2\\newtab.bmp" -BITMAP REMOVETAB "os2\\remtab.bmp" +BITMAP NEWTAB "os2\\chkmail.bmp" +BITMAP REMOVETAB "os2\\sndmail1.bmp" BITMAP CONNECT "os2\\connect.bmp" BITMAP DISCONNECT "os2\\disconnect.bmp" BITMAP IDM_EXIT "os2\\exit.bmp" @@ -30,9 +30,9 @@ BITMAP IDM_GENERALHELP "os2\\help.bmp" BITMAP IDM_ABOUT "os2\\about.bmp" -BITMAP LOGO "os2\\handyftp.bmp" +BITMAP LOGO "os2\\dmail-chrome.bmp" -ICON MAIN_FRAME "os2\\handyftp.ico" +ICON MAIN_FRAME "os2\\dmail005.ico" ICON FILEICON "os2\\FILE.ICO" ICON FOLDERICON "os2\\FOLDER.ICO" ICON LINKICON "os2\\LINK.ICO"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dmailextr.h Fri Feb 18 02:26:53 2011 -0600 @@ -0,0 +1,5 @@ +/* $Id: dmailextr.h,v 1.1 2005/06/21 18:19:38 crazybonz Exp $ */ + +int DWSIGNAL abouttab(HWND hwnd, void *data); + +int validatecurrentpage(void);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/site.h Fri Feb 18 02:26:53 2011 -0600 @@ -0,0 +1,178 @@ +/* $Id: site.h,v 1.1 2005/06/21 18:19:38 crazybonz Exp $ */ + +typedef struct _directory { + char *entry; + struct _directory *next; + ULONG size; + CTIME time; + CDATE date; + int type; +} Directory; + +typedef struct _queue { + char *srcdirectory; + char *srcfilename; + /*SiteTab *dest;*/ + char *site; + char *destdirectory; + ULONG size; + CTIME time; + CDATE date; + int type; + struct _queue *next; +} Queue; + +typedef struct _dircache { + char *url; + char *site; + char *user; + Directory *dir; + struct _dircache *next; +} DirCache; + + +typedef struct _sitetab { + HWND hwnd, ldir, rqueue, host_title, destsite, cstatus, server, percent, + host_name, user_name, pass_word, directory, port_num, cmorestatus; + /* We'll let each site know what page they are */ + int page, refcount; + int controlfd, datafd, pipefd[2], tpipefd[2]; + unsigned long pageid, sent, ip, serverip; + unsigned long fxpserver, fxpport; + int fxpready; + /* Used for recursive queuing */ + char *queuing; + char *url; + int connected, status, cachecount, sort; + DirCache *cache; + Directory *dir; + Queue *queue, *currentqueue; + time_t commandstart; + char thrdcommand[500]; + /* Replaces the Window fields */ + char *hosttitle, *hostname, *username, *password, *initialdir; + int port; +} SiteTab; + +typedef struct _savedsites { + char *hosttitle; + char *hostname; + int port; + char *url; + char *username; + char *password; + struct _savedsites *next; +} SavedSites; + +typedef struct _siteids { + char *id; + struct _siteids *next; +} SiteIds; + +typedef struct _sitetypes { + char *type; + SiteIds *siteids; + int column; + /* Columnized FALSE */ + int filestart; + int fileend; + int sizestart; + int sizeend; + int datestart; + int timestart; + int dir; + /* Columnized TRUE */ + int filecol; + int sizecol; + int daycol; + int monthcol; + int yearcol; + int timecol; + int linkcol; + int modecol; + int modeoffset; + /* Both */ + char dirchar; + char linkchar; + char *translation[40]; + int extended; + struct _sitetypes *next; +} SiteTypes; + +typedef struct _userentry { + HWND window, entryfield; + int page; + char *filename; + void *data; + HWND *busy; +} UserEntry; + +typedef struct _adminentry { + char *user; + char *addr; + char *act; + char *sock; + int idle; + struct _adminentry *next; +} AdminEntry; + +#define DIRFILE 0 +#define DIRDIR 1 +#define DIRLINK 2 + +#define THRDEXIT 0 +#define THRDCONNECT 1 +#define THRDDISCONNECT 2 +#define THRDFLUSH 3 +#define THRDREFRESH 4 +#define THRDRECEIVE 5 +#define THRDABORT 6 +#define THRDDONE 7 +#define THRDFXPSTART 8 +#define THRDFXP 9 +#define THRDDEL 10 +#define THRDREN 11 +#define THRDMKDIR 12 +#define THRDVIEW 13 +#define THRDHARDREFRESH 14 +#define THRDRAW 15 +#define THRDFXPRECEIVE 16 + +#define MAINUPDATELISTS 0 +#define MAINPRECENT 1 +#define MAINDONE 2 +#define MAINCONSOLE 3 + +#define SORT_NONE 0 +#define SORT_FILE 1 +#define SORT_DATE 2 +#define SORT_SIZE 3 + +#define STATUSIDLE 0 +#define STATUSFLUSHING 1 +#define STATUSCONNECTING 2 +#define STATUSSENDING 3 +#define STATUSRECEIVING 4 +#define STATUSIDENT 5 +#define STATUSLOGIN 6 +#define STATUSPASSWORD 7 +#define STATUSCWD 8 +#define STATUSLS 9 +#define STATUSLSPORT 10 +#define STATUSDIR 11 +#define STATUSDIRACCEPT 12 +#define STATUSDATA 13 +#define STATUSDATAACCEPT 14 +#define STATUSRETR 15 +#define STATUSSTORE 16 +#define STATUSSTOREWAIT 17 +#define STATUSTRANSMIT 18 +#define STATUSFXPRETR 19 +#define STATUSFXPSTOR 20 +#define STATUSFXPTRANSFER 21 +#define STATUSFXPWAIT 22 +#define STATUSNEXT 23 +#define STATUSRETRY 24 +#define STATUSWAITIDLE 25 +#define STATUSPASVRETR 26 +#define STATUSPASVLS 27