JABTEST

The JABTEST sample application is a green screen display program that let's you communicate with someone on a chat client such as Google Talk.

First, start a GreenJab listener for an ID using the GREENJAB command.  In my example I used my greenjabtest.gmail account.

Next, simply call the JABTEST program.  When you first run the JABTEST program you will be asked to enter a From ID and a To ID.  The From ID should be the ID that you started a GreenJab listener job for.  The To ID is the address you want to send the message to.  In my example I chose bvstone@bvstools.com

  12:42:02                    GreenJab Test Screen

From:  greenjabtest@gmail.com
To:    bvstone@bvstools.com
Enter your message here___________________________________________________________________________
Hi, Brad.  Just testing out the JABTEST program
From:bvstone@bvstools.com
That's great.  How's it going?

Not too bad.  We're still in Beta testing, but so far so good!
From:bvstone@bvstools.com
Great to hear!



                                                                        Bottom

  F3=Exit   F8=Protect Fields


You'll notice the F8=Protect Fields option.  When you press this it will toggle protection on the From and To fields so you can simply worry about typing messages on the entry line.

Now, because this subfile doesn't automatically update you can simply press Enter with a blank message to reload the subfile to check for new responses.  When the responses do arrive, they will be placed in the list, Yellow in color, as to more easily differentiate between your message.

The conversation will look normal on the client of the person you're chatting with as if you were using a PC or a handheld device.


 H DFTACTGRP(*NO) BNDDIR('GREENJAB')
 ****************************************************************
 *
 * This sample is used to show how you can create a green screen program to
 *  chat with a user on a Jabber client such as GoogleTalk.
 *
 * Steps to test:
 * 1. Use the GREENJAB command to start a listener job for the fromID
 * 2. Call this program and set the FROM and TO addresses.
 * 3. Optionally, press F8 to protect the from and to fields so that you only need to
 *     worry about the chat lines.
 * 4. Enter a message and press enter to send it to the FROM id.
 * 5. Press Enter without a message to refresh the screen and check for any replies.
 * 6. F3 to QUIT will also send **QUIT** to the GreenJab listener job.
 *
FJABTESTDF CF   E             WORKSTN SFILE(S1:RRN1)
 ****************************************************************
 * Imports
 ****************************************************************
 /COPY QCOPYSRC,P.GREENJAB
 ****************************************************************
D Rrn1            S              4  0
 *
D RC              S             10i 0
D from            S            256
D message         S          65535
 ********************************************************************
 /free
  EXSR $ClrSfl;

  dow (not *IN03);
    WSMSG = ' ';
    EXFMT C1;

    if (WSFROM <> ' ');
      #gj_setFromID(WSFROM);

      if (#gj_isActive <= 0);
        Leave;
      endif;

      RC = #gj_deqMsg(from:message:1:0);

      if (RC < 0);
        Leave;
      endif;

    endif;

    if (*IN03) or (WSMSG = '**QUIT**');
      RC = #gj_enqMsg(WSTO:'**QUIT**');
      LEAVE;
    endif;

    if (*IN08);
      *in68 = not *in68;
    endif;

    if (WSMSG <> ' ');
      RC = #gj_enqMsg(WSTO:WSMSG);
      *IN69 = *OFF;
      SFData = WSMSG;
      Rrn1 = (Rrn1 + 1);
      WRITE S1;
      *IN91 = *ON;
    endif;

    if (message <> ' ');
      *IN69 = *ON;
      SFData = 'From:' + %trim(from);
      Rrn1 = (Rrn1 + 1);
      WRITE S1;
      SFData = %trim(message);
      Rrn1 = (Rrn1 + 1);
      WRITE S1;
      *IN91 = *On;
    endif;

  enddo;

  *INLR = *ON;

  //**************************************************************************
  //* Initialize subfile
  //**************************************************************************
  BEGSR $ClrSfl;

    *IN89 = *ON;
    *IN90 = *OFF;
    *IN91 = *OFF;
    WRITE C1;
    Rrn1 = 0;
    *IN89 = *OFF;
    *IN90 = *ON;
    *IN91 = *OFF;
    WRITE F1;

  ENDSR;
 /end-free



Comments