ClearspaceMUCTranscriptEvent.java 3.47 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
/**
 * Copyright (C) 2004-2009 Jive Software. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

17 18 19 20 21 22 23 24 25
package org.jivesoftware.openfire.clearspace;

import org.xmpp.packet.JID;

/**
 * A MUC event that is intended to be recorded in a transcript for a group chat room in Clearspace.
 *
 * @author Armando Jagucki
 */
26
public class ClearspaceMUCTranscriptEvent {
27 28
    public Type type;
    public long timestamp;
29
    public String content;
30 31

    public JID roomJID;
32
    public JID user;
33

34
    public static ClearspaceMUCTranscriptEvent roomDestroyed(JID roomJID, long timestamp) {
35 36 37
        ClearspaceMUCTranscriptEvent event = new ClearspaceMUCTranscriptEvent();
        event.type = Type.roomDestroyed;
        event.roomJID = roomJID;
38
        event.timestamp = timestamp;
39 40 41
        return event;
    }

42
    public static ClearspaceMUCTranscriptEvent occupantJoined(JID roomJID, JID user, long timestamp) {
43 44 45 46
        ClearspaceMUCTranscriptEvent event = new ClearspaceMUCTranscriptEvent();
        event.type = Type.occupantJoined;
        event.roomJID = roomJID;
        event.user = user;
47
        event.timestamp = timestamp;
48 49 50
        return event;
    }

51
    public static ClearspaceMUCTranscriptEvent occupantLeft(JID roomJID, JID user, long timestamp) {
52 53 54 55
        ClearspaceMUCTranscriptEvent event = new ClearspaceMUCTranscriptEvent();
        event.type = Type.occupantLeft;
        event.roomJID = roomJID;
        event.user = user;
56
        event.timestamp = timestamp;
57 58 59
        return event;
    }

60
    public static ClearspaceMUCTranscriptEvent messageReceived(JID roomJID, JID user, String body,
61
                                                                   long timestamp) {
62
        ClearspaceMUCTranscriptEvent event = new ClearspaceMUCTranscriptEvent();
63
        event.type = Type.messageReceived;
64 65
        event.roomJID = roomJID;
        event.user = user;
66
        event.content = body;
67
        event.timestamp = timestamp;
68 69 70
        return event;
    }

71 72 73 74 75 76 77 78 79
    public static ClearspaceMUCTranscriptEvent roomSubjectChanged(JID roomJID, JID user, String newSubject,
                                                                  long timestamp) {
        ClearspaceMUCTranscriptEvent event = new ClearspaceMUCTranscriptEvent();
        event.type = Type.roomSubjectChanged;
        event.roomJID = roomJID;
        event.user = user;
        event.content = newSubject;
        event.timestamp = timestamp;
        return event;
80 81
    }

82
    public static enum Type {
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
        /**
         * Event triggered when a room was destroyed.
         */
        roomDestroyed,
        /**
         * Event triggered when a new occupant joins a room.
         */
        occupantJoined,
        /**
         * Event triggered when an occupant left a room.
         */
        occupantLeft,
        /**
         * Event triggered when a room occupant sent a message to a room.
         */
98 99 100 101 102
        messageReceived,
        /**
         * Event triggered when a room's subject has changed.
         */
        roomSubjectChanged
103 104
    }
}