diff options
author | Mili Verma <mili.verma@isode.com> | 2012-01-06 15:00:55 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2012-01-09 15:54:52 (GMT) |
commit | cc760bfd15caadb56bfef477cb54dc94c25f7fa7 (patch) | |
tree | 05f5918b97488b05ca1266c0644a3874adb98129 /src/com/isode/stroke/eventloop | |
parent | 12b1d667965556002ea0fd300a71bcdf57634e90 (diff) | |
download | stroke-cc760bfd15caadb56bfef477cb54dc94c25f7fa7.zip stroke-cc760bfd15caadb56bfef477cb54dc94c25f7fa7.tar.bz2 |
Port Adhoc commands to Stroke
This patch ports the Adhoc commands from Swiften to Stroke.
It also ports their unit tests.
Test-information:
Unit tests pass.
MLC able to use the ad-hoc command fine.
Diffstat (limited to 'src/com/isode/stroke/eventloop')
-rw-r--r-- | src/com/isode/stroke/eventloop/DummyEventLoop.java | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/com/isode/stroke/eventloop/DummyEventLoop.java b/src/com/isode/stroke/eventloop/DummyEventLoop.java new file mode 100644 index 0000000..47f8928 --- /dev/null +++ b/src/com/isode/stroke/eventloop/DummyEventLoop.java @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2012 Isode Limited, London, England. + * All rights reserved. + */ +/* + * Copyright (c) 2010 Remko Tronçon + * All rights reserved. + */ + +package com.isode.stroke.eventloop; + +import java.util.Vector; + +/** + * Dummy event loop that can be used for tests, etc. + * + * @since 15.2 + */ +public class DummyEventLoop extends EventLoop { + private Vector<Event> events_ = new Vector<Event>(); + + /** + * Constructor + */ + public DummyEventLoop() { + } + + /** + * Process pending events. + */ + public void processEvents() { + while (!events_.isEmpty()) { + handleEvent(events_.get(0)); + events_.remove(0); + } + } + + /** + * @return TRUE if there are any pending events. + */ + public boolean hasEvents() { + return !events_.isEmpty(); + } + + public void post(Event event) { + events_.add(event); + } +} |