Chat Scripting

You can create your own "Digital Assistants," or "Chat Bots," using AppleScript or C/C++ programs for use with TeleFinder.

Use of the information in this section requires knowledge of AppleScript and/or programming with AppleEvents. For additional information about AppleScript, please see "AS_Language_Guide.sit."

Chat Scripts interact with TeleFinder at several different levels. Through AppleScript ( or other programs that generate and use the Chat AppleEvents ) you can

  • Send Instant Messages
  • Send a Message to a Chat Room
  • Find the name of an open Chat Room
  • Open a Chat Room
  • Install a "Chat Filter"
  • Remove a "Chat Filter"
  • Get a List of the Users currently Online.

 

Chat Filters are programs that register with TeleFinder/User as a filter for either Instant Messages, or Chat Room messages. A Chat Filter program is must handle specific Apple Events sent to them by TeleFinder/User. The results of those Apple Events can modify, relply to, log or filter the messages seen in the Chat Room. Sample Chat Filter programs are included in TeleFinder/User's "Chat Extensions" folder.

Chat Room Filters must be prepared to handle the following messages ( AppleEvents ) from TeleFinder/User.

  • User Leaves a Chat Room
  • User Enters a Chat Room
  • Filter User Messgae
  • Auto-Reply User Message
  • Change Outgoing Message
  • Chat Room Opened
  • Chat Room Closed

 An Instant Message Filter will see only the following mesasges.

  • Filter User Messaqe
  • Auto-Reply User Message
  • Change Outgoing Message

 When using AppleScript for Filtering, you will need to save the script as an Application.

 

 

Event Descriptions

Details of the various chat related events are listed below. Please also see the sample AppleScripts for examples of actual usage.

The name of the event is show in bold, the four character event code is show in single quotes. All are part of the TeleFinder Event Class ( 'TfAE' ). Apple Scripters should use the dictionary built into TeleFinder to write the script. C/C++ programmers can use the constants listed here.

 

OpenChat ( 'OpCt' ) - The Open Chat event opens a chat room using the Name and Channel number specified in the event's keyDirectObject. The format of the keyDirectObject must include the name and channel number separated by a colon ( "Name:Channel" ).

 

GetChatRoomName ( 'CtNm' ) - The Get Chat Room Name event returns the name of the currenly open chat room. Returns an empty response if there is not a chat room open.

 

ShowUsersOnline ( 'UsOL' ) - The Show Users Online event tells TeleFinder to display its List of Users Online.

 

SendInstantMessage ( 'SdIM' ) - Send an Instant Message to a specified user. Actual delivery of the message is not guaranteed.. The user name of the recipient and the text of the message should be in the keyDirectParameter, no other parameters are used.

The keyDirectParameter must include the recipients name and message separated by a colon ( "User Name:Message" ).

 

SendChatMessage ( 'SdCM' ) - Send a message to the currently open Chat Room. If no Chat Room is open, do nothing. The text of the message should be in the keyDirectParameter, no other parameters are used.

 

RegisterAsIMFilter ( 'FLIM' ) - The Register as IM Filter events registers the sending application as the Instant Message Filter. Any existing filtering application is replaced by this event.

The filtering application will receive the following Filter events.

FilterDisplayInstantMessage ( 'Fdim' ) - Prior to displaying an Instant Message, the Filtering application is sent the Filter Display Instant Message containing the following paramters.
keyIMFromUser ( 'IMFr' ) - The name of the user sending the Instant Message.

keyInstantMessageData ( 'imdt' ) - The content of the Instant Message.

keyMyLoginName ( 'MyNm') - The receiving user's login name.

The Filtering Application should return true (non-zero) to show the message, false (zero) in the keyDirectParamter of the reply to discard the message

FilterInstantMessage ( 'Flim' ) - The Filter Instant Message event includes the same message components as FilterDisplayInstantMessage. The Filtering Application can optionally return text as a reply to the messsage in the event's keyDirectParameter.

FilterMyInstantMessage ( 'Fmim' ) - The Filter My Instant Message gives the Filtering Application an opportunity to change the text in your outgoing instant messages. The event contains the following parameters.

keyInstantMessageData ( 'imdt' ) - The content of the Instant Message.

keyMyLoginName ( 'MyNm') - The sending user's login name.

 

RemoveIMFilter ( 'FLIS' ) - Unregisters the Filtering Application.

 

RegisterAsChatFilter ( 'Flcm' ) - The Register as Chat Filter Event registers the sending application as the Chat Room Filter. Any existing filtering application is replaced by this event.

The filtering application will receive the following Filter events.

FilterDisplayChatMessage ( 'Fdcm' )- Prior to displaying a Chat Room Message, the Filtering application is sent the Filter Display Chat Message containing the following paramters.
keyIMFromUser ( 'IMFr' ) - The name of the user sending the message to the Chat Room.

keyChatChannel ( 'Chch' ) - The channel number the message was sent to.

keyInstantMessageData ( 'imdt' ) - The content of the Instant Message.

keyMyLoginName ( 'MyNm') - The receiving user's login name.

The Filtering Application should return true (non-zero) to show the message, false (zero) in the keyDirectParamter of the reply to discard the message

FilterChatMessage ( 'Flcm' ) - - The Filter Chat Message event includes the same message components as FilterDisplayChatMessage. The Filtering Application can optionally return text as a reply to the messsage in the event's keyDirectParameter.

FilterMyChatMessage ( 'Flmm' )- The Filter My Chat Message gives the Filtering Application an opportunity to change the text in your outgoing messages to chat rooms. The event contains the following parameters.

keyInstantMessageData ( 'imdt' ) - The content of the Instant Message.

keyMyLoginName ( 'MyNm') - The sending user's login name.

keyChatChannel ( 'ChCh' ) - The channel number the message is being sent to.

FilterOpenChatRoom ( 'Focr' ) - The Filter Open Chat Room event notifies the Filtering Application that a Chat Room is opening. The Filtering Application can optionally return text that will be sent as a message to the room. The event contains the following parameters.

keyChatChannel ( 'ChCh' ) - The channel number being opened.

keyChatChannelRoomName ( 'Chnm' ) - The name of the room being opened.

keyMyLoginName ( 'MyNm') - The sending user's login name.

FilterCloseChatRoom ( 'Fccr' ) - The Filter Close Chat Room event notifies the Filtering Application that a Chat Room is closing. Any data returned by Filtering Application is ignored. The event contains the following parameters.

keyChatChannel ( 'ChCh' ) - The channel number being opened.

keyMyLoginName ( 'MyNm') - The sending user's login name.

FilterUserEnterChatRoom ( 'Fecr' ) - The Filter User Enter Chat Room event notifies the Filtering Application that a user has entered the Chat Room. The Filtering Application can optionally return text that will be sent as a message to the room. The event contains the following parameters.

keyIMFromUser ( 'IMFr' ) - The name of the user entering the Chat Room.

keyMyLoginName ( 'MyNm') - The user's login name.

keyChatChannell ( 'ChCh' ) - The channel number being entered.

FilterUserLeaveChatRoom ( 'Flcr' )- The Filter User Leave Chat Room event notifies the Filtering Application that a user has exited the Chat Room. The Filtering Application can optionally return text that will be sent as a message to the room. The event contains the following parameters.

keyIMFromUser ( 'IMFr' ) - The name of the user exiting the Chat Room.

keyMyLoginName ( 'MyNm') - The user's login name.

keyChatChannell ( 'ChCh' ) - The Room's channel number.

 

RemoveChatFilter ( 'FlcS' ) - Unregisters the Filtering Application.