Current Chat Connection

HI,

I am trying to write a plugin that runs in the current ChatWindow i.e. when a client wants to chat 1-to-1 to another user, they will have this plugin open. However can anyone tell me how to get the “Chat” object (or equivalent) for that very ChatWindow session without having to specify the other persons user id?

Cheers,

John.

Hey cookiemonster,

I’'m guessing you are talking about Spark since your previous post was regarding a plugin for Spark.

You could register a ChatRoomListener that would listen when a chatroom is opened.

Here is an example.

ChatRoomListener chatRoomListener = new ChatRoomListenerAdapter(
    // called when a chatroom is opened obviously.
    public void chatRoomOpened(ChatRoom chatRoom) {
        // Do what you wanted to with the chatRoom instance
    }
);
SparkManager.getChatManager().addChatRoomListener(chatRoomListener);

Hope it helps in some way.

_Aaron