1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2025-09-10 18:59:41 +02:00

New logic for delivering messages without a thread ID to a Chat object. This improves compatibility with clients that don't support thread ID. Also some misc formatting updates.

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@2779 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Matt Tucker 2005-09-05 20:00:45 +00:00 committed by matt
parent afd7e6f2d6
commit 06b7a0eacc
6 changed files with 148 additions and 93 deletions

View file

@ -165,7 +165,9 @@ class PacketReader {
}
}
}
catch (InterruptedException ie) { }
catch (InterruptedException ie) {
// Ignore.
}
if (connectionID == null) {
throw new XMPPException("Connection failed. No response from server.");
}
@ -229,7 +231,6 @@ class PacketReader {
* Process listeners.
*/
private void processListeners() {
boolean processedPacket = false;
while (!done) {
synchronized (listeners) {
if (listeners.size() > 0) {
@ -240,7 +241,7 @@ class PacketReader {
}
}
}
processedPacket = false;
boolean processedPacket = false;
int size = listeners.size();
for (int i=0; i<size; i++) {
ListenerWrapper wrapper = (ListenerWrapper)listeners.get(i);
@ -250,9 +251,14 @@ class PacketReader {
}
if (!processedPacket) {
try {
Thread.sleep(100);
// Wait until more packets are ready to be processed.
synchronized (listenerThread) {
listenerThread.wait();
}
}
catch (InterruptedException ie) {
// Ignore.
}
catch (InterruptedException ie) { }
}
}
}
@ -376,6 +382,11 @@ class PacketReader {
collector.processPacket(packet);
}
}
// Notify the listener thread that packets are waiting.
synchronized (listenerThread) {
listenerThread.notifyAll();
}
}
private void parseFeatures(XmlPullParser parser) throws Exception {
@ -584,9 +595,8 @@ class PacketReader {
RosterPacket.ItemType type = RosterPacket.ItemType.fromString(subscription);
item.setItemType(type);
}
if (parser.getName().equals("group")) {
String groupName = parser.nextText();
item.addGroupName(groupName);
if (parser.getName().equals("group") && item!= null) {
item.addGroupName(parser.nextText());
}
}
else if (eventType == XmlPullParser.END_TAG) {