home *** CD-ROM | disk | FTP | other *** search
/ Amiga ACS 1998 #4 / amigaacscoverdisc1998-041998.iso / utilities / shareware / comm / qamitrack / source / qamitrackshared.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-02-19  |  4.7 KB  |  135 lines

  1. /* Data and prototypes that are shared by both client and server */
  2.  
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5. #include <string.h>
  6. #include <time.h>
  7.  
  8. #include <dos/dos.h>
  9. #include <dos/dostags.h>
  10. #include <dos/dosextens.h>
  11.  
  12. #include <exec/types.h>
  13. #include <exec/io.h>
  14. #include <exec/lists.h>
  15. #include <exec/memory.h>
  16.  
  17. #include <clib/commodities_protos.h>
  18. #include <clib/exec_protos.h>
  19. #include <clib/alib_protos.h>
  20. #include <clib/dos_protos.h>
  21. #include <clib/icon_protos.h>
  22. #include <clib/wb_protos.h>
  23. #include <clib/intuition_protos.h>
  24. #include <clib/diskfont_protos.h>
  25. #include <clib/gadtools_protos.h>
  26. #include <clib/graphics_protos.h>
  27. #include <clib/amarquee_protos.h>
  28.  
  29. #include <errno.h>
  30. #include <time.h>
  31.  
  32. #include <intuition/intuition.h>
  33. #include <intuition/intuitionbase.h>
  34. #include <intuition/gadgetclass.h>
  35. #include <intuition/screens.h>
  36. #include <libraries/gadtools.h>
  37.  
  38. #include <pragmas/amarquee_pragmas.h>
  39.  
  40. #include <libraries/diskfont.h>
  41. #include <libraries/commodities.h>
  42.  
  43. #define UNLESS(x) if(!(x))
  44.  
  45. #define EVT_HOTKEY  1
  46.  
  47. /* Used internally by the event loops */
  48. #define CODE_TIMER         0x0001 /* "The time went off." */
  49. #define CODE_WINDOW_EVENT  0x0002 /* "Check for IDCMP stuff." */
  50. #define CODE_RECONNECT       0x0004 /* "Reconnect to another server/port" */
  51. #define CODE_HIDE          0x0008 /* "Close your window." */
  52. #define CODE_SHOW          0x0010 /* "Show your window." */
  53. #define CODE_ENABLE        0x0020 /* "Resume pinging & updating" */
  54. #define CODE_DISABLE       0x0040 /* "Stop automatic pinging & updating" */
  55. #define CODE_AREXX         0x0080 /* "An ARexx message is ready." */
  56. #define CODE_SENDSTATE     0x0100 /* "Send your current info to the server." */
  57. #define CODE_QMESSAGE      0x0200 /* "A QMessage is ready." */
  58. #define CODE_QUIT          0x0400 /* "Die! Die! Die!" */
  59.  
  60. /* Log event opcodes */
  61. #define LOG_LOGON      0  /* A new host appeared on the list */
  62. #define LOG_LOGOFF     1  /* A host dissapeared from the list */
  63. #define LOG_UPDATE     2  /* A host changed its comment string */
  64. #define LOG_CONNECT    3  /* We connected to the server */
  65. #define LOG_DISCONNECT 4  /* We disconnected from the server */
  66. #define LOG_START      5  /* QAmiTrack starts */
  67. #define LOG_END        6  /* QAmiTrack finishes */
  68. #define LOG_SYSMESSAGE 7  /* System message received */
  69. #define LOG_DEFAULT    8  /* Rexx script to run if the real one isn't defined */
  70. #define NUM_LOG_ENUMS  9  /* for array sizes, etc */
  71.  
  72. struct CxStuff {
  73.     CxObj * broker;
  74.     struct MsgPort * port;
  75.     struct NewBroker nb;
  76.     char * name;
  77. };
  78.  
  79. struct WindowStuff {
  80.     struct Screen * screen;        /* Pointer to screen we're on */
  81.     struct Window * win;        /* Pointer to Intuition window structure */
  82.     struct TextAttr font;        /* Gadget rendering font */
  83.     struct TextFont * fontdata;    /* The font's bits */
  84.     struct TextAttr fixedfont;    /* ListView rendering font */
  85.     struct TextFont * fixedfontdata; /* This font's bits */
  86.     void           * vi;              /* visual info for gadgets */
  87.     struct Gadget * glist;             /* list of all our gadgets */
  88.     struct Gadget * CommentListGadget; /* ListView of all logins */
  89.     struct Gadget * LogListGadget;   /* ListView of chat history */
  90.     struct Gadget * ListGadget;         /* ListView of all logins */
  91.     struct Gadget * ServerString;     /* Server display/chooser string */
  92.     struct Gadget * PortString;         /* Port display/chooser string */
  93.     struct Gadget * ActionCycle;     /* Cycle to choose wdich action will be performed on double-click in the ListView */
  94.     struct Gadget * CommentString;     /* Comment display/chooser string */
  95. };
  96.  
  97. struct TimerStuff {
  98.     struct MsgPort     * TimerMP;
  99.     struct timerequest * TimerIO;
  100.     BOOL BDevOpen;
  101. };
  102.  
  103.  
  104. /* Shared functions */
  105. void TrackWait(struct WindowStuff * Window, 
  106.                struct QSession    * session, 
  107.                struct RexxHost    * host,
  108.                struct CxStuff     * cx,
  109.                struct TimerStuff  * ts);
  110.  
  111. void SetTrackFlag(ULONG flag);
  112. BOOL CheckTrackFlag(ULONG flag);
  113. BOOL TrackFlagsSet(void);
  114.  
  115. struct TimerStuff * SetupTimer(struct TimerStuff * ts);
  116. void SetTimer(struct TimerStuff * ts, int nSecs, int nMicros);
  117.  
  118. void ReplaceAllocedString(char ** szOldString, char * szNewString);
  119. void TrackExit(char * szMessage, int nCode);
  120.  
  121. BOOL FillInfos(struct SocketStuff * sSocket, char **pSetName, ULONG * ulIPAddress, char **pSetComment);
  122. void ClearTrackScreen(void);
  123.  
  124. int MakeReq(char *sTitle, char *sText, char *sGadgets);
  125.  
  126. char * PastSpaces(char * pcString);
  127. char * RemoveUnprintableChars(char * pcString);
  128. char * RemoveTrailingSpaces(char * pcString);
  129. char * ToLower(char * pcString);
  130.  
  131. void SetLogViewLength(int numLines);
  132. int ParseLogViewLevel(char * levelString);
  133. void SetRexxScript(int which, char * filename);
  134. BOOL SetLogViewLevel(ULONG ulItemCode);  /* returns TRUE iff a change was made */
  135. int GetLogViewLevelPercent(ULONG ulItemCode);  /* item code -> % */