/******************************************************************************* Module Interactivity Client part Version: 1.0 Authors: Jean-Pierre Dandrieux, Julien Zorko, Gilles Marchal, Julien Ducoin Last update: 12/06/2001 1 to 1 Audio/Video/Text communication system *******************************************************************************/ var REFRESH_TIME = 1;; var UNDEFINED_FIELD = "#undefined";; var ICON_COLUMN = 0;; var LOGIN_COLUMN = 1;; var STATE_COLUMN = 2;; var TIME_COLUMN = 3;; var FIRST_FIELD_COLUMN = 4;; var FREE_STATE = "FREE";; var WAITING_STATE = "WAITING";; var OCCUPIED_STATE = "OCCUPIED";; var flagCallAcpt = 0 ;; var flagCreateChannel = 0 ;; var TmpVideoBuffer = "";; var Proxy = 0;; typeof UserIdList = [[S I] r1];; /* Login, Id of the clients */ typeof CallerList = [[S I] r1];; /* Login, Id, TheirId of the callers */ typeof CallerParamList = [[S I]r1];; /* liste de [Com Params, Id] */ typeof ListSelect = [[I S] r1] ;; /* Id, login des clients selectionnés.*/ typeof IniComBuffParam = S ;; /* = "beencall" id1 , "askcall" id2 */ typeof FocusedSalon =I;; typeof ModulePath = S;; /* Module path */ typeof CallPicture = AlphaBitmap;; /* Call Icone */ typeof CallPicture1 = AlphaBitmap;; /* Call Icone */ typeof CallPicture2 = AlphaBitmap;; /* Call Icone */ defcom SmodifyState = ModifyState S;; /* state */ defcom SSYCtransmitScript=SYCtransmitScript I S;; defcom SSYCnewSalonID = SYCnewSalonID;; defcom Srelay = relay S S S;; /* used to relay actions */ defcom Sring = ring S;; fun RemoveUserFromList (list, userId) = if list == nil then nil else let list -> [first next] in let first -> [_ userId2] in if userId == userId2 then next else first::(RemoveUserFromList next userId) ;; fun GetLoginFromUserId (list, userId) = if list == nil then nil else let list -> [first next] in let first -> [login userId2] in if userId == userId2 then login else GetLoginFromUserId next userId ;; fun GetUserIdFromLogin (list, login) = switchstr list login ;; fun RefreshCallers (n) = if n<0 then 0 else let LISTVIEW_GetValue UsersListView n LOGIN_COLUMN -> [login _] in ( if (GetUserIdFromLogin CallerList login)==nil then LISTVIEW_DelLine UsersListView n else nil; RefreshCallers n-1 ) ;; /* Convert time to String. */ fun TimeToStr (t) = if t == nil then nil else let (t/3600) + 100 -> nh in let (mod t 3600)/60 + 100 -> nm in let (mod t 60) + 100 -> ns in if mod ns 2 then strcatn (substr itoa nh 1 2)::":"::(substr itoa nm 1 2)::":"::(substr itoa ns 1 2)::nil else strcatn (substr itoa nh 1 2)::":"::(substr itoa nm 1 2)::" "::(substr itoa ns 1 2)::nil ;; fun SetFields (fields, line, col) = if fields == nil then 0 else let fields -> [first next] in ( LISTVIEW_SetValue UsersListView line col [first nil]; SetFields next line col+1 ) ;; /******************************************************************************* users list management defcoms *******************************************************************************/ fun __AddUser (userId, login, state, t, fields) = if (GetLoginFromUserId UserIdList userId) == nil then ( set UserIdList = [login userId]::UserIdList; if (GetLoginFromUserId CallerList userId) == nil then LISTVIEW_AddLine UsersListView 0 (["" nil]::[login nil]::nil) else nil; let LISTVIEW_GetColumn UsersListView LOGIN_COLUMN -> loginList in let _POScompList loginList login -> line in ( LISTVIEW_SetValue UsersListView line STATE_COLUMN [_loc this state nil nil]; if !strcmp state FREE_STATE then LISTVIEW_SetValue UsersListView line TIME_COLUMN ["-" nil] else LISTVIEW_SetValue UsersListView line TIME_COLUMN [(TimeToStr _DMStime - t) nil]; SetFields hd strextr fields line FIRST_FIELD_COLUMN; 0 ) ) else nil; 0 ;; fun __RemoveUser (userId, login) = let LISTVIEW_GetColumn UsersListView LOGIN_COLUMN -> loginList in let GetLoginFromUserId UserIdList userId -> localLogin in let _POScompList loginList localLogin -> line in ( set UserIdList = RemoveUserFromList UserIdList userId; if (GetLoginFromUserId CallerList userId)==nil then ( LISTVIEW_DelLine UsersListView line; 0 ) else ( /* a caller can't be removed but has to be updated */ LISTVIEW_SetValue UsersListView line LOGIN_COLUMN [login nil]; /* Update the caller list */ RemoveUserFromList CallerList userId; set CallerList = [login userId]::CallerList; 0 ) ); 0 ;; fun __ClearList ()= set UserIdList = nil; RefreshCallers LISTVIEW_LineCount UsersListView ;; fun __ModifyState (login, newState, iniTime) = let LISTVIEW_GetColumn UsersListView LOGIN_COLUMN -> loginList in let _POScompList loginList login -> line in ( LISTVIEW_SetValue UsersListView line STATE_COLUMN [(_loc this newState nil) nil]; LISTVIEW_SetValue UsersListView line TIME_COLUMN [iniTime nil]; 0 ) ;; fun __ErrorMessage (title, content) = _DMSeventTag this "log" strcatn title::":\n"::content::nil nil nil; _DLGMessageBox _channel nil title content 0 ;; fun ModifyTitleCall(salonId,idCli,login)= let SearchInfoCom idCli myInfoCom -> infoCom in _SETwindowName (infoCom.SYCwindos) (strcatn " "::DMSlogin::" <--> "::login::nil); 0 ;; fun ModifyTitle(salonId,idCli,login)= let SearchInfoCom idCli myInfoCom -> infoCom in ( _SETwindowName (infoCom.SYCwindos) (strcatn " "::DMSlogin::" <--> "::login::nil); set infoCom.SYCotherLogin = login; _DMSsend this SSYCtransmitScript[infoCom.SYCid (strcatn "ModifyTitleCall "::(itoh (infoCom.SYCsalonId))::" "::(itoh DMSid)::" \""::DMSlogin::"\""::nil)]; ); 0 ;; fun ChangeAllLogin(list, login) = if list == nil then 0 else let list -> [infoCom next] in ( _SETwindowName (infoCom.SYCwindos) (strcatn " "::login::" <--> "::(infoCom.SYCotherLogin)::nil); _DMSsend this SSYCtransmitScript[infoCom.SYCid (strcatn "ModifyTitle "::(itoh (infoCom.SYCsalonId))::" "::(itoh DMSid)::" \""::login::"\""::nil)]; ChangeAllLogin next login; ) ;; fun __ChangeLogin(login)= ChangeAllLogin myInfoCom login; 0 ;; /******************************************************************************* One user of the list is calling you, an icone is displayed on his line beencallId -> I : Called User Id askcallId -> I : Caller User Id askCallLogin -> S : Caller Login <- always 0 *******************************************************************************/ fun Calling (beencallId, askcallId, askCallLogin) = set flagCallAcpt = flagCallAcpt+1; let LISTVIEW_GetColumn UsersListView LOGIN_COLUMN -> loginList in let GetLoginFromUserId UserIdList askcallId -> callLogin in if (GetLoginFromUserId CallerList askcallId) != nil then nil /* askcallId is already calling you! */ else let if callLogin == nil then ( LISTVIEW_AddLine UsersListView 0 (["" CallPicture]::[askCallLogin nil]::[(_loc this "WAITING" nil) nil]::["00:00:00" nil]::nil); LISTVIEW_SetClicked UsersListView 0; askCallLogin ) else let _POScompList loginList callLogin -> line in ( LISTVIEW_SetValue UsersListView line ICON_COLUMN [nil CallPicture]; LISTVIEW_SetClicked UsersListView line; callLogin ) -> caller in let strbuild ("beencall"::(itoa beencallId)::nil)::("askcall"::(itoa askcallId)::nil)::nil -> ttheirId in ( set CallerList = [caller askcallId]::CallerList; _DMSsend this Sring [askCallLogin]; _DMSeventTag this "ring" nil nil nil; /* save communications parameters */ set CallerParamList = [ttheirId askcallId]::CallerParamList; 0 ) ;; fun CreateSalon ( IdSalon, theId ) = let SYCmyrecparams -> [ audioparam videoparam textparam ] in let strcatn (audioparam.Aid)::" "::(audioparam.FreqMultiplyer)::" "::(audioparam.nBuffers)::" "::(audioparam.Sample)::" "::(audioparam.Stereo)::nil -> paramA in let strcatn (videoparam.Vid)::" "::(videoparam.Framerate)::" "::(videoparam.Width)::" "::(videoparam.nbcolor)::" "::(videoparam.Quality)::nil -> paramV in let strcatn (textparam.Tid)::" "::(textparam.FontSize)::" "::(textparam.FontEffect)::" "::(textparam.FontName)::" "::(textparam.Color)::nil -> paramT in ( __SYCupdateSalon IdSalon "salonP2P" theId 2 111 paramA paramV paramT; __SYCupdateMember IdSalon theId 0 0 0 0; ); set FocusedSalon=IdSalon; let SearchInfoCom theId myInfoCom -> thisInfoCom in /*envoi de la photo */ let SYCmyrecparams -> [aparams vparams _] in let hd hd strextr _getpack _checkpack "locked/conf/photo.conf" -> myphoto in ( set thisInfoCom.SYCsalonId = IdSalon; if myphoto == nil then nil else let (_getpack _checkpack myphoto) -> strphoto in /* recherche si la concatenation des deux premiers caractères = BM. */ let _fooS strcat "BM = " (substr strphoto 0 2) -> _ in let (substr strphoto 0 2) -> signature in if !(strcmp signature "BM") then let _LDbitmap _channel (_checkpack myphoto) -> photobitmap in let _GETbitmapSize photobitmap -> [wi hi] in let _CRbitmap _channel atoi vparams.Width (3*(atoi vparams.Width))/4 -> photobitmap2 in let _SCPbitmap photobitmap2 0 0 (atoi vparams.Width) (3*(atoi vparams.Width))/4 photobitmap 0 0 wi hi nil -> photobitmap in SYCrecVideoCB nil vparams (_InvertCapBitmap (_GETbitmap photobitmap2) (atoi vparams.Width)) else let (substr strphoto 6 4) -> signature in if !(strcmp signature "JFIF") then let _LDjpeg _channel (_checkpack myphoto) -> photobitmap in let _GETbitmapSize photobitmap -> [wi hi] in let _CRbitmap _channel atoi vparams.Width (3*(atoi vparams.Width))/4 -> photobitmap2 in let _SCPbitmap photobitmap2 0 0 (atoi vparams.Width) (3*(atoi vparams.Width))/4 photobitmap 0 0 wi hi nil -> photobitmap in SYCrecVideoCB nil vparams (_InvertCapBitmap (_GETbitmap photobitmap2) (atoi vparams.Width)) else nil; /*message d'entree*/ let SYCmyrecparams -> [_ _ textparams] in let strcatn textparams.Tid::" "::textparams.FontSize::" "::textparams.FontEffect::" "::textparams.FontName::" "::(itoa (make_rgb 255 0 0))::nil -> tparams in SYCrecText tparams strbuild ("text"::(_loc this "INTERFACE_CONNECT" DMSlogin::nil)::nil)::nil; /* if i changed my login after the caller called me, i update my login */ _DMSsend this SSYCtransmitScript[theId (strcatn "ModifyTitleCall "::(itoh IdSalon)::" "::(itoh DMSid)::" \""::DMSlogin::"\""::nil)]; SYCvideoRecord vparams; SYCsndRecord aparams ) ;; fun RemoveCaller (callerId) = let LISTVIEW_GetColumn UsersListView LOGIN_COLUMN -> logColumn in let _POScompList logColumn GetLoginFromUserId CallerList callerId -> line in ( LISTVIEW_SetValue UsersListView line ICON_COLUMN [nil nil]; set CallerList = RemoveUserFromList CallerList callerId; if (GetLoginFromUserId UserIdList callerId) != nil then nil else LISTVIEW_DelLine UsersListView line; ); 0 ;; fun EndCom (callerId) = if SYCsalonList==nil then _DMSsend this SmodifyState[FREE_STATE] else _DMSsend this SmodifyState[OCCUPIED_STATE]; RemoveCaller callerId ;; /******************************************************************************* Callbacks *******************************************************************************/ /* user's selection in the list */ fun cbClick (lv , line , col ) = let LISTVIEW_GetValue lv line 1 -> [login _] in let GetUserIdFromLogin UserIdList login -> userId in set ListSelect = [userId login]::nil; 0 ;; fun cbSalonFocused (wn,infocom)= set FocusedSalon=infocom.SYCsalonId ;; /* call action */ fun cbCall ( from, action, param, others, tag ) = let LISTVIEW_GetColumn UsersListView LOGIN_COLUMN -> logColumn in let _GETcompListClicked logColumn -> [i [login _]] in let GetUserIdFromLogin UserIdList login -> userId in if login == nil then ( _DMSeventTag this "log" (_loc this "CLIENT_MSG1" nil) nil nil; 0 ) else if (GetLoginFromUserId CallerParamList (GetUserIdFromLogin CallerList login))!=nil then ( _DMSeventTag this "log" (_loc this "CLIENT_MSG2" nil) nil nil; 0 ) else if (SearchInfoCom userId myInfoCom)!=nil then ( _DMSeventTag this "log" (_loc this "CLIENT_MSG3" nil) nil nil; 0 ) else ( _DMSsend this SSYCtransmitScript[userId (strcatn "Calling "::(itoh userId)::" "::(itoh DMSid)::" \""::DMSlogin::"\""::nil)]; _DMSsend this SmodifyState[WAITING_STATE]; /* associate the id and the login of the askcaller to the com Win */ let (drawWinComm 0 userId login) -> infoCom in ( set myInfoCom = infoCom::myInfoCom; let SYCmyrecparams -> [_ _ textparams] in let strcatn textparams.Tid::" "::textparams.FontSize::" "::textparams.FontEffect::" "::textparams.FontName::" "::(itoa (make_rgb 255 0 0))::nil -> tparams in setInfoText infoCom nil (_loc this "INTERFACE_WAITING" login::nil) textparams.FontName (atoi textparams.FontSize) (make_rgb 255 0 0) (atoi textparams.FontEffect); _CBwinFocus infoCom.SYCwindos @cbSalonFocused infoCom; ); 0 ); 0 ;; /* serveur est créé par celui qui accepte la com donc beencall */ fun cbAnswer (from, action, param, others, tag) = if flagCallAcpt == 0 then nil else let LISTVIEW_GetColumn UsersListView LOGIN_COLUMN -> logColumn in let _GETcompListClicked logColumn -> [i [login _]] in let GetLoginFromUserId CallerParamList (GetUserIdFromLogin CallerList login) -> iniCom in if iniCom == nil then 0 /* no caller is sellected */ else ( _DMSsend this SmodifyState[OCCUPIED_STATE]; LISTVIEW_SetValue UsersListView i ICON_COLUMN [nil nil]; LISTVIEW_SetValue UsersListView i STATE_COLUMN [(_loc this OCCUPIED_STATE nil) nil]; LISTVIEW_SetValue UsersListView i TIME_COLUMN ["00:00:00" nil]; set IniComBuffParam = iniCom; /*demande de numéro de salon. */ _DMSsend this SSYCnewSalonID[] ) ;; fun __SYCnewSalon(IdSalon)= let strextr IniComBuffParam -> list in let atoi getInfo list "beencall" -> beencallId in let atoi getInfo list "askcall" -> askcallId in let SYCmyrecparams -> [ _ videoparam _ ] in let GetLoginFromUserId CallerList askcallId -> log in ( /* associate the id and the login of the askcaller to the com Win */ set myInfoCom = (drawWinComm IdSalon askcallId log)::myInfoCom; let myInfoCom ->[wn nxt] in _CBwinFocus wn.SYCwindos @cbSalonFocused wn; /* Initialisation video et audio. */ SYCiniVideo videoparam; SYCiniAudio ; /* Creation du serveur avec comme Port le premier libre de 3010 à 4000 */ if !Proxy then set Proxy = ((SYCchooseServer 3010 4000) == nil) else nil; let SYCMyTcpServers -> [usedport _] in let strcatn (_hostIP)::":"::(itoa usedport)::nil -> fulladdress in _DMSsend this SSYCtransmitScript[askcallId (strcatn "ServPort "::(itoh IdSalon)::" "::(itoh beencallId)::" \""::fulladdress::" \""::nil)]; set flagCallAcpt = flagCallAcpt - 1; ); 0 ;; fun TP ( askcallId, comscript ) = _DMSsend this SSYCtransmitScript [askcallId comscript] ; 0 ;; /* function used by the client asking the call */ fun ServPort ( IdSalon, beencallId, fulladdress ) = _DMSsend this SmodifyState[OCCUPIED_STATE]; /*Assigne l'Id salon , a la fenetre de comm . */ let SearchInfoCom beencallId myInfoCom -> thisInfoCom in set thisInfoCom.SYCsalonId = IdSalon; if flagCreateChannel == 0 then ( set flagCreateChannel = 1 ; /* creation d'un canal. */ let SYCcreateChannel fulladdress -> mychannel in ( if (mychannel == nil) then ( SYCchooseServer 3010 4000; _DMSsend this SSYCtransmitScript[beencallId (strcatn "SecondCreateChannel "::(itoh IdSalon)::" "::(itoh beencallId)::" \""::fulladdress::" \""::(itoh flagCreateChannel)::nil)]; ) else ( if (SYCgetCoordById SYCp2pList beencallId) == nil then set SYCp2pList = (mkTcoord [beencallId mychannel])::SYCp2pList else nil; CreateSalon IdSalon beencallId ; _DMSsend this SSYCtransmitScript[beencallId (strcatn "SavChannel "::(itoh IdSalon)::" "::(itoh DMSid)::nil)]; ); set flagCreateChannel = 0; ) ) else ( _DLGMessageBox _channel nil "Information" (_loc this "CLIENT_MSG4" nil) 0; 0 ) ;; fun SavChannel ( IdSalon, askcallId ) = if (SYCgetCoordById SYCp2pList askcallId) == nil then ( set SYCp2pList = (mkTcoord [askcallId SYCnewChannel])::SYCp2pList; ) else nil; CreateSalon IdSalon askcallId ;; fun SecondCreateChannel ( IdSalon, askcallId , fulladdress, flag ) = let SYCcreateChannel fulladdress -> mychannel in if (mychannel == nil) then ( if (SYCgetCoordById SYCp2pList askcallId) == nil then set SYCp2pList = (mkTcoord [askcallId SYCnewChannel])::SYCp2pList else nil; CreateSalon IdSalon askcallId ; _DMSsend this SSYCtransmitScript[askcallId (strcatn "SavChannel "::(itoh IdSalon)::" "::(itoh DMSid)::nil)]; ) else ( if (SYCgetCoordById SYCp2pList askcallId) == nil then set SYCp2pList = (mkTcoord [askcallId SYCnewChannel])::SYCp2pList else nil; CreateSalon IdSalon askcallId ; _DMSsend this SSYCtransmitScript[askcallId (strcatn "SavChannel "::(itoh IdSalon)::" "::(itoh DMSid)::nil)]; ) ;; /* Envoi de l'audio. */ fun DiffuseAudio(salonid, senderid, buffer)= let SYCmyplayparams -> [ a _ _ ] in SYCplayAudio a buffer; 1 ;; /* Affichage de la video. */ fun DiffuseVideo(salonid, senderid, buffer)= /* assemblage des trames.*/ set TmpVideoBuffer = strcat TmpVideoBuffer buffer; let SYCmyplayparams -> [ _ v _ ] in let (SYCplayVideo v TmpVideoBuffer) -> buffer in ( /* if (strlen TmpVideoBuffer) == (((atoi v.Width)*(atoi v.Width)*3)/2) then */ let SearchInfoCom senderid myInfoCom -> thisInfoCom in /* Recherche de la bonne structure SYCinfoCom. */ let _CRbitmap _channel (atoi (v.Width)) (((atoi (v.Width))*3)/4) -> mybmp in let _SETbitmap mybmp (_InvertCapBitmap buffer (atoi (v.Width))) -> mybmp in ( setVideoBitmap thisInfoCom mybmp; _DSbitmap mybmp; set TmpVideoBuffer = ""; ) /*else nil;*/ ); 1 ;; fun DifferentParamText(salonid, senderid, buffer, param)= let SearchInfoCom senderid myInfoCom -> thisInfoCom in /* Recherche de la bonne structure SYCinfoCom. */ let strextr param -> listparams in let listparams -> [nxt _] in let nxt -> [ _ nxt] in let nxt -> [fontSize[fontEffect[fontName[fontColor nxt]]]] in let strextr buffer -> l in let getInfo l "login" -> login in let getInfo l "text" -> str in setInfoText thisInfoCom login str fontName (atoi fontSize) (atoi fontColor) (atoi fontEffect); 1 ;; fun KillAllChannel(list)= if list == nil then 1 else let list -> [a next] in ( SYCcloseChannel a.Chan; KillAllChannel next; ) ;; fun cbBeforeClose()= /* fermeture de tous les channels utilisés par ce clients. "SYCcloseChannel" Informé les cliens connectés à ces mêmes channel. */ KillAllChannel SYCp2pList; let SYCMyTcpServers -> [ _ serveur ] in SYCcloseServer serveur; 0 ;; fun SYCSendChoice(type,buffer,paramstr)= if type==100 || type==10 then SYCuserSend type buffer paramstr else SYCsend2Target (SYCgetSalonById SYCsalonList FocusedSalon) [nil nil type buffer paramstr]; 1 ;; /******************************************************************************* Timer to increse time in listview *******************************************************************************/ fun IncreaseTimer (t) = let atoi substr t 0 2 -> h in let atoi substr t 3 2 -> m in let atoi substr t 6 2 -> s in let s+60*(m+60*h)+REFRESH_TIME -> tt in let (tt/3600) + 100 -> nh in let (mod tt 3600)/60 + 100 -> nm in let (mod tt 60) + 100 -> ns in if h != nil then if mod ns 2 then strcatn (substr itoa nh 1 2)::":"::(substr itoa nm 1 2)::":"::(substr itoa ns 1 2)::nil else strcatn (substr itoa nh 1 2)::":"::(substr itoa nm 1 2)::" "::(substr itoa ns 1 2)::nil else t ;; fun IncreaseTimers (n) = if (n==nil) || (n<=0) then 0 else let n-1 -> nn in let LISTVIEW_GetValue UsersListView nn TIME_COLUMN -> [t _] in let LISTVIEW_GetValue UsersListView nn ICON_COLUMN -> [_ b] in ( if !strcmp substr t 2 1 ":" then LISTVIEW_SetValue UsersListView nn TIME_COLUMN [IncreaseTimer t nil] else nil; if b == nil then nil else LISTVIEW_SetValue UsersListView nn ICON_COLUMN [nil CallPicture]; IncreaseTimers nn ) ;; fun cbTimer (timer, col) = if CallPicture == CallPicture2 then set CallPicture = CallPicture1 else set CallPicture = CallPicture2; IncreaseTimers LISTVIEW_LineCount UsersListView ;; /******************************************************************************* Add colums for info fields *******************************************************************************/ fun AddFieldsToListView (fieldNames, n) = if fieldNames == nil then 0 else let fieldNames -> [first next] in if !strcmp first UNDEFINED_FIELD then AddFieldsToListView next n else ( LISTVIEW_AddCol UsersListView n first LST_LEFT|LST_HIGHLIGHT_CLICKED 50 5; AddFieldsToListView next n+1 ) ;; /******************************************************************************* open the admistration interface from -> DMI : not used user -> User : the user that run the action action -> S : not used param -> S : not used others -> [User r1] : not used tag -> Tag : not used <- I : nothing special *******************************************************************************/ fun cbHide (from, action, param, others, tag) = _SHOWcontainer ListContainer CONTAINER_HIDDEN; _DMSeventTag this "hidden" nil nil nil; 0 ;; /******************************************************************************* open the admistration interface from -> DMI : not used user -> User : the user that run the action action -> S : not used param -> S : not used others -> [User r1] : not used tag -> Tag : not used <- I : nothing special *******************************************************************************/ fun cbShow (from, action, param, others, tag) = _SHOWcontainer ListContainer CONTAINER_UNHIDDEN; _DMSeventTag this "shown" nil nil nil; 0 ;; /******************************************************************************* relay action *******************************************************************************/ fun cbRelay (from, action, param, others, tag,i) = let hd ListSelect -> [_ loginSelected] in _DMSsend this Srelay [loginSelected param i]; 0 ;; /******************************************************************************* define others actions *******************************************************************************/ fun DefOthers(n) = if n == nil || n <= 0 then 0 else ( _DMSdefineActions this [strcat "relay." itoa n mkfun6 @cbRelay itoa n]::nil; DefOthers n-1 ) ;; /******************************************************************************* Client initialization *******************************************************************************/ fun IniDMI (parameter) = let strextr parameter -> Paramstr in let switchstr Paramstr "fields" -> fields in let getInfo Paramstr "FRAMERATE" -> frame in let getInfo Paramstr "QUALITY" -> quality in let getInfo Paramstr "FREQMUL" -> freqmul in let getInfo Paramstr "WIDTH" -> width in let getInfo Paramstr "SAMPLE" -> sample in let getInfo Paramstr "STEREO" -> stereo in let getInfo Paramstr "nbEventRelay" -> nbEventRelay in let atoi getInfo Paramstr "PROXYS" -> proxys in let mkTaudioParam [ (itoa DMSid) (itoa ((atoi freqmul)/5512)) (itoa 2) (itoa ((atoi sample)/8)) stereo ] -> audioparam in let mkTvideoParam [ (itoa DMSid) (itoa ((atoi frame)*1000)) width nil quality ] -> videoparam in let mkTtextParam [ (itoa DMSid) (_loc this "INTERFACE_FONTSIZE" nil) (_loc this "INTERFACE_FONTEFFECT" nil) (_loc this "INTERFACE_FONTNAME" nil) (itoa (make_rgb 0 255 0)) ] -> textparam in /*let mkTtextParam [ (itoa DMSid) fontsize fonteffect fontname (itoa (make_rgb 0 255 0)) ] -> textparam in*/ ( /* define relay actions */ DefOthers atoi nbEventRelay; /* Paramètres de captures. */ set AvInServer = proxys ; set SYCmyrecparams = [ audioparam videoparam textparam ] ; set SYCsend = @SYCSendChoice ; set SYCdiffuseAudio=@DiffuseAudio; set SYCdiffuseVideo=@DiffuseVideo; set SYCTwoProxys = @TP; set SYCdifferentParamText=@DifferentParamText; /* Paramètre de lecture. */ set SYCmyplayparams = [ audioparam videoparam textparam ]; /* Autres initialisations */ set ModulePath = _DMSgetpath _DMSgetClass this; set CallPicture1 = _LDalphaBitmap _channel _checkpack (strcat ModulePath "ressources/callicone.png"); set CallPicture2 = _LDalphaBitmap _channel _checkpack (strcat ModulePath "ressources/callicone2.png"); set CallPicture = CallPicture1; set UsersListView = drawListClient; AddFieldsToListView fields FIRST_FIELD_COLUMN; LISTVIEW_SetCBclick UsersListView @cbClick ; /* out : listview , line , colunm */ let LISTVIEW_GetColumn UsersListView 3 -> timerCol in _rfltimer _starttimer _channel REFRESH_TIME*1000 @cbTimer timerCol; /* Callbacks affectation */ _DMSdefineActions this (["call" @cbCall]):: (["answer" @cbAnswer ]):: (["show" @cbShow ]):: (["hide" @cbHide ])::nil; _DMSregister this @cbBeforeClose; _DMSeventTag this "in" nil nil nil; 0 ) ;;