home *** CD-ROM | disk | FTP | other *** search
/ Network Support Encyclopedia 96-1 / novell-nsepro-1996-1-cd2.iso / download / netware / kvfon3.exe / FORWARD.H < prev    next >
C/C++ Source or Header  |  1994-11-22  |  5KB  |  155 lines

  1. /****************************************************************************
  2. **    File:    FORWARD.H
  3. **
  4. **    Desc:    Include files for the dialpad program.
  5. **
  6. **    This file is an include file for the dialpad program.  It contains the
  7. **    dialog source for forwarding your calls to another extension.
  8. **
  9. **    It is written for OWL 2.0 with Borland C++ 4.x.  To compile this program,
  10. **    create a project in BC4.x, similar to the .IDE project file included.
  11. **
  12. **        DISCLAIMER
  13. **
  14. **    Novell, Inc. makes no representations or warranties with respect to
  15. **    any NetWare software, and specifically disclaims any express or
  16. **    implied warranties of merchantability, title, or fitness for a
  17. **    particular purpose.
  18. **
  19. **    You may use this sample code in your own programs.
  20. **
  21. **    Distribution of any NetWare software is forbidden without the
  22. **    express written consent of Novell, Inc.  Further, Novell reserves
  23. **    the right to discontinue distribution of any NetWare software.
  24. **
  25. **    Novell is not responsible for lost profits or revenue, loss of use
  26. **    of the software, loss of data, costs of re-creating lost data, the
  27. **    cost of any substitute equipment or program, or claims by any party
  28. **    other than you.  Novell strongly recommends a backup be made before
  29. **    any software is installed.   Technical support for this software
  30. **    may be provided at the discretion of Novell.
  31. **
  32. **    Programmers:
  33. **
  34. **        Ini    Who                        Firm
  35. **        -----------------------------------------------------------------------
  36. **        KVW    Kevin V White        Novell Developer Support.
  37. **
  38. **    History:
  39. **
  40. **        When        Who    What
  41. **        -----------------------------------------------------------------------
  42. **        11-22        KVW    This feature is new
  43. */
  44.  
  45. /****************************************************************************
  46. **    This is the forward dialog's class.
  47. */
  48. class TForward:public TDialog
  49. {
  50.     public:
  51.         ACSHandle_t    globalACSHandle;
  52.         DeviceID_t  forwardExt,callerExt;
  53.         CSTAEvent_t eventBuffer;
  54.         unsigned short eventBufferSize;
  55.         unsigned short numEvents;
  56.         RetCode_t rCode;
  57.         InvokeID_t invokeID;
  58.         TEdit *extEntryBox;
  59.         BOOL *ForwardStatus;
  60.  
  61.         TForward(TWindow *parent,TResId resId,ACSHandle_t *acsHandle,
  62.             DeviceID_t *caller,BOOL *currentStatus);
  63.         void SetupWindow();
  64.         void CleanupWindow();
  65.         void CmForward();
  66.  
  67.     DECLARE_RESPONSE_TABLE(TForward);
  68. };
  69.  
  70. /****************************************************************************
  71. **    this is how OWL adds message handling to the windows message loop
  72. */
  73. DEFINE_RESPONSE_TABLE1(TForward,TDialog)
  74.     EV_COMMAND(IDOK,CmForward),
  75. END_RESPONSE_TABLE;
  76.  
  77. /****************************************************************************
  78. **    constructor for the transfer call dialog
  79. */
  80. TForward::TForward(TWindow *parent,TResId resId,ACSHandle_t *acsHandle,
  81.     DeviceID_t *caller,BOOL *currentStatus)
  82.     :TDialog(parent,resId),TWindow(parent)
  83. {
  84.     globalACSHandle=*acsHandle;
  85.     strcpy(callerExt,*caller);
  86.     ForwardStatus=currentStatus;
  87. }
  88.  
  89. /****************************************************************************
  90. ** SetupWindow is called when the dialog window is created
  91. */
  92. void TForward::SetupWindow()
  93. {
  94.     /*------------------------------------------------------------------------
  95.     ** first, call the parent's SetupWindow
  96.     */
  97.     TDialog::SetupWindow();
  98.  
  99.     /*------------------------------------------------------------------------
  100.     ** create an alias to the text box in the dialog, as the alias will be
  101.     ** easier to enter text into and retrieve text from than the dialog
  102.     */
  103.     extEntryBox=new TEdit(this,IDC_EDIT1,30);
  104.     extEntryBox->Create();
  105. }
  106.  
  107. /****************************************************************************
  108. **    CleanupWindow is called when the window is destroyed.  We just use it to
  109. ** free the memory allocated to our TEdit alias in SetupWindow, then call
  110. **    the parent's CleanupWindow
  111. */
  112. void TForward::CleanupWindow()
  113. {
  114.     delete extEntryBox;
  115.  
  116.     TDialog::CleanupWindow();
  117. }
  118.  
  119. /****************************************************************************
  120. **    Here we actually forward the calls
  121. */
  122. void TForward::CmForward()
  123. {
  124.     /*-----------------------------------------------------------------------
  125.     **    get the extension to forward to
  126.     */
  127.     extEntryBox->GetLine(forwardExt,30,0);
  128.     if(strlen(forwardExt)>0)
  129.     {
  130.         *ForwardStatus=TRUE;
  131.         rCode=cstaSetForwarding(globalACSHandle,invokeID,&callerExt,
  132.             FWD_IMMEDIATE,TRUE,&forwardExt,NULL);
  133.         if(rCode>0)
  134.         {
  135.             eventBufferSize=sizeof(CSTAEvent_t);
  136.             rCode=acsGetEventBlock(globalACSHandle,&eventBuffer,&eventBufferSize,
  137.                 NULL,&numEvents);
  138.             if(rCode==ACSPOSITIVE_ACK)
  139.             {
  140.             }
  141.             else
  142.             {
  143.                 MessageBox("Event returned wrong","Forward Calls");
  144.             }
  145.         }
  146.         else
  147.         {
  148.             MessageBox("Cannot Turn On Forward Calls","Forward Calls Error");
  149.         }
  150.     }
  151.     TDialog::CmOk();
  152.     return;
  153. }
  154.  
  155.