diff options
author | Emil Ivov <emcho@jitsi.org> | 2006-03-24 20:26:31 +0000 |
---|---|---|
committer | Emil Ivov <emcho@jitsi.org> | 2006-03-24 20:26:31 +0000 |
commit | 006e96e97c595ac404580784fbb59ee31e5507c6 (patch) | |
tree | 70c9b40d6a2c152b33772a4c305adfc2d90552ff /test/net/java/sip/communicator/slick/protocol/icq/IcqTesterAgent.java | |
parent | f94860ab4692c0499229743bd8af382c6a756cb8 (diff) | |
download | jitsi-006e96e97c595ac404580784fbb59ee31e5507c6.zip jitsi-006e96e97c595ac404580784fbb59ee31e5507c6.tar.gz jitsi-006e96e97c595ac404580784fbb59ee31e5507c6.tar.bz2 |
added methods that allow us testing the typing notifications functionality
Diffstat (limited to 'test/net/java/sip/communicator/slick/protocol/icq/IcqTesterAgent.java')
-rw-r--r-- | test/net/java/sip/communicator/slick/protocol/icq/IcqTesterAgent.java | 52 |
1 files changed, 39 insertions, 13 deletions
diff --git a/test/net/java/sip/communicator/slick/protocol/icq/IcqTesterAgent.java b/test/net/java/sip/communicator/slick/protocol/icq/IcqTesterAgent.java index 4d6189c..2e24ddd 100644 --- a/test/net/java/sip/communicator/slick/protocol/icq/IcqTesterAgent.java +++ b/test/net/java/sip/communicator/slick/protocol/icq/IcqTesterAgent.java @@ -19,7 +19,6 @@ import net.kano.joustsim.trust.*; import net.kano.joscar.snaccmd.loc.*; import net.kano.joscar.snac.*; import net.kano.joscar.flapcmd.*; -import net.kano.joscar.snaccmd.buddy.*; import net.kano.joscar.snaccmd.conn.*; import net.kano.joustsim.oscar.oscar.service.ssi.*; import net.kano.joscar.snaccmd.error.*; @@ -242,6 +241,44 @@ public class IcqTesterAgent } /** + * Adds a typing listener that would receive joust sim based on typing + * notifications received from <tt>buddy</tt> + * @param buddy the screenname of the buddy that we'd like to receive + * notifications from. + * @param l the <tt>ConversationListener</tt> (which also needs to be a + * TypingListener) that would be registered for typing notifications + * @throws ClassCastException if <tt>l</tt> is only an instance of + * <tt>ConversationListener</tt> without implementing + * <tt>TypingListener</tt> + */ + public void addTypingStateInfoListenerForBuddy( String buddy, + ConversationListener l) + throws ClassCastException + { + if (! (l instanceof TypingListener)) + throw new ClassCastException( + "In order to receive typing notifications a typing listener " + +"needs to also implement " + TypingListener.class.getName()); + + conn.getIcbmService().getImConversation(new Screenname(buddy)) + .addConversationListener(l); + } + + /** + * Removes <tt>l</tt> so that it won't receive further typing events for + * <tt>buddy</tt>. + * @param buddy the screenname of the buddy that we'd like to stop receiving + * notifications from. + * @param l the <tt>ConversationListener</tt> to remove + */ + public void removeTypingStateInfoListenerForBuddy( String buddy, + ConversationListener l) + { + conn.getIcbmService().getImConversation(new Screenname(buddy)) + .removeConversationListener(l); + } + + /** * Tries to find the buddy with screenname screenname in the given buddy * list * @param list the BuddyList where to look for the buddy @@ -712,9 +749,7 @@ public class IcqTesterAgent } } - - -//------------- other utility stuff that is not really very user --------------- +//------------- other utility stuff that is not really very used --------------- private class BuddyListener implements BuddyServiceListener{ public void gotBuddyStatus(BuddyService service, Screenname buddy, FullUserInfo info) @@ -837,15 +872,6 @@ public class IcqTesterAgent } - /** - * returns the first icq message received after calling this method - * @return asdf - */ -// public String receiveMessage() -// { -// return null; -// } - private class RetroListener implements BuddyListLayoutListener, GroupListener { |