1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-27 00:32:07 +01:00
git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@2373 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Matt Tucker 2004-08-17 07:48:43 +00:00 committed by mtucker
parent ec686f15ef
commit b1150c862d

View file

@ -58,9 +58,6 @@ import org.jivesoftware.smack.*;
import org.jivesoftware.smack.filter.*; import org.jivesoftware.smack.filter.*;
import org.jivesoftware.smack.packet.*; import org.jivesoftware.smack.packet.*;
import org.jivesoftware.smack.util.StringUtils; import org.jivesoftware.smack.util.StringUtils;
import org.jivesoftware.smackx.GroupChatInvitation;
import org.jivesoftware.smackx.workgroup.*;
import org.jivesoftware.smackx.workgroup.packet.*; import org.jivesoftware.smackx.workgroup.packet.*;
/** /**
@ -460,31 +457,15 @@ public class WorkgroupSession {
* *
* @param invitationListener the invitation listener. * @param invitationListener the invitation listener.
*/ */
public void addInvitationListener(InvitationListener invitationListener) { public void addInvitationListener(PacketListener invitationListener) {
synchronized(invitationListeners) { // TODO
if (!invitationListeners.contains(invitationListener)) {
invitationListeners.add(invitationListener);
}
}
}
/**
* Removes an invitation listener.
*
* @param invitationListener the invitation listener.
*/
public void removeInvitationListener(InvitationListener invitationListener) {
synchronized(invitationListeners) {
offerListeners.remove(invitationListener);
}
} }
private void fireOfferRequestEvent(OfferRequestProvider.OfferRequestPacket requestPacket) { private void fireOfferRequestEvent(OfferRequestProvider.OfferRequestPacket requestPacket) {
Offer offer = new Offer(this.connection, this, requestPacket.getUserID(), Offer offer = new Offer(this.connection, this, requestPacket.getUserID(),
this.getWorkgroupName(), this.getWorkgroupName(), new Date((new Date()).getTime()
new Date((new Date()).getTime() + (requestPacket.getTimeout() * 1000)), requestPacket.getSessionID(),
+ (requestPacket.getTimeout() * 1000)), requestPacket.getMetaData());
requestPacket.getSessionID(), requestPacket.getMetaData());
synchronized (offerListeners) { synchronized (offerListeners) {
for (Iterator i=offerListeners.iterator(); i.hasNext(); ) { for (Iterator i=offerListeners.iterator(); i.hasNext(); ) {
@ -496,8 +477,7 @@ public class WorkgroupSession {
private void fireOfferRevokeEvent(OfferRevokeProvider.OfferRevokePacket orp) { private void fireOfferRevokeEvent(OfferRevokeProvider.OfferRevokePacket orp) {
RevokedOffer revokedOffer = new RevokedOffer(orp.getUserID(), this.getWorkgroupName(), RevokedOffer revokedOffer = new RevokedOffer(orp.getUserID(), this.getWorkgroupName(),
orp.getSessionID(), orp.getReason(), orp.getSessionID(), orp.getReason(), new Date());
new Date());
synchronized (offerListeners) { synchronized (offerListeners) {
for (Iterator i=offerListeners.iterator(); i.hasNext(); ) { for (Iterator i=offerListeners.iterator(); i.hasNext(); ) {
@ -507,20 +487,6 @@ public class WorkgroupSession {
} }
} }
private void fireInvitationEvent(String groupChatJID, String sessionID, String body,
String from, Map metaData)
{
Invitation invitation = new Invitation(connection.getUser(), groupChatJID,
workgroupName, sessionID, body, from, metaData);
synchronized(invitationListeners) {
for (Iterator i=invitationListeners.iterator(); i.hasNext(); ) {
InvitationListener listener = (InvitationListener)i.next();
listener.invitationReceived(invitation);
}
}
}
private void fireQueueUsersEvent(WorkgroupQueue queue, WorkgroupQueue.Status status, private void fireQueueUsersEvent(WorkgroupQueue queue, WorkgroupQueue.Status status,
int averageWaitTime, Date oldestEntry, Set users) int averageWaitTime, Date oldestEntry, Set users)
{ {
@ -649,33 +615,6 @@ public class WorkgroupSession {
return; return;
} }
} }
else if (packet instanceof Message) {
Message message = (Message)packet;
GroupChatInvitation invitation = (GroupChatInvitation)message.getExtension(
GroupChatInvitation.ELEMENT_NAME, GroupChatInvitation.NAMESPACE);
if (invitation != null) {
String roomAddress = invitation.getRoomAddress();
String sessionID = null;
Map metaData = null;
SessionID sessionIDExt = (SessionID)message.getExtension(SessionID.ELEMENT_NAME,
SessionID.NAMESPACE);
if (sessionIDExt != null) {
sessionID = sessionIDExt.getSessionID();
}
MetaData metaDataExt = (MetaData)message.getExtension(MetaData.ELEMENT_NAME,
MetaData.NAMESPACE);
if (metaDataExt != null) {
metaData = metaDataExt.getMetaData();
}
this.fireInvitationEvent(roomAddress, sessionID, message.getBody(),
message.getFrom(), metaData);
}
}
else if (packet instanceof OfferRevokeProvider.OfferRevokePacket) { else if (packet instanceof OfferRevokeProvider.OfferRevokePacket) {
fireOfferRevokeEvent((OfferRevokeProvider.OfferRevokePacket)packet); fireOfferRevokeEvent((OfferRevokeProvider.OfferRevokePacket)packet);
} }