Search in sources :

Example 1 with PacketRouter

use of org.jivesoftware.openfire.PacketRouter in project Openfire by igniterealtime.

the class LocalMUCRoom method readExternal.

@Override
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
    name = ExternalizableUtil.getInstance().readSafeUTF(in);
    startTime = ExternalizableUtil.getInstance().readLong(in);
    lockedTime = ExternalizableUtil.getInstance().readLong(in);
    ExternalizableUtil.getInstance().readSerializableCollection(in, owners, getClass().getClassLoader());
    ExternalizableUtil.getInstance().readSerializableCollection(in, admins, getClass().getClassLoader());
    ExternalizableUtil.getInstance().readSerializableMap(in, members, getClass().getClassLoader());
    ExternalizableUtil.getInstance().readSerializableCollection(in, outcasts, getClass().getClassLoader());
    naturalLanguageName = ExternalizableUtil.getInstance().readSafeUTF(in);
    description = ExternalizableUtil.getInstance().readSafeUTF(in);
    canOccupantsChangeSubject = ExternalizableUtil.getInstance().readBoolean(in);
    maxUsers = ExternalizableUtil.getInstance().readInt(in);
    rolesToBroadcastPresence.addAll(ExternalizableUtil.getInstance().readStringList(in));
    publicRoom = ExternalizableUtil.getInstance().readBoolean(in);
    persistent = ExternalizableUtil.getInstance().readBoolean(in);
    moderated = ExternalizableUtil.getInstance().readBoolean(in);
    membersOnly = ExternalizableUtil.getInstance().readBoolean(in);
    canOccupantsInvite = ExternalizableUtil.getInstance().readBoolean(in);
    password = ExternalizableUtil.getInstance().readSafeUTF(in);
    canAnyoneDiscoverJID = ExternalizableUtil.getInstance().readBoolean(in);
    logEnabled = ExternalizableUtil.getInstance().readBoolean(in);
    loginRestrictedToNickname = ExternalizableUtil.getInstance().readBoolean(in);
    canChangeNickname = ExternalizableUtil.getInstance().readBoolean(in);
    registrationEnabled = ExternalizableUtil.getInstance().readBoolean(in);
    subject = ExternalizableUtil.getInstance().readSafeUTF(in);
    roomID = ExternalizableUtil.getInstance().readLong(in);
    creationDate = new Date(ExternalizableUtil.getInstance().readLong(in));
    modificationDate = new Date(ExternalizableUtil.getInstance().readLong(in));
    if (ExternalizableUtil.getInstance().readBoolean(in)) {
        emptyDate = new Date(ExternalizableUtil.getInstance().readLong(in));
    }
    savedToDB = ExternalizableUtil.getInstance().readBoolean(in);
    String subdomain = ExternalizableUtil.getInstance().readSafeUTF(in);
    mucService = XMPPServer.getInstance().getMultiUserChatManager().getMultiUserChatService(subdomain);
    if (mucService == null)
        throw new IllegalArgumentException("MUC service not found for subdomain: " + subdomain);
    roomHistory = new MUCRoomHistory(this, new HistoryStrategy(mucService.getHistoryStrategy()));
    PacketRouter packetRouter = XMPPServer.getInstance().getPacketRouter();
    this.iqOwnerHandler = new IQOwnerHandler(this, packetRouter);
    this.iqAdminHandler = new IQAdminHandler(this, packetRouter);
    router = packetRouter;
}
Also used : PacketRouter(org.jivesoftware.openfire.PacketRouter) MUCRoomHistory(org.jivesoftware.openfire.muc.MUCRoomHistory) Date(java.util.Date) HistoryStrategy(org.jivesoftware.openfire.muc.HistoryStrategy)

Example 2 with PacketRouter

use of org.jivesoftware.openfire.PacketRouter in project Openfire by igniterealtime.

the class MainInterceptor method presencePush.

/**
	 * Just pushes a available presence, we need this for GAJIM Client as it does not push available presence after
	 * registering We also wait a little so after register transport is on users roster. Really didnt wanted this here
	 * but doesnt really belong anywhere else
	 * 
	 * @param to
	 * @param from
	 * @param delay MS until the job should be done
	 */
private void presencePush(final JID to, final JID from, int delay) {
    TimerTask pushPresenceTask = new TimerTask() {

        @Override
        public void run() {
            PacketRouter router = server.getPacketRouter();
            Packet presence = new Presence();
            presence.setTo(to);
            presence.setFrom(from);
            router.route(presence);
        }
    };
    Timer timer = new Timer();
    timer.schedule(pushPresenceTask, delay);
}
Also used : Packet(org.xmpp.packet.Packet) TimerTask(java.util.TimerTask) Timer(java.util.Timer) PacketRouter(org.jivesoftware.openfire.PacketRouter) Presence(org.xmpp.packet.Presence)

Aggregations

PacketRouter (org.jivesoftware.openfire.PacketRouter)2 Date (java.util.Date)1 Timer (java.util.Timer)1 TimerTask (java.util.TimerTask)1 HistoryStrategy (org.jivesoftware.openfire.muc.HistoryStrategy)1 MUCRoomHistory (org.jivesoftware.openfire.muc.MUCRoomHistory)1 Packet (org.xmpp.packet.Packet)1 Presence (org.xmpp.packet.Presence)1