org.walluck.oscar.handlers
Class ChatHandler

java.lang.Object
  extended by org.walluck.oscar.handlers.SNACHandler
      extended by org.walluck.oscar.handlers.ChatHandler

public class ChatHandler
extends SNACHandler

Family 0x000e - Routines for the Chat service.

Since:
1.0
Version:
1.0
Author:
David Walluck
See Also:
SNACHandler

Constructor Summary
ChatHandler()
          Family 0x000e.
 
Method Summary
 void handleSNAC(AIMSession sess, SNACHandler handler, AIMFrame frame, SNAC snac, AIMInputStream buffer)
          Handles incoming SNAC's.
 void join(AIMSession sess, AIMConnection conn, int exchange, String name, int instance)
          Join a chat room.
 void leaveRoom(AIMSession sess, String name)
          Leave a chat room.
 void sendIM(AIMSession sess, AIMConnection conn, int flags, String msg)
          Subtype 0x0005 - Send a chat message.
 
Methods inherited from class org.walluck.oscar.handlers.SNACHandler
getFamily, getVersion, setFamily, setVersion
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChatHandler

public ChatHandler()
Family 0x000e.

Method Detail

join

public void join(AIMSession sess,
                 AIMConnection conn,
                 int exchange,
                 String name,
                 int instance)
          throws IOException
Join a chat room. This is the first step to joining an already created room. It's basically a Service Request for family 0x000e, with a little added on to specify the exchange and room name.

Parameters:
sess - the oscar session
conn - the chat connection for this session
exchange - the exchange
name - the room name
instance - the instance
Throws:
IOException - if an error occurs

leaveRoom

public void leaveRoom(AIMSession sess,
                      String name)
Leave a chat room.

Parameters:
sess - the oscar session
name - the name of the room to leave

sendIM

public void sendIM(AIMSession sess,
                   AIMConnection conn,
                   int flags,
                   String msg)
            throws IOException
Subtype 0x0005 - Send a chat message.

Unlike gaim, this has been converted to use TLVChain's.

Possible chat flags:

AIM_CHATFLAGS_NOREFLECT
Unset the flag that requests messages should be sent to their sender.
AIM_CHATFLAGS_AWAY
Mark the message as an autoresponse (Note that WinAIM does not honor this, and displays the message as normal.)

Parameters:
sess - the oscar session
conn - the chat conenction for this session
flags - the chat flags
msg - the message
Throws:
IOException - if an error occurs

handleSNAC

public void handleSNAC(AIMSession sess,
                       SNACHandler handler,
                       AIMFrame frame,
                       SNAC snac,
                       AIMInputStream buffer)
                throws IOException
Handles incoming SNAC's.

Specified by:
handleSNAC in class SNACHandler
Parameters:
sess - the oscar session
handler - the handler
frame - the incoming frame
snac - the incoming SNAC
buffer - the incoming buffer
Throws:
IOException - if an error occurs