blob: 6b52a14812fbbae1c1310a4f993b299f355cd216 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
/*
* Copyright (c) 2012, Isode Limited, London, England.
* All rights reserved.
*/
/*
* Copyright (c) 2010, Kevin Smith
* All rights reserved.
*/
package com.isode.stroke.elements;
import java.util.Date;
/**
* Class representing a MUC Payload
*
*/
public class MUCPayload extends Payload {
private int maxChars_;
private int maxStanzas_;
private int seconds_;
private Date since_;
private String password_;
/**
* Constructor
*/
public MUCPayload() {
maxChars_ = -1;
maxStanzas_ = -1;
seconds_ = -1;
}
/**
* Set the maximum number of characters where character count is the characters of the
* complete XML stanzas, not only their XML character data
* @param maxChars maximum number of characters (positive value)
*/
public void setMaxChars(int maxChars) {
maxChars_ = maxChars;
}
/**
* Set the maximum number of stanzas which means limiting the total number of messages
* @param maxStanzas maximum number of stanzas
*/
public void setMaxStanzas(int maxStanzas) {
maxStanzas_ = maxStanzas;
}
/**
* Set the number of seconds which means send only the messages received in the
* last "X" seconds.
* @param seconds number of seconds
*/
public void setSeconds(int seconds) {
seconds_ = seconds;
}
/**
* Set the date which means send only the messages received since the
* date/time specified
* @param since date-time, should not be null
*/
public void setSince(Date since) {
since_ = (Date)since.clone();
}
/**
* Set the MUC password
* @param password password, can be null
*/
public void setPassword(String password) {
password_ = password;
}
/**
* Get the maximum number of characters
* @return max characters
*/
public int getMaxChars() {
return maxChars_;
}
/**
* Get the maximum number of stanzas
* @return max stanzas
*/
public int getMaxStanzas(){
return maxStanzas_;
}
/**
* Get the number of seconds
* @return number of seconds
*/
public int getSeconds() {
return seconds_;
}
/**
* Get the password
* @return password, can be null if not set
*/
public String getPassword() {
return password_;
}
/**
* Get the date specified to limit the stazas
* @return date, ca be null if not set
*/
public Date getSince() {
if(since_ == null) {
return null;
}
return (Date)since_.clone();
}
}
|