/* Mail Client - DMS - nov 1998 by Patrice FAVRE */ typeof Isnd=I;; typeof Snd=S;; typeof Ircp=I;; typeof Rcp=S;; typeof Icc=I;; typeof Cc=S;; typeof Ibcc=I;; typeof Bcc=S;; typeof Isub=I;; typeof Sub=S;; typeof Itxt=I;; typeof Txt=S;; typeof win=ObjWin;; typeof BSend=ObjButton;; typeof BAnnul=ObjButton;; typeof Tsnd=ObjText;; typeof Trcp=ObjText;; typeof Tcc=ObjText;; typeof Tbcc=ObjText;; typeof Tsub=ObjText;; typeof Ttxt=ObjText;; typeof Fsnd=ObjText;; typeof Frcp=ObjText;; typeof Fcc=ObjText;; typeof Fbcc=ObjText;; typeof Fsub=ObjText;; typeof Ftxt=ObjText;; typeof focus=ObjText;; defcom CSendMail=SendMail S S S S S S;; /*-----------------------*/ fun _destroyW(a,b,c)= _DSwindow win; set win=nil; _DMSevent this EVT_HIDDEN nil nil;; /*-----------------------*/ fun _resizeW(wn, Z, w, h)= let 5 -> ycour in ( if Isnd!=Vno then ( if Isnd==Vvl then ( _POSITIONtext Fsnd 75 ycour w-80 20; ) else if Isnd==Vva0 then ( _POSITIONtext Tsnd 75 ycour (w-80)/2-2 20; _POSITIONtext Fsnd 75+(w-80)/2+2 ycour (w-80)/2-2 20; ) else if Isnd==Vva1 then ( _POSITIONtext Fsnd 75 ycour (w-80)/2-2 20; _POSITIONtext Tsnd 75+(w-80)/2+2 ycour (w-80)/2-2 20; ) else if Isnd==Vvm then ( _POSITIONtext Tsnd 75 ycour w-80 20; ) else if Isnd==Via0 || Isnd==Via1 then ( _POSITIONtext Tsnd 75 ycour w-80 20; ) else nil; set ycour=ycour+25; ) else nil; if Ircp!=Vno then ( if Ircp==Vvl then ( _POSITIONtext Frcp 75 ycour w-80 20; ) else if Ircp==Vva0 then ( _POSITIONtext Trcp 75 ycour (w-80)/2-2 20; _POSITIONtext Frcp 75+(w-80)/2+2 ycour (w-80)/2-2 20; ) else if Ircp==Vva1 then ( _POSITIONtext Frcp 75 ycour (w-80)/2-2 20; _POSITIONtext Trcp 75+(w-80)/2+2 ycour (w-80)/2-2 20; ) else if Ircp==Vvm then ( _POSITIONtext Trcp 75 ycour w-80 20; ) else if Ircp==Via0 || Ircp==Via1 then ( _POSITIONtext Trcp 75 ycour w-80 20; ) else nil; set ycour=ycour+25; ) else nil; if Icc!=Vno then ( if Icc==Vvl then ( _POSITIONtext Fcc 75 ycour w-80 20; ) else if Icc==Vva0 then ( _POSITIONtext Tcc 75 ycour (w-80)/2-2 20; _POSITIONtext Fcc 75+(w-80)/2+2 ycour (w-80)/2-2 20; ) else if Icc==Vva1 then ( _POSITIONtext Fcc 75 ycour (w-80)/2-2 20; _POSITIONtext Tcc 75+(w-80)/2+2 ycour (w-80)/2-2 20; ) else if Icc==Vvm then ( _POSITIONtext Tcc 75 ycour w-80 20; ) else if Icc==Via0 || Icc==Via1 then ( _POSITIONtext Tcc 75 ycour w-80 20; ) else nil; set ycour=ycour+25; ) else nil; if Ibcc!=Vno then ( if Ibcc==Vvl then ( _POSITIONtext Fbcc 75 ycour w-80 20; ) else if Ibcc==Vva0 then ( _POSITIONtext Tbcc 75 ycour (w-80)/2-2 20; _POSITIONtext Fbcc 75+(w-80)/2+2 ycour (w-80)/2-2 20; ) else if Ibcc==Vva1 then ( _POSITIONtext Fbcc 75 ycour (w-80)/2-2 20; _POSITIONtext Tbcc 75+(w-80)/2+2 ycour (w-80)/2-2 20; ) else if Ibcc==Vvm then ( _POSITIONtext Tbcc 75 ycour w-80 20; ) else if Ibcc==Via0 || Ibcc==Via1 then ( _POSITIONtext Tbcc 75 ycour w-80 20; ) else nil; set ycour=ycour+25; ) else nil; if Isub!=Vno then ( if Isub==Vvl then ( _POSITIONtext Fsub 75 ycour w-80 20; ) else if Isub==Vva0 then ( _POSITIONtext Tsub 75 ycour (w-80)/2-2 20; _POSITIONtext Fsub 75+(w-80)/2+2 ycour (w-80)/2-2 20; ) else if Isub==Vva1 then ( _POSITIONtext Fsub 75 ycour (w-80)/2-2 20; _POSITIONtext Tsub 75+(w-80)/2+2 ycour (w-80)/2-2 20; ) else if Isub==Vvm then ( _POSITIONtext Tsub 75 ycour w-80 20; ) else if Isub==Via0 || Isub==Via1 then ( _POSITIONtext Tsub 75 ycour w-80 20; ) else nil; set ycour=ycour+25; ) else nil; if Itxt!=Vno then ( if Itxt==Vvl then ( _POSITIONtext Ftxt 5 ycour+20 w-10 h-ycour-70; ) else if Itxt==Vva0 then ( _POSITIONtext Ttxt 5 ycour+20 w-10 (h-ycour-70)/2-5; _POSITIONtext Ftxt 5 ycour+20+(h-ycour-70)/2 w-10 (h-ycour-70)/2-5; ) else if Itxt==Vva1 then ( _POSITIONtext Ftxt 5 ycour+20 w-10 (h-ycour-70)/2-5; _POSITIONtext Ttxt 5 ycour+20+(h-ycour-70)/2 w-10 (h-ycour-70)/2-5; ) else if Itxt==Vvm then ( _POSITIONtext Ttxt 5 ycour+20 w-10 h-ycour-70; ) else if Itxt==Via0 || Itxt==Via1 then ( _POSITIONtext Ttxt 5 ycour+20 w-10 h-ycour-70; ) else nil; ) else nil; ); _POSITIONbutton BSend w/2-75 h-25 70 20; _POSITIONbutton BAnnul w/2+10 h-25 70 20; 0;; /*-----------------------*/ fun _focus(B, T, a)= _SETtextFocus T;; /*-----------------------*/ fun _affErr(win, msg, T)= _DLGrflmessage _DLGMessageBox _channel win _loc this "TIT_ERREUR" nil msg 0 @_focus T;; /*-----------------------*/ fun _sendE(a,b)= let _GETtext Tsnd -> snd in let _GETtext Trcp -> rcp in let _GETtext Tcc -> cc in let _GETtext Tbcc -> bcc in let _GETtext Tsub -> sub in let _GETtext Ttxt -> txt in if (strlen strcat Snd snd)==0 then _affErr win _loc this "E_OBL_SND" nil Tsnd else if (strlen strcat Rcp rcp)==0 then _affErr win _loc this "E_OBL_RCP" nil Trcp else if (strlen strcat Sub sub)==0 then _affErr win _loc this "E_OBL_SUB" nil Tsub else ( _DMSsend this CSendMail [snd rcp cc bcc sub txt]; nil );; /*-----------------------*/ fun _resizeZ(coord,zone)= let coord -> [wn x y w h] in ( _SIZEwindow win w h x y; _resizeW wn nil w h );; /*-----------------------*/ fun _destroyZ(z)= _destroyW nil nil nil;; /*-----------------------*/ fun AffWin()= let _DMSgetZone this Z_MAIL nil @_resizeZ @_destroyZ -> [wn x y w h] in ( if wn==nil then ( set w=400; set h=400; set win=_CRwindow _channel DMSwin nil nil w h WN_MENU|WN_MINBOX|WN_SIZEBOX _loc this "TIT_MAIL" nil ) else set win=_CRwindow _channel wn x y w h WN_CHILDINSIDE|WN_NOCAPTION|WN_NOBORDER ""; /* Champs */ let 5 -> ycour in ( if Isnd!=Vno then ( _CRtext _channel win 5 ycour 70 20 ET_ALIGN_RIGHT _loc this "F_SND" nil; if Isnd==Vvl then ( set Fsnd=_CRtext _channel win 75 ycour w-80 20 ET_AHSCROLL|ET_DOWN Snd; set Tsnd=nil; ) else if Isnd==Vva0 then ( set Tsnd=_CReditLine _channel win 75 ycour (w-80)/2-2 20 ET_AHSCROLL|ET_DOWN ""; set Fsnd=_CRtext _channel win 75+(w-80)/2+2 ycour (w-80)/2-2 20 ET_AHSCROLL|ET_DOWN Snd; ) else if Isnd==Vva1 then ( set Fsnd=_CRtext _channel win 75 ycour (w-80)/2-2 20 ET_AHSCROLL|ET_DOWN Snd; set Tsnd=_CReditLine _channel win 75+(w-80)/2+2 ycour (w-80)/2-2 20 ET_AHSCROLL|ET_DOWN ""; ) else if Isnd==Vvm then ( set Fsnd=nil; set Tsnd=_CReditLine _channel win 75 ycour w-80 20 ET_AHSCROLL|ET_DOWN Snd; ) else if Isnd==Via0 || Isnd==Via1 then ( set Fsnd=nil; set Tsnd=_CReditLine _channel win 75 ycour w-80 20 ET_AHSCROLL|ET_DOWN ""; ) else nil; set ycour=ycour+25; if focus==nil then set focus=Tsnd else nil ) else nil; if Ircp!=Vno then ( _CRtext _channel win 5 ycour 70 20 ET_ALIGN_RIGHT _loc this "F_RCP" nil; if Ircp==Vvl then ( set Frcp=_CRtext _channel win 75 ycour w-80 20 ET_AHSCROLL|ET_DOWN Rcp; set Trcp=nil; ) else if Ircp==Vva0 then ( set Trcp=_CReditLine _channel win 75 ycour (w-80)/2-2 20 ET_AHSCROLL|ET_DOWN ""; set Frcp=_CRtext _channel win 75+(w-80)/2+2 ycour (w-80)/2-2 20 ET_AHSCROLL|ET_DOWN Rcp; ) else if Ircp==Vva1 then ( set Frcp=_CRtext _channel win 75 ycour (w-80)/2-2 20 ET_AHSCROLL|ET_DOWN Rcp; set Trcp=_CReditLine _channel win 75+(w-80)/2+2 ycour (w-80)/2-2 20 ET_AHSCROLL|ET_DOWN ""; ) else if Ircp==Vvm then ( set Frcp=nil; set Trcp=_CReditLine _channel win 75 ycour w-80 20 ET_AHSCROLL|ET_DOWN Rcp; ) else if Ircp==Via0 || Ircp==Via1 then ( set Frcp=nil; set Trcp=_CReditLine _channel win 75 ycour w-80 20 ET_AHSCROLL|ET_DOWN ""; ) else nil; set ycour=ycour+25; if focus==nil then set focus=Trcp else nil ) else nil; if Icc!=Vno then ( _CRtext _channel win 5 ycour 70 20 ET_ALIGN_RIGHT _loc this "F_CC" nil; if Icc==Vvl then ( set Fcc=_CRtext _channel win 75 ycour w-80 20 ET_AHSCROLL|ET_DOWN Cc; set Tcc=nil; ) else if Icc==Vva0 then ( set Tcc=_CReditLine _channel win 75 ycour (w-80)/2-2 20 ET_AHSCROLL|ET_DOWN ""; set Fcc=_CRtext _channel win 75+(w-80)/2+2 ycour (w-80)/2-2 20 ET_AHSCROLL|ET_DOWN Cc; ) else if Icc==Vva1 then ( set Fcc=_CRtext _channel win 75 ycour (w-80)/2-2 20 ET_AHSCROLL|ET_DOWN Cc; set Tcc=_CReditLine _channel win 75+(w-80)/2+2 ycour (w-80)/2-2 20 ET_AHSCROLL|ET_DOWN ""; ) else if Icc==Vvm then ( set Fcc=nil; set Tcc=_CReditLine _channel win 75 ycour w-80 20 ET_AHSCROLL|ET_DOWN Cc; ) else if Icc==Via0 || Icc==Via1 then ( set Fcc=nil; set Tcc=_CReditLine _channel win 75 ycour w-80 20 ET_AHSCROLL|ET_DOWN ""; ) else nil; set ycour=ycour+25; if focus==nil then set focus=Tcc else nil ) else nil; if Ibcc!=Vno then ( _CRtext _channel win 5 ycour 70 20 ET_ALIGN_RIGHT _loc this "F_BCC" nil; if Ibcc==Vvl then ( set Fbcc=_CRtext _channel win 75 ycour w-80 20 ET_AHSCROLL|ET_DOWN Bcc; set Tbcc=nil; ) else if Ibcc==Vva0 then ( set Tbcc=_CReditLine _channel win 75 ycour (w-80)/2-2 20 ET_AHSCROLL|ET_DOWN ""; set Fbcc=_CRtext _channel win 75+(w-80)/2+2 ycour (w-80)/2-2 20 ET_AHSCROLL|ET_DOWN Bcc; ) else if Ibcc==Vva1 then ( set Fbcc=_CRtext _channel win 75 ycour (w-80)/2-2 20 ET_AHSCROLL|ET_DOWN Bcc; set Tbcc=_CReditLine _channel win 75+(w-80)/2+2 ycour (w-80)/2-2 20 ET_AHSCROLL|ET_DOWN ""; ) else if Ibcc==Vvm then ( set Fbcc=nil; set Tbcc=_CReditLine _channel win 75 ycour w-80 20 ET_AHSCROLL|ET_DOWN Bcc; ) else if Ibcc==Via0 || Ibcc==Via1 then ( set Fbcc=nil; set Tbcc=_CReditLine _channel win 75 ycour w-80 20 ET_AHSCROLL|ET_DOWN ""; ) else nil; set ycour=ycour+25; if focus==nil then set focus=Tbcc else nil ) else nil; if Isub!=Vno then ( _CRtext _channel win 5 ycour 70 20 ET_ALIGN_RIGHT _loc this "F_SUB" nil; if Isub==Vvl then ( set Fsub=_CRtext _channel win 75 ycour w-80 20 ET_AHSCROLL|ET_DOWN Sub; set Tsub=nil; ) else if Isub==Vva0 then ( set Tsub=_CReditLine _channel win 75 ycour (w-80)/2-2 20 ET_AHSCROLL|ET_DOWN ""; set Fsub=_CRtext _channel win 75+(w-80)/2+2 ycour (w-80)/2-2 20 ET_AHSCROLL|ET_DOWN Sub; ) else if Isub==Vva1 then ( set Fsub=_CRtext _channel win 75 ycour (w-80)/2-2 20 ET_AHSCROLL|ET_DOWN Sub; set Tsub=_CReditLine _channel win 75+(w-80)/2+2 ycour (w-80)/2-2 20 ET_AHSCROLL|ET_DOWN ""; ) else if Isub==Vvm then ( set Fsub=nil; set Tsub=_CReditLine _channel win 75 ycour w-80 20 ET_AHSCROLL|ET_DOWN Sub; ) else if Isub==Via0 || Isub==Via1 then ( set Fsub=nil; set Tsub=_CReditLine _channel win 75 ycour w-80 20 ET_AHSCROLL|ET_DOWN ""; ) else nil; set ycour=ycour+25; if focus==nil then set focus=Tsub else nil ) else nil; if Itxt!=Vno then ( _CRtext _channel win 5 ycour 70 20 0 _loc this "F_TXT" nil; if Itxt==Vvl then ( set Ftxt=_CRtext _channel win 5 ycour+20 w-10 h-ycour-70 ET_HSCROLL|ET_VSCROLL|ET_DOWN Txt; set Ttxt=nil; ) else if Itxt==Vva0 then ( set Ttxt=_CRtext _channel win 5 ycour+20 w-10 (h-ycour-70)/2-5 ET_HSCROLL|ET_VSCROLL|ET_DOWN ""; set Ftxt=_CReditText _channel win 5 ycour+20+(h-ycour-70)/2 w-10 (h-ycour-70)/2-5 ET_HSCROLL|ET_VSCROLL|ET_DOWN Txt; ) else if Itxt==Vva1 then ( set Ftxt=_CRtext _channel win 5 ycour+20 w-10 (h-ycour-70)/2-5 ET_HSCROLL|ET_VSCROLL|ET_DOWN Txt; set Ttxt=_CReditText _channel win 5 ycour+20+(h-ycour-70)/2 w-10 (h-ycour-70)/2-5 ET_HSCROLL|ET_VSCROLL|ET_DOWN ""; ) else if Itxt==Vvm then ( set Ftxt=nil; set Ttxt=_CReditText _channel win 5 ycour+20 w-10 h-ycour-70 ET_HSCROLL|ET_VSCROLL|ET_DOWN Txt; ) else if Itxt==Via0 || Itxt==Via1 then ( set Ftxt=nil; set Ttxt=_CReditText _channel win 5 ycour+20 w-10 h-ycour-70 ET_HSCROLL|ET_VSCROLL|ET_DOWN ""; ) else nil; if focus==nil then set focus=Ttxt else nil ) else nil; ); /* Bouton validation */ set BSend=_CRbutton _channel win w/2-75 h-25 70 20 0 _loc this "B_SEND" nil; _CBbutton BSend @_sendE nil; set BAnnul=_CRbutton _channel win w/2+10 h-25 70 20 0 _loc this "B_CANCEL" nil; _CBbutton BAnnul mkfun3 @_destroyW nil nil; _CBwinDestroy win mkfun3 @_destroyW nil nil; _CBwinSize win @_resizeW nil; _focus nil focus nil );; /*-----------------------*/ fun action(from,act,param,rep)= if !strcmp act ACT_HIDE then _destroyW nil nil nil else nil;; /*-----------------------*/ fun IniDMI(s)= _DMSregisterDMI this @action nil; _DMSevent this EVT_IN nil nil;; /*-----------------------*/ fun __Show(param)= if win!=nil then nil else let strextr param -> l in let getInfos l KW_SND -> [isnd [snd _]] in let getInfos l KW_RCP -> [ircp [rcp _]] in let getInfos l KW_CC -> [icc [cc _]] in let getInfos l KW_BCC -> [ibcc [bcc _]] in let getInfos l KW_SUB -> [isub [sub _]] in let getInfos l KW_TXT -> [itxt [txt _]] in ( set Isnd=atoi isnd; set Snd=snd; set Ircp=atoi ircp; set Rcp=rcp; set Icc=atoi icc; set Cc=cc; set Ibcc=atoi ibcc; set Bcc=bcc; set Isub=atoi isub; set Sub=sub; set Itxt=atoi itxt; set Txt=txt; AffWin; _DMSevent this EVT_SHOWN nil nil; );; /*-----------------------*/ fun __SendOK()= _DLGrflmessage _DLGMessageBox _channel win _loc this "TIT_INFO" nil _loc this "MSG_SEND_OK" nil 0 @_destroyW nil;; /*-----------------------*/ fun __SendKO()= _affErr win _loc this "MSG_SEND_KO" nil focus;;