1 22 23 package org.jivesoftware.smackx.muc; 24 25 import java.util.Date ; 26 27 import org.jivesoftware.smackx.packet.MUCInitialPresence; 28 29 48 public class DiscussionHistory { 49 50 private int maxChars = -1; 51 private int maxStanzas = -1; 52 private int seconds = -1; 53 private Date since; 54 55 60 public int getMaxChars() { 61 return maxChars; 62 } 63 64 69 public int getMaxStanzas() { 70 return maxStanzas; 71 } 72 73 80 public int getSeconds() { 81 return seconds; 82 } 83 84 91 public Date getSince() { 92 return since; 93 } 94 95 100 public void setMaxChars(int maxChars) { 101 this.maxChars = maxChars; 102 } 103 104 109 public void setMaxStanzas(int maxStanzas) { 110 this.maxStanzas = maxStanzas; 111 } 112 113 121 public void setSeconds(int seconds) { 122 this.seconds = seconds; 123 } 124 125 132 public void setSince(Date since) { 133 this.since = since; 134 } 135 136 141 private boolean isConfigured() { 142 return maxChars > -1 || maxStanzas > -1 || seconds > -1 || since != null; 143 } 144 145 152 MUCInitialPresence.History getMUCHistory() { 153 if (!isConfigured()) { 155 return null; 156 } 157 158 MUCInitialPresence.History mucHistory = new MUCInitialPresence.History(); 159 if (maxChars > -1) { 160 mucHistory.setMaxChars(maxChars); 161 } 162 if (maxStanzas > -1) { 163 mucHistory.setMaxStanzas(maxStanzas); 164 } 165 if (seconds > -1) { 166 mucHistory.setSeconds(seconds); 167 } 168 if (since != null) { 169 mucHistory.setSince(since); 170 } 171 return mucHistory; 172 } 173 } 174 | Popular Tags |