PresenceSubscribeHandler.java 20.7 KB
Newer Older
Matt Tucker's avatar
Matt Tucker committed
1 2 3 4 5
/**
 * $RCSfile$
 * $Revision$
 * $Date$
 *
Matt Tucker's avatar
Matt Tucker committed
6
 * Copyright (C) 2004 Jive Software. All rights reserved.
Matt Tucker's avatar
Matt Tucker committed
7
 *
Matt Tucker's avatar
Matt Tucker committed
8 9
 * This software is published under the terms of the GNU Public License (GPL),
 * a copy of which is included in this distribution.
Matt Tucker's avatar
Matt Tucker committed
10
 */
Matt Tucker's avatar
Matt Tucker committed
11

Matt Tucker's avatar
Matt Tucker committed
12 13 14
package org.jivesoftware.messenger.handler;

import org.jivesoftware.messenger.*;
15
import org.jivesoftware.messenger.container.BasicModule;
Matt Tucker's avatar
Matt Tucker committed
16 17
import org.jivesoftware.messenger.roster.Roster;
import org.jivesoftware.messenger.roster.RosterItem;
18 19 20 21 22
import org.jivesoftware.messenger.user.UserAlreadyExistsException;
import org.jivesoftware.messenger.user.UserNotFoundException;
import org.jivesoftware.util.CacheManager;
import org.jivesoftware.util.LocaleUtils;
import org.jivesoftware.util.Log;
Matt Tucker's avatar
Matt Tucker committed
23
import org.xmpp.packet.JID;
24
import org.xmpp.packet.Packet;
25
import org.xmpp.packet.PacketError;
26
import org.xmpp.packet.Presence;
Matt Tucker's avatar
Matt Tucker committed
27

Matt Tucker's avatar
Matt Tucker committed
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
import java.util.Hashtable;
import java.util.Map;

/**
 * Implements the presence protocol. Clients use this protocol to
 * update presence and roster information.
 * <p/>
 * The handler must properly detect the presence type, update the user's roster,
 * and inform presence subscribers of the session's updated presence
 * status. Presence serves many purposes in Jabber so this handler will
 * likely be the most complex of all handlers in the server.
 * <p/>
 * There are four basic types of presence updates:
 * <ul>
 * <li>Simple presence updates - addressed to the server (or to address), these updates
 * are properly addressed by the server, and multicast to
 * interested subscribers on the user's roster. An empty, missing,
 * or "unavailable" type attribute indicates a simple update (there
 * is no "available" type although it should be accepted by the server.
 * <li>Directed presence updates - addressed to particular jabber entities,
 * these presence updates are properly addressed and directly delivered
 * to the entity without broadcast to roster subscribers. Any update type
 * is possible except those reserved for subscription requests.
 * <li>Subscription requests - these updates request presence subscription
 * status changes. Such requests always affect the roster.  The server must:
 * <ul>
 * <li>update the roster with the proper subscriber info
 * <li>push the roster changes to the user
 * <li>forward the update to the correct parties.
 * </ul>
 * The valid types include "subscribe", "subscribed", "unsubscribed",
 * and "unsubscribe".
60
 * <li>XMPPServer probes - Provides a mechanism for servers to query the presence
Matt Tucker's avatar
Matt Tucker committed
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
 * status of users on another server. This allows users to immediately
 * know the presence status of users when they come online rather than way
 * for a presence update broadcast from the other server or tracking them
 * as they are received.  Requires S2S capabilities.
 * </ul>
 * <p/>
 * <h2>Warning</h2>
 * There should be a way of determining whether a session has
 * authorization to access this feature. I'm not sure it is a good
 * idea to do authorization in each handler. It would be nice if
 * the framework could assert authorization policies across channels.
 *
 * @author Iain Shigeoka
 */
public class PresenceSubscribeHandler extends BasicModule implements ChannelHandler {

77 78 79
    private RoutingTable routingTable;
    private XMPPServer localServer;
    private PacketDeliverer deliverer;
80
    private PresenceManager presenceManager;
81

Matt Tucker's avatar
Matt Tucker committed
82 83 84 85
    public PresenceSubscribeHandler() {
        super("Presence subscription handler");
    }

86
    public void process(Packet xmppPacket) throws PacketException {
Matt Tucker's avatar
Matt Tucker committed
87 88
        Presence presence = (Presence)xmppPacket;
        try {
Matt Tucker's avatar
Matt Tucker committed
89 90 91
            JID senderJID = presence.getFrom();
            JID recipientJID = presence.getTo();
            Presence.Type type = presence.getType();
92
            try {
93 94 95 96
                Roster senderRoster = getRoster(senderJID);
                boolean senderSubChanged = false;
                if (senderRoster != null) {
                    senderSubChanged = manageSub(recipientJID, true, type, senderRoster);
97
                }
98 99 100 101
                Roster recipientRoster = getRoster(recipientJID);
                boolean recipientSubChanged = false;
                if (recipientRoster != null) {
                    recipientSubChanged = manageSub(senderJID, false, type, recipientRoster);
102
                }
103

104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122
                // Do not forward the packet to the recipient if the presence is of type subscribed
                // and the recipient user has not changed its subscription state.
                if (!(type == Presence.Type.subscribed && recipientRoster != null &&
                        !recipientSubChanged)) {
                    // Try to obtain a handler for the packet based on the routes. If the handler is
                    // a module, the module will be able to handle the packet. If the handler is a
                    // Session the packet will be routed to the client. If a route cannot be found
                    // then the packet will be delivered based on its recipient and sender.
                    ChannelHandler handler = routingTable.getRoute(recipientJID);
                    Presence presenteToSend = presence.createCopy();
                    // Stamp the presence with the user's bare JID as the 'from' address
                    presenteToSend.setFrom(senderJID.toBareJID());
                    handler.process(presenteToSend);

                    if (type == Presence.Type.subscribed) {
                        // Send the presence of the local user to the remote user. The remote user
                        // subscribed to the presence of the local user and the local user accepted
                        presenceManager.probePresence(recipientJID, senderJID);
                    }
123
                }
124 125

                if (type == Presence.Type.unsubscribed) {
126 127 128 129
                    // Send unavailable presence from all of the local user's available resources
                    // to the remote user
                    presenceManager.sendUnavailableFromSessions(recipientJID, senderJID);
                }
Matt Tucker's avatar
Matt Tucker committed
130
            }
131
            catch (NoSuchRouteException e) {
Matt Tucker's avatar
Matt Tucker committed
132
                deliverer.deliver(presence.createCopy());
Matt Tucker's avatar
Matt Tucker committed
133
            }
134 135 136 137 138 139 140 141
            catch (SharedGroupException e) {
                Presence result = presence.createCopy();
                JID sender = result.getFrom();
                result.setFrom(presence.getTo());
                result.setTo(sender);
                result.setError(PacketError.Condition.not_acceptable);
                deliverer.deliver(result);
            }
Matt Tucker's avatar
Matt Tucker committed
142 143 144 145 146 147 148 149 150 151 152 153
        }
        catch (Exception e) {
            Log.error(LocaleUtils.getLocalizedString("admin.error"), e);
        }
    }

    /**
     * <p>Obtain the roster for the given address or null if the address doesn't have a roster.</p>
     *
     * @param address The address to check
     * @return The roster or null if the address is not managed on the server
     */
Matt Tucker's avatar
Matt Tucker committed
154
    private Roster getRoster(JID address) {
155
        String username = null;
Matt Tucker's avatar
Matt Tucker committed
156
        Roster roster = null;
157 158
        if (localServer.isLocal(address) && address.getNode() != null &&
                !"".equals(address.getNode())) {
Matt Tucker's avatar
Matt Tucker committed
159
            username = address.getNode();
160 161 162
            // Check for a cached roster:
            roster = (Roster)CacheManager.getCache("username2roster").get(username);
            if (roster == null) {
163 164 165 166 167 168 169 170
                synchronized(address.toString().intern()) {
                    roster = (Roster)CacheManager.getCache("username2roster").get(username);
                    if (roster == null) {
                        // Not in cache so load a new one:
                        roster = new Roster(username);
                        CacheManager.getCache("username2roster").put(username, roster);
                    }
                }
Matt Tucker's avatar
Matt Tucker committed
171 172 173 174 175 176 177 178 179 180 181 182 183
            }
        }
        return roster;
    }

    /**
     * Manage the subscription request. This method retrieves a user's roster
     * and updates it's state, storing any changes made, and updating the roster
     * owner if changes occured.
     *
     * @param target    The roster target's jid (the item's jid to be changed)
     * @param isSending True if the request is being sent by the owner
     * @param type      The subscription change type (subscribe, unsubscribe, etc.)
184
     * @return true if the subscription state has changed.
Matt Tucker's avatar
Matt Tucker committed
185
     */
186
    private boolean manageSub(JID target, boolean isSending, Presence.Type type, Roster roster)
187
            throws UserAlreadyExistsException, SharedGroupException
188
    {
189 190 191 192
        RosterItem item = null;
        RosterItem.AskType oldAsk = null;
        RosterItem.SubType oldSub = null;
        RosterItem.RecvType oldRecv = null;
Matt Tucker's avatar
Matt Tucker committed
193 194 195 196 197 198 199
        try {
            if (roster.isRosterItem(target)) {
                item = roster.getRosterItem(target);
            }
            else {
                item = roster.createRosterItem(target);
            }
200 201 202 203 204 205 206 207 208 209 210
            // Get a snapshot of the item state
            oldAsk = item.getAskStatus();
            oldSub = item.getSubStatus();
            oldRecv = item.getRecvStatus();
            // Update the item state based in the received presence type
            updateState(item, type, isSending);
            // Update the roster IF the item state has changed
            if (oldAsk != item.getAskStatus() || oldSub != item.getSubStatus() ||
                    oldRecv != item.getRecvStatus()) {
                roster.updateRosterItem(item);
            }
Matt Tucker's avatar
Matt Tucker committed
211 212 213 214 215
        }
        catch (UserNotFoundException e) {
            // Should be there because we just checked that it's an item
            Log.error(LocaleUtils.getLocalizedString("admin.error"), e);
        }
216
        return oldSub != item.getSubStatus();
Matt Tucker's avatar
Matt Tucker committed
217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244
    }

    /**
     * <p>The transition state table.</p>
     * <p>The root 'old state' transition table is a Map of RosterItem.SubType keys to match
     * to the old state of the item. Each key returns a Map containing the next
     * transition table. Transitions are defined as:</p>
     * <ul>
     * <li>'send/receive' table: Lookup whether this updates was sent or received: obtain 'action' table - key: Presence.Type subcribe action, value: Map (transition table).</li>
     * <li>'new state' table: the changed item values</li>
     * </ul>
     */
    private static Hashtable stateTable = new Hashtable();

    static {
        Hashtable subrTable;
        Hashtable subsTable;
        Hashtable sr;

        sr = new Hashtable();
        subrTable = new Hashtable();
        subsTable = new Hashtable();
        sr.put("recv", subrTable);
        sr.put("send", subsTable);
        stateTable.put(RosterItem.SUB_NONE, sr);
        // Item wishes to subscribe from owner
        // Set flag and update roster if this is a new state, this is the normal way to begin
        // a roster subscription negotiation.
Matt Tucker's avatar
Matt Tucker committed
245
        subrTable.put(Presence.Type.subscribe, new Change(RosterItem.RECV_SUBSCRIBE, null, null)); // no transition
Matt Tucker's avatar
Matt Tucker committed
246 247
        // Item granted subscription to owner
        // The item's state immediately goes from NONE to TO and ask is reset
Matt Tucker's avatar
Matt Tucker committed
248
        subrTable.put(Presence.Type.subscribed, new Change(null, RosterItem.SUB_TO, RosterItem.ASK_NONE));
Matt Tucker's avatar
Matt Tucker committed
249 250
        // Item wishes to unsubscribe from owner
        // This makes no sense, there is no subscription to remove
Matt Tucker's avatar
Matt Tucker committed
251
        subrTable.put(Presence.Type.unsubscribe, new Change(null, null, null));
Matt Tucker's avatar
Matt Tucker committed
252 253
        // Owner has subscription to item revoked
        // Valid response if item requested subscription and we're denying request
Matt Tucker's avatar
Matt Tucker committed
254
        subrTable.put(Presence.Type.unsubscribed, new Change(null, null, RosterItem.ASK_NONE));
Matt Tucker's avatar
Matt Tucker committed
255 256
        // Owner asking to subscribe to item this is the normal way to begin
        // a roster subscription negotiation.
Matt Tucker's avatar
Matt Tucker committed
257
        subsTable.put(Presence.Type.subscribe, new Change(null, null, RosterItem.ASK_SUBSCRIBE));
Matt Tucker's avatar
Matt Tucker committed
258
        // Item granted a subscription from owner
Matt Tucker's avatar
Matt Tucker committed
259
        subsTable.put(Presence.Type.subscribed, new Change(RosterItem.RECV_NONE, RosterItem.SUB_FROM, null));
Matt Tucker's avatar
Matt Tucker committed
260 261
        // Owner asking to unsubscribe to item
        // This makes no sense (there is no subscription to unsubscribe from)
Matt Tucker's avatar
Matt Tucker committed
262
        subsTable.put(Presence.Type.unsubscribe, new Change(null, null, null));
Matt Tucker's avatar
Matt Tucker committed
263 264
        // Item has subscription from owner revoked
        // Valid response if item requested subscription and we're denying request
Matt Tucker's avatar
Matt Tucker committed
265
        subsTable.put(Presence.Type.unsubscribed, new Change(RosterItem.RECV_NONE, null, null));
Matt Tucker's avatar
Matt Tucker committed
266 267 268 269 270 271 272 273 274 275

        sr = new Hashtable();
        subrTable = new Hashtable();
        subsTable = new Hashtable();
        sr.put("recv", subrTable);
        sr.put("send", subsTable);
        stateTable.put(RosterItem.SUB_FROM, sr);
        // Owner asking to subscribe to item
        // Set flag and update roster if this is a new state, this is the normal way to begin
        // a mutual roster subscription negotiation.
Matt Tucker's avatar
Matt Tucker committed
276
        subsTable.put(Presence.Type.subscribe, new Change(null, null, RosterItem.ASK_SUBSCRIBE));
Matt Tucker's avatar
Matt Tucker committed
277 278 279
        // Item granted a subscription from owner
        // This may be necessary if the recipient didn't get an earlier subscribed grant
        // or as a denial of an unsubscribe request
Matt Tucker's avatar
Matt Tucker committed
280
        subsTable.put(Presence.Type.subscribed, new Change(RosterItem.RECV_NONE, null, null));
Matt Tucker's avatar
Matt Tucker committed
281 282
        // Owner asking to unsubscribe to item
        // This makes no sense (there is no subscription to unsubscribe from)
283
        subsTable.put(Presence.Type.unsubscribe, new Change(null, RosterItem.SUB_NONE, null));
Matt Tucker's avatar
Matt Tucker committed
284 285
        // Item has subscription from owner revoked
        // Immediately transition to NONE state
Matt Tucker's avatar
Matt Tucker committed
286
        subsTable.put(Presence.Type.unsubscribed, new Change(RosterItem.RECV_NONE, RosterItem.SUB_NONE, null));
Matt Tucker's avatar
Matt Tucker committed
287 288 289 290
        // Item wishes to subscribe from owner
        // Item already has a subscription so only interesting if item had requested unsubscribe
        // Set flag and update roster if this is a new state, this is the normal way to begin
        // a mutual roster subscription negotiation.
Matt Tucker's avatar
Matt Tucker committed
291
        subrTable.put(Presence.Type.subscribe, new Change(RosterItem.RECV_NONE, null, null));
Matt Tucker's avatar
Matt Tucker committed
292 293
        // Item granted subscription to owner
        // The item's state immediately goes from FROM to BOTH and ask is reset
Matt Tucker's avatar
Matt Tucker committed
294
        subrTable.put(Presence.Type.subscribed, new Change(null, RosterItem.SUB_BOTH, RosterItem.ASK_NONE));
Matt Tucker's avatar
Matt Tucker committed
295 296
        // Item wishes to unsubscribe from owner
        // This is the normal mechanism of removing subscription
297
        subrTable.put(Presence.Type.unsubscribe, new Change(RosterItem.RECV_UNSUBSCRIBE, RosterItem.SUB_NONE, null));
Matt Tucker's avatar
Matt Tucker committed
298 299
        // Owner has subscription to item revoked
        // Valid response if owner requested subscription and item is denying request
Matt Tucker's avatar
Matt Tucker committed
300
        subrTable.put(Presence.Type.unsubscribed, new Change(null, null, RosterItem.ASK_NONE));
Matt Tucker's avatar
Matt Tucker committed
301 302 303 304 305 306 307 308 309

        sr = new Hashtable();
        subrTable = new Hashtable();
        subsTable = new Hashtable();
        sr.put("recv", subrTable);
        sr.put("send", subsTable);
        stateTable.put(RosterItem.SUB_TO, sr);
        // Owner asking to subscribe to item
        // We're already subscribed, may be trying to unset a unsub request
Matt Tucker's avatar
Matt Tucker committed
310
        subsTable.put(Presence.Type.subscribe, new Change(null, null, RosterItem.ASK_NONE));
Matt Tucker's avatar
Matt Tucker committed
311 312
        // Item granted a subscription from owner
        // Sets mutual subscription
Matt Tucker's avatar
Matt Tucker committed
313
        subsTable.put(Presence.Type.subscribed, new Change(RosterItem.RECV_NONE, RosterItem.SUB_BOTH, null));
Matt Tucker's avatar
Matt Tucker committed
314 315
        // Owner asking to unsubscribe to item
        // Normal method of removing subscription
316
        subsTable.put(Presence.Type.unsubscribe, new Change(null, RosterItem.SUB_NONE, RosterItem.ASK_UNSUBSCRIBE));
Matt Tucker's avatar
Matt Tucker committed
317 318 319
        // Item has subscription from owner revoked
        // No subscription to unsub, makes sense if denying subscription request or for
        // situations where the original unsubscribed got lost
Matt Tucker's avatar
Matt Tucker committed
320
        subsTable.put(Presence.Type.unsubscribed, new Change(RosterItem.RECV_NONE, null, null));
Matt Tucker's avatar
Matt Tucker committed
321 322
        // Item wishes to subscribe from owner
        // This is the normal way to negotiate a mutual subscription
Matt Tucker's avatar
Matt Tucker committed
323
        subrTable.put(Presence.Type.subscribe, new Change(RosterItem.RECV_SUBSCRIBE, null, null));
Matt Tucker's avatar
Matt Tucker committed
324 325
        // Item granted subscription to owner
        // Owner already subscribed to item, could be a unsub denial or a lost packet
Matt Tucker's avatar
Matt Tucker committed
326
        subrTable.put(Presence.Type.subscribed, new Change(null, null, RosterItem.ASK_NONE));
Matt Tucker's avatar
Matt Tucker committed
327 328
        // Item wishes to unsubscribe from owner
        // There is no subscription. May be trying to cancel earlier subscribe request.
329
        subrTable.put(Presence.Type.unsubscribe, new Change(RosterItem.RECV_NONE, RosterItem.SUB_NONE, null));
Matt Tucker's avatar
Matt Tucker committed
330 331
        // Owner has subscription to item revoked
        // Setting subscription to none
Matt Tucker's avatar
Matt Tucker committed
332
        subrTable.put(Presence.Type.unsubscribed, new Change(null, RosterItem.SUB_NONE, RosterItem.ASK_NONE));
Matt Tucker's avatar
Matt Tucker committed
333 334 335 336 337 338 339 340 341

        sr = new Hashtable();
        subrTable = new Hashtable();
        subsTable = new Hashtable();
        sr.put("recv", subrTable);
        sr.put("send", subsTable);
        stateTable.put(RosterItem.SUB_BOTH, sr);
        // Owner asking to subscribe to item
        // Makes sense if trying to cancel previous unsub request
Matt Tucker's avatar
Matt Tucker committed
342
        subsTable.put(Presence.Type.subscribe, new Change(null, null, RosterItem.ASK_NONE));
Matt Tucker's avatar
Matt Tucker committed
343 344 345
        // Item granted a subscription from owner
        // This may be necessary if the recipient didn't get an earlier subscribed grant
        // or as a denial of an unsubscribe request
Matt Tucker's avatar
Matt Tucker committed
346
        subsTable.put(Presence.Type.subscribed, new Change(RosterItem.RECV_NONE, null, null));
Matt Tucker's avatar
Matt Tucker committed
347 348
        // Owner asking to unsubscribe to item
        // Set flags
349
        subsTable.put(Presence.Type.unsubscribe, new Change(null, RosterItem.SUB_FROM, RosterItem.ASK_UNSUBSCRIBE));
Matt Tucker's avatar
Matt Tucker committed
350 351
        // Item has subscription from owner revoked
        // Immediately transition them to TO state
Matt Tucker's avatar
Matt Tucker committed
352
        subsTable.put(Presence.Type.unsubscribed, new Change(RosterItem.RECV_NONE, RosterItem.SUB_TO, null));
Matt Tucker's avatar
Matt Tucker committed
353 354 355 356
        // Item wishes to subscribe to owner
        // Item already has a subscription so only interesting if item had requested unsubscribe
        // Set flag and update roster if this is a new state, this is the normal way to begin
        // a mutual roster subscription negotiation.
Matt Tucker's avatar
Matt Tucker committed
357
        subrTable.put(Presence.Type.subscribe, new Change(RosterItem.RECV_NONE, null, null));
Matt Tucker's avatar
Matt Tucker committed
358 359
        // Item granted subscription to owner
        // Redundant unless denying unsub request
Matt Tucker's avatar
Matt Tucker committed
360
        subrTable.put(Presence.Type.subscribed, new Change(null, null, RosterItem.ASK_NONE));
Matt Tucker's avatar
Matt Tucker committed
361 362
        // Item wishes to unsubscribe from owner
        // This is the normal mechanism of removing subscription
363
        subrTable.put(Presence.Type.unsubscribe, new Change(RosterItem.RECV_UNSUBSCRIBE, RosterItem.SUB_TO, null));
Matt Tucker's avatar
Matt Tucker committed
364 365
        // Owner has subscription to item revoked
        // Immediately downgrade state to FROM
Matt Tucker's avatar
Matt Tucker committed
366
        subrTable.put(Presence.Type.unsubscribed, new Change(RosterItem.RECV_NONE, RosterItem.SUB_FROM, RosterItem.ASK_NONE));
Matt Tucker's avatar
Matt Tucker committed
367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399
    }

    /**
     * <p>Indicate a state change.</p>
     * <p>Use nulls to indicate fields that should not be changed.</p>
     */
    private static class Change {
        public Change(RosterItem.RecvType recv, RosterItem.SubType sub, RosterItem.AskType ask) {
            newRecv = recv;
            newSub = sub;
            newAsk = ask;
        }

        public RosterItem.RecvType newRecv;
        public RosterItem.SubType newSub;
        public RosterItem.AskType newAsk;
    }

    /**
     * Determine and call the update method based on the item's subscription state.
     * The method also turns the action and sending status into an integer code
     * for easier processing (switch statements).
     * <p/>
     * Code relies on states being in numerical order without skipping.
     * In addition, the receive states must parallel the send states
     * so that (send state X) + STATE_RECV_SUBSCRIBE == (receive state X)
     * where X is subscribe, subscribed, etc.
     * </p>
     *
     * @param item      The item to be updated
     * @param action    The new state change request
     * @param isSending True if the roster owner of the item is sending the new state change request
     */
400
    private static void updateState(RosterItem item, Presence.Type action, boolean isSending) {
Matt Tucker's avatar
Matt Tucker committed
401 402 403
        Map srTable = (Map)stateTable.get(item.getSubStatus());
        Map changeTable = (Map)srTable.get(isSending ? "send" : "recv");
        Change change = (Change)changeTable.get(action);
404 405
        boolean modified = false;
        if (change.newAsk != null && change.newAsk != item.getAskStatus()) {
Matt Tucker's avatar
Matt Tucker committed
406 407
            item.setAskStatus(change.newAsk);
        }
408
        if (change.newSub != null && change.newSub != item.getSubStatus()) {
Matt Tucker's avatar
Matt Tucker committed
409
            item.setSubStatus(change.newSub);
410
            modified = true;
Matt Tucker's avatar
Matt Tucker committed
411
        }
412
        if (change.newRecv != null && change.newRecv != item.getRecvStatus()) {
Matt Tucker's avatar
Matt Tucker committed
413 414 415 416
            item.setRecvStatus(change.newRecv);
        }
    }

417 418 419 420 421
    public void initialize(XMPPServer server) {
        super.initialize(server);
        localServer = server;
        routingTable = server.getRoutingTable();
        deliverer = server.getPacketDeliverer();
422
        presenceManager = server.getPresenceManager();
Matt Tucker's avatar
Matt Tucker committed
423 424
    }
}