id int32 0 165k | repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1 value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 |
|---|---|---|---|---|---|---|---|---|---|---|---|
26,700 | igniterealtime/Smack | smack-im/src/main/java/org/jivesoftware/smack/chat/ChatManager.java | ChatManager.createChat | public Chat createChat(EntityJid userJID, ChatMessageListener listener) {
return createChat(userJID, null, listener);
} | java | public Chat createChat(EntityJid userJID, ChatMessageListener listener) {
return createChat(userJID, null, listener);
} | [
"public",
"Chat",
"createChat",
"(",
"EntityJid",
"userJID",
",",
"ChatMessageListener",
"listener",
")",
"{",
"return",
"createChat",
"(",
"userJID",
",",
"null",
",",
"listener",
")",
";",
"}"
] | Creates a new chat and returns it.
@param userJID the user this chat is with.
@param listener the optional listener which will listen for new messages from this chat.
@return the created chat. | [
"Creates",
"a",
"new",
"chat",
"and",
"returns",
"it",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-im/src/main/java/org/jivesoftware/smack/chat/ChatManager.java#L235-L237 |
26,701 | igniterealtime/Smack | smack-im/src/main/java/org/jivesoftware/smack/chat/ChatManager.java | ChatManager.createChat | public Chat createChat(EntityJid userJID, String thread, ChatMessageListener listener) {
if (thread == null) {
thread = nextID();
}
Chat chat = threadChats.get(thread);
if (chat != null) {
throw new IllegalArgumentException("ThreadID is already used");
}
chat = createChat(userJID, thread, true);
chat.addMessageListener(listener);
return chat;
} | java | public Chat createChat(EntityJid userJID, String thread, ChatMessageListener listener) {
if (thread == null) {
thread = nextID();
}
Chat chat = threadChats.get(thread);
if (chat != null) {
throw new IllegalArgumentException("ThreadID is already used");
}
chat = createChat(userJID, thread, true);
chat.addMessageListener(listener);
return chat;
} | [
"public",
"Chat",
"createChat",
"(",
"EntityJid",
"userJID",
",",
"String",
"thread",
",",
"ChatMessageListener",
"listener",
")",
"{",
"if",
"(",
"thread",
"==",
"null",
")",
"{",
"thread",
"=",
"nextID",
"(",
")",
";",
"}",
"Chat",
"chat",
"=",
"threadChats",
".",
"get",
"(",
"thread",
")",
";",
"if",
"(",
"chat",
"!=",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"ThreadID is already used\"",
")",
";",
"}",
"chat",
"=",
"createChat",
"(",
"userJID",
",",
"thread",
",",
"true",
")",
";",
"chat",
".",
"addMessageListener",
"(",
"listener",
")",
";",
"return",
"chat",
";",
"}"
] | Creates a new chat using the specified thread ID, then returns it.
@param userJID the jid of the user this chat is with
@param thread the thread of the created chat.
@param listener the optional listener to add to the chat
@return the created chat. | [
"Creates",
"a",
"new",
"chat",
"using",
"the",
"specified",
"thread",
"ID",
"then",
"returns",
"it",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-im/src/main/java/org/jivesoftware/smack/chat/ChatManager.java#L247-L258 |
26,702 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/jiveproperties/JivePropertiesManager.java | JivePropertiesManager.addProperty | public static void addProperty(Stanza packet, String name, Object value) {
JivePropertiesExtension jpe = (JivePropertiesExtension) packet.getExtension(JivePropertiesExtension.NAMESPACE);
if (jpe == null) {
jpe = new JivePropertiesExtension();
packet.addExtension(jpe);
}
jpe.setProperty(name, value);
} | java | public static void addProperty(Stanza packet, String name, Object value) {
JivePropertiesExtension jpe = (JivePropertiesExtension) packet.getExtension(JivePropertiesExtension.NAMESPACE);
if (jpe == null) {
jpe = new JivePropertiesExtension();
packet.addExtension(jpe);
}
jpe.setProperty(name, value);
} | [
"public",
"static",
"void",
"addProperty",
"(",
"Stanza",
"packet",
",",
"String",
"name",
",",
"Object",
"value",
")",
"{",
"JivePropertiesExtension",
"jpe",
"=",
"(",
"JivePropertiesExtension",
")",
"packet",
".",
"getExtension",
"(",
"JivePropertiesExtension",
".",
"NAMESPACE",
")",
";",
"if",
"(",
"jpe",
"==",
"null",
")",
"{",
"jpe",
"=",
"new",
"JivePropertiesExtension",
"(",
")",
";",
"packet",
".",
"addExtension",
"(",
"jpe",
")",
";",
"}",
"jpe",
".",
"setProperty",
"(",
"name",
",",
"value",
")",
";",
"}"
] | Convenience method to add a property to a packet.
@param packet the stanza to add the property to.
@param name the name of the property to add.
@param value the value of the property to add. | [
"Convenience",
"method",
"to",
"add",
"a",
"property",
"to",
"a",
"packet",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/jiveproperties/JivePropertiesManager.java#L58-L65 |
26,703 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/jiveproperties/JivePropertiesManager.java | JivePropertiesManager.getProperty | public static Object getProperty(Stanza packet, String name) {
Object res = null;
JivePropertiesExtension jpe = (JivePropertiesExtension) packet.getExtension(JivePropertiesExtension.NAMESPACE);
if (jpe != null) {
res = jpe.getProperty(name);
}
return res;
} | java | public static Object getProperty(Stanza packet, String name) {
Object res = null;
JivePropertiesExtension jpe = (JivePropertiesExtension) packet.getExtension(JivePropertiesExtension.NAMESPACE);
if (jpe != null) {
res = jpe.getProperty(name);
}
return res;
} | [
"public",
"static",
"Object",
"getProperty",
"(",
"Stanza",
"packet",
",",
"String",
"name",
")",
"{",
"Object",
"res",
"=",
"null",
";",
"JivePropertiesExtension",
"jpe",
"=",
"(",
"JivePropertiesExtension",
")",
"packet",
".",
"getExtension",
"(",
"JivePropertiesExtension",
".",
"NAMESPACE",
")",
";",
"if",
"(",
"jpe",
"!=",
"null",
")",
"{",
"res",
"=",
"jpe",
".",
"getProperty",
"(",
"name",
")",
";",
"}",
"return",
"res",
";",
"}"
] | Convenience method to get a property from a packet. Will return null if the stanza contains
not property with the given name.
@param packet
@param name
@return the property or <tt>null</tt> if none found. | [
"Convenience",
"method",
"to",
"get",
"a",
"property",
"from",
"a",
"packet",
".",
"Will",
"return",
"null",
"if",
"the",
"stanza",
"contains",
"not",
"property",
"with",
"the",
"given",
"name",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/jiveproperties/JivePropertiesManager.java#L75-L82 |
26,704 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/jiveproperties/JivePropertiesManager.java | JivePropertiesManager.getPropertiesNames | public static Collection<String> getPropertiesNames(Stanza packet) {
JivePropertiesExtension jpe = (JivePropertiesExtension) packet.getExtension(JivePropertiesExtension.NAMESPACE);
if (jpe == null) {
return Collections.emptyList();
}
return jpe.getPropertyNames();
} | java | public static Collection<String> getPropertiesNames(Stanza packet) {
JivePropertiesExtension jpe = (JivePropertiesExtension) packet.getExtension(JivePropertiesExtension.NAMESPACE);
if (jpe == null) {
return Collections.emptyList();
}
return jpe.getPropertyNames();
} | [
"public",
"static",
"Collection",
"<",
"String",
">",
"getPropertiesNames",
"(",
"Stanza",
"packet",
")",
"{",
"JivePropertiesExtension",
"jpe",
"=",
"(",
"JivePropertiesExtension",
")",
"packet",
".",
"getExtension",
"(",
"JivePropertiesExtension",
".",
"NAMESPACE",
")",
";",
"if",
"(",
"jpe",
"==",
"null",
")",
"{",
"return",
"Collections",
".",
"emptyList",
"(",
")",
";",
"}",
"return",
"jpe",
".",
"getPropertyNames",
"(",
")",
";",
"}"
] | Return a collection of the names of all properties of the given packet. If the packet
contains no properties extension, then an empty collection will be returned.
@param packet
@return a collection of the names of all properties. | [
"Return",
"a",
"collection",
"of",
"the",
"names",
"of",
"all",
"properties",
"of",
"the",
"given",
"packet",
".",
"If",
"the",
"packet",
"contains",
"no",
"properties",
"extension",
"then",
"an",
"empty",
"collection",
"will",
"be",
"returned",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/jiveproperties/JivePropertiesManager.java#L91-L97 |
26,705 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/jiveproperties/JivePropertiesManager.java | JivePropertiesManager.getProperties | public static Map<String, Object> getProperties(Stanza packet) {
JivePropertiesExtension jpe = (JivePropertiesExtension) packet.getExtension(JivePropertiesExtension.NAMESPACE);
if (jpe == null) {
return Collections.emptyMap();
}
return jpe.getProperties();
} | java | public static Map<String, Object> getProperties(Stanza packet) {
JivePropertiesExtension jpe = (JivePropertiesExtension) packet.getExtension(JivePropertiesExtension.NAMESPACE);
if (jpe == null) {
return Collections.emptyMap();
}
return jpe.getProperties();
} | [
"public",
"static",
"Map",
"<",
"String",
",",
"Object",
">",
"getProperties",
"(",
"Stanza",
"packet",
")",
"{",
"JivePropertiesExtension",
"jpe",
"=",
"(",
"JivePropertiesExtension",
")",
"packet",
".",
"getExtension",
"(",
"JivePropertiesExtension",
".",
"NAMESPACE",
")",
";",
"if",
"(",
"jpe",
"==",
"null",
")",
"{",
"return",
"Collections",
".",
"emptyMap",
"(",
")",
";",
"}",
"return",
"jpe",
".",
"getProperties",
"(",
")",
";",
"}"
] | Return a map of all properties of the given packet. If the stanza contains no properties
extension, an empty map will be returned.
@param packet
@return a map of all properties of the given packet. | [
"Return",
"a",
"map",
"of",
"all",
"properties",
"of",
"the",
"given",
"packet",
".",
"If",
"the",
"stanza",
"contains",
"no",
"properties",
"extension",
"an",
"empty",
"map",
"will",
"be",
"returned",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/jiveproperties/JivePropertiesManager.java#L106-L112 |
26,706 | igniterealtime/Smack | smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/MetaDataProvider.java | MetaDataProvider.parse | @Override
public MetaData parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
Map<String, List<String>> metaData = MetaDataUtils.parseMetaData(parser);
return new MetaData(metaData);
} | java | @Override
public MetaData parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
Map<String, List<String>> metaData = MetaDataUtils.parseMetaData(parser);
return new MetaData(metaData);
} | [
"@",
"Override",
"public",
"MetaData",
"parse",
"(",
"XmlPullParser",
"parser",
",",
"int",
"initialDepth",
",",
"XmlEnvironment",
"xmlEnvironment",
")",
"throws",
"XmlPullParserException",
",",
"IOException",
"{",
"Map",
"<",
"String",
",",
"List",
"<",
"String",
">",
">",
"metaData",
"=",
"MetaDataUtils",
".",
"parseMetaData",
"(",
"parser",
")",
";",
"return",
"new",
"MetaData",
"(",
"metaData",
")",
";",
"}"
] | PacketExtensionProvider implementation.
@throws IOException
@throws XmlPullParserException | [
"PacketExtensionProvider",
"implementation",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/MetaDataProvider.java#L45-L50 |
26,707 | igniterealtime/Smack | smack-core/src/main/java/org/jivesoftware/smack/SynchronizationPoint.java | SynchronizationPoint.sendAndWaitForResponse | public Exception sendAndWaitForResponse(TopLevelStreamElement request) throws NoResponseException,
NotConnectedException, InterruptedException {
assert (state == State.Initial);
connectionLock.lock();
try {
if (request != null) {
if (request instanceof Stanza) {
connection.sendStanza((Stanza) request);
}
else if (request instanceof Nonza) {
connection.sendNonza((Nonza) request);
} else {
throw new IllegalStateException("Unsupported element type");
}
state = State.RequestSent;
}
waitForConditionOrTimeout();
}
finally {
connectionLock.unlock();
}
return checkForResponse();
} | java | public Exception sendAndWaitForResponse(TopLevelStreamElement request) throws NoResponseException,
NotConnectedException, InterruptedException {
assert (state == State.Initial);
connectionLock.lock();
try {
if (request != null) {
if (request instanceof Stanza) {
connection.sendStanza((Stanza) request);
}
else if (request instanceof Nonza) {
connection.sendNonza((Nonza) request);
} else {
throw new IllegalStateException("Unsupported element type");
}
state = State.RequestSent;
}
waitForConditionOrTimeout();
}
finally {
connectionLock.unlock();
}
return checkForResponse();
} | [
"public",
"Exception",
"sendAndWaitForResponse",
"(",
"TopLevelStreamElement",
"request",
")",
"throws",
"NoResponseException",
",",
"NotConnectedException",
",",
"InterruptedException",
"{",
"assert",
"(",
"state",
"==",
"State",
".",
"Initial",
")",
";",
"connectionLock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"if",
"(",
"request",
"!=",
"null",
")",
"{",
"if",
"(",
"request",
"instanceof",
"Stanza",
")",
"{",
"connection",
".",
"sendStanza",
"(",
"(",
"Stanza",
")",
"request",
")",
";",
"}",
"else",
"if",
"(",
"request",
"instanceof",
"Nonza",
")",
"{",
"connection",
".",
"sendNonza",
"(",
"(",
"Nonza",
")",
"request",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Unsupported element type\"",
")",
";",
"}",
"state",
"=",
"State",
".",
"RequestSent",
";",
"}",
"waitForConditionOrTimeout",
"(",
")",
";",
"}",
"finally",
"{",
"connectionLock",
".",
"unlock",
"(",
")",
";",
"}",
"return",
"checkForResponse",
"(",
")",
";",
"}"
] | Send the given top level stream element and wait for a response.
@param request the plain stream element to send.
@throws NoResponseException if no response was received.
@throws NotConnectedException if the connection is not connected.
@throws InterruptedException if the connection is interrupted.
@return <code>null</code> if synchronization point was successful, or the failure Exception. | [
"Send",
"the",
"given",
"top",
"level",
"stream",
"element",
"and",
"wait",
"for",
"a",
"response",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-core/src/main/java/org/jivesoftware/smack/SynchronizationPoint.java#L80-L102 |
26,708 | igniterealtime/Smack | smack-core/src/main/java/org/jivesoftware/smack/SynchronizationPoint.java | SynchronizationPoint.sendAndWaitForResponseOrThrow | public void sendAndWaitForResponseOrThrow(Nonza request) throws E, NoResponseException,
NotConnectedException, InterruptedException, SmackWrappedException {
sendAndWaitForResponse(request);
switch (state) {
case Failure:
throwException();
break;
default:
// Success, do nothing
}
} | java | public void sendAndWaitForResponseOrThrow(Nonza request) throws E, NoResponseException,
NotConnectedException, InterruptedException, SmackWrappedException {
sendAndWaitForResponse(request);
switch (state) {
case Failure:
throwException();
break;
default:
// Success, do nothing
}
} | [
"public",
"void",
"sendAndWaitForResponseOrThrow",
"(",
"Nonza",
"request",
")",
"throws",
"E",
",",
"NoResponseException",
",",
"NotConnectedException",
",",
"InterruptedException",
",",
"SmackWrappedException",
"{",
"sendAndWaitForResponse",
"(",
"request",
")",
";",
"switch",
"(",
"state",
")",
"{",
"case",
"Failure",
":",
"throwException",
"(",
")",
";",
"break",
";",
"default",
":",
"// Success, do nothing",
"}",
"}"
] | Send the given plain stream element and wait for a response.
@param request the plain stream element to send.
@throws E if an failure was reported.
@throws NoResponseException if no response was received.
@throws NotConnectedException if the connection is not connected.
@throws InterruptedException if the connection is interrupted.
@throws SmackWrappedException in case of a wrapped exception; | [
"Send",
"the",
"given",
"plain",
"stream",
"element",
"and",
"wait",
"for",
"a",
"response",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-core/src/main/java/org/jivesoftware/smack/SynchronizationPoint.java#L114-L124 |
26,709 | igniterealtime/Smack | smack-core/src/main/java/org/jivesoftware/smack/SynchronizationPoint.java | SynchronizationPoint.reportSuccess | public void reportSuccess() {
connectionLock.lock();
try {
state = State.Success;
condition.signalAll();
}
finally {
connectionLock.unlock();
}
} | java | public void reportSuccess() {
connectionLock.lock();
try {
state = State.Success;
condition.signalAll();
}
finally {
connectionLock.unlock();
}
} | [
"public",
"void",
"reportSuccess",
"(",
")",
"{",
"connectionLock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"state",
"=",
"State",
".",
"Success",
";",
"condition",
".",
"signalAll",
"(",
")",
";",
"}",
"finally",
"{",
"connectionLock",
".",
"unlock",
"(",
")",
";",
"}",
"}"
] | Report this synchronization point as successful. | [
"Report",
"this",
"synchronization",
"point",
"as",
"successful",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-core/src/main/java/org/jivesoftware/smack/SynchronizationPoint.java#L169-L178 |
26,710 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/privacy/PrivacyListManager.java | PrivacyListManager.getInstanceFor | public static synchronized PrivacyListManager getInstanceFor(XMPPConnection connection) {
PrivacyListManager plm = INSTANCES.get(connection);
if (plm == null) {
plm = new PrivacyListManager(connection);
// Register the new instance and associate it with the connection
INSTANCES.put(connection, plm);
}
return plm;
} | java | public static synchronized PrivacyListManager getInstanceFor(XMPPConnection connection) {
PrivacyListManager plm = INSTANCES.get(connection);
if (plm == null) {
plm = new PrivacyListManager(connection);
// Register the new instance and associate it with the connection
INSTANCES.put(connection, plm);
}
return plm;
} | [
"public",
"static",
"synchronized",
"PrivacyListManager",
"getInstanceFor",
"(",
"XMPPConnection",
"connection",
")",
"{",
"PrivacyListManager",
"plm",
"=",
"INSTANCES",
".",
"get",
"(",
"connection",
")",
";",
"if",
"(",
"plm",
"==",
"null",
")",
"{",
"plm",
"=",
"new",
"PrivacyListManager",
"(",
"connection",
")",
";",
"// Register the new instance and associate it with the connection",
"INSTANCES",
".",
"put",
"(",
"connection",
",",
"plm",
")",
";",
"}",
"return",
"plm",
";",
"}"
] | Returns the PrivacyListManager instance associated with a given XMPPConnection.
@param connection the connection used to look for the proper PrivacyListManager.
@return the PrivacyListManager associated with a given XMPPConnection. | [
"Returns",
"the",
"PrivacyListManager",
"instance",
"associated",
"with",
"a",
"given",
"XMPPConnection",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/privacy/PrivacyListManager.java#L210-L218 |
26,711 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/privacy/PrivacyListManager.java | PrivacyListManager.getActiveListName | public String getActiveListName() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
if (cachedActiveListName != null) {
return cachedActiveListName;
}
return getPrivacyWithListNames().getActiveName();
} | java | public String getActiveListName() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
if (cachedActiveListName != null) {
return cachedActiveListName;
}
return getPrivacyWithListNames().getActiveName();
} | [
"public",
"String",
"getActiveListName",
"(",
")",
"throws",
"NoResponseException",
",",
"XMPPErrorException",
",",
"NotConnectedException",
",",
"InterruptedException",
"{",
"if",
"(",
"cachedActiveListName",
"!=",
"null",
")",
"{",
"return",
"cachedActiveListName",
";",
"}",
"return",
"getPrivacyWithListNames",
"(",
")",
".",
"getActiveName",
"(",
")",
";",
"}"
] | Get the name of the active list.
@return the name of the active list or null if there is none set.
@throws NoResponseException
@throws XMPPErrorException
@throws NotConnectedException
@throws InterruptedException
@since 4.1 | [
"Get",
"the",
"name",
"of",
"the",
"active",
"list",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/privacy/PrivacyListManager.java#L304-L309 |
26,712 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/privacy/PrivacyListManager.java | PrivacyListManager.getDefaultListName | public String getDefaultListName() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
if (cachedDefaultListName != null) {
return cachedDefaultListName;
}
return getPrivacyWithListNames().getDefaultName();
} | java | public String getDefaultListName() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
if (cachedDefaultListName != null) {
return cachedDefaultListName;
}
return getPrivacyWithListNames().getDefaultName();
} | [
"public",
"String",
"getDefaultListName",
"(",
")",
"throws",
"NoResponseException",
",",
"XMPPErrorException",
",",
"NotConnectedException",
",",
"InterruptedException",
"{",
"if",
"(",
"cachedDefaultListName",
"!=",
"null",
")",
"{",
"return",
"cachedDefaultListName",
";",
"}",
"return",
"getPrivacyWithListNames",
"(",
")",
".",
"getDefaultName",
"(",
")",
";",
"}"
] | Get the name of the default list.
@return the name of the default list or null if there is none set.
@throws NoResponseException
@throws XMPPErrorException
@throws NotConnectedException
@throws InterruptedException
@since 4.1 | [
"Get",
"the",
"name",
"of",
"the",
"default",
"list",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/privacy/PrivacyListManager.java#L340-L345 |
26,713 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/privacy/PrivacyListManager.java | PrivacyListManager.getPrivacyLists | public List<PrivacyList> getPrivacyLists() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
Privacy privacyAnswer = getPrivacyWithListNames();
Set<String> names = privacyAnswer.getPrivacyListNames();
List<PrivacyList> lists = new ArrayList<>(names.size());
for (String listName : names) {
boolean isActiveList = listName.equals(privacyAnswer.getActiveName());
boolean isDefaultList = listName.equals(privacyAnswer.getDefaultName());
lists.add(new PrivacyList(isActiveList, isDefaultList, listName,
getPrivacyListItems(listName)));
}
return lists;
} | java | public List<PrivacyList> getPrivacyLists() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
Privacy privacyAnswer = getPrivacyWithListNames();
Set<String> names = privacyAnswer.getPrivacyListNames();
List<PrivacyList> lists = new ArrayList<>(names.size());
for (String listName : names) {
boolean isActiveList = listName.equals(privacyAnswer.getActiveName());
boolean isDefaultList = listName.equals(privacyAnswer.getDefaultName());
lists.add(new PrivacyList(isActiveList, isDefaultList, listName,
getPrivacyListItems(listName)));
}
return lists;
} | [
"public",
"List",
"<",
"PrivacyList",
">",
"getPrivacyLists",
"(",
")",
"throws",
"NoResponseException",
",",
"XMPPErrorException",
",",
"NotConnectedException",
",",
"InterruptedException",
"{",
"Privacy",
"privacyAnswer",
"=",
"getPrivacyWithListNames",
"(",
")",
";",
"Set",
"<",
"String",
">",
"names",
"=",
"privacyAnswer",
".",
"getPrivacyListNames",
"(",
")",
";",
"List",
"<",
"PrivacyList",
">",
"lists",
"=",
"new",
"ArrayList",
"<>",
"(",
"names",
".",
"size",
"(",
")",
")",
";",
"for",
"(",
"String",
"listName",
":",
"names",
")",
"{",
"boolean",
"isActiveList",
"=",
"listName",
".",
"equals",
"(",
"privacyAnswer",
".",
"getActiveName",
"(",
")",
")",
";",
"boolean",
"isDefaultList",
"=",
"listName",
".",
"equals",
"(",
"privacyAnswer",
".",
"getDefaultName",
"(",
")",
")",
";",
"lists",
".",
"add",
"(",
"new",
"PrivacyList",
"(",
"isActiveList",
",",
"isDefaultList",
",",
"listName",
",",
"getPrivacyListItems",
"(",
"listName",
")",
")",
")",
";",
"}",
"return",
"lists",
";",
"}"
] | Answer every privacy list with the allowed and blocked permissions.
@return an array of privacy lists.
@throws XMPPErrorException
@throws NoResponseException
@throws NotConnectedException
@throws InterruptedException | [
"Answer",
"every",
"privacy",
"list",
"with",
"the",
"allowed",
"and",
"blocked",
"permissions",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/privacy/PrivacyListManager.java#L415-L426 |
26,714 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/privacy/PrivacyListManager.java | PrivacyListManager.setActiveListName | public void setActiveListName(String listName) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
// The request of the list is an privacy message with an empty list
Privacy request = new Privacy();
request.setActiveName(listName);
// Send the package to the server
setRequest(request);
} | java | public void setActiveListName(String listName) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
// The request of the list is an privacy message with an empty list
Privacy request = new Privacy();
request.setActiveName(listName);
// Send the package to the server
setRequest(request);
} | [
"public",
"void",
"setActiveListName",
"(",
"String",
"listName",
")",
"throws",
"NoResponseException",
",",
"XMPPErrorException",
",",
"NotConnectedException",
",",
"InterruptedException",
"{",
"// The request of the list is an privacy message with an empty list",
"Privacy",
"request",
"=",
"new",
"Privacy",
"(",
")",
";",
"request",
".",
"setActiveName",
"(",
"listName",
")",
";",
"// Send the package to the server",
"setRequest",
"(",
"request",
")",
";",
"}"
] | Set or change the active list to listName.
@param listName the list name to set as the active one.
@throws XMPPErrorException
@throws NoResponseException
@throws NotConnectedException
@throws InterruptedException | [
"Set",
"or",
"change",
"the",
"active",
"list",
"to",
"listName",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/privacy/PrivacyListManager.java#L437-L444 |
26,715 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/privacy/PrivacyListManager.java | PrivacyListManager.declineActiveList | public void declineActiveList() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
// The request of the list is an privacy message with an empty list
Privacy request = new Privacy();
request.setDeclineActiveList(true);
// Send the package to the server
setRequest(request);
} | java | public void declineActiveList() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
// The request of the list is an privacy message with an empty list
Privacy request = new Privacy();
request.setDeclineActiveList(true);
// Send the package to the server
setRequest(request);
} | [
"public",
"void",
"declineActiveList",
"(",
")",
"throws",
"NoResponseException",
",",
"XMPPErrorException",
",",
"NotConnectedException",
",",
"InterruptedException",
"{",
"// The request of the list is an privacy message with an empty list",
"Privacy",
"request",
"=",
"new",
"Privacy",
"(",
")",
";",
"request",
".",
"setDeclineActiveList",
"(",
"true",
")",
";",
"// Send the package to the server",
"setRequest",
"(",
"request",
")",
";",
"}"
] | Client declines the use of active lists.
@throws XMPPErrorException
@throws NoResponseException
@throws NotConnectedException
@throws InterruptedException | [
"Client",
"declines",
"the",
"use",
"of",
"active",
"lists",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/privacy/PrivacyListManager.java#L453-L460 |
26,716 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/privacy/PrivacyListManager.java | PrivacyListManager.setDefaultListName | public void setDefaultListName(String listName) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
// The request of the list is an privacy message with an empty list
Privacy request = new Privacy();
request.setDefaultName(listName);
// Send the package to the server
setRequest(request);
} | java | public void setDefaultListName(String listName) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
// The request of the list is an privacy message with an empty list
Privacy request = new Privacy();
request.setDefaultName(listName);
// Send the package to the server
setRequest(request);
} | [
"public",
"void",
"setDefaultListName",
"(",
"String",
"listName",
")",
"throws",
"NoResponseException",
",",
"XMPPErrorException",
",",
"NotConnectedException",
",",
"InterruptedException",
"{",
"// The request of the list is an privacy message with an empty list",
"Privacy",
"request",
"=",
"new",
"Privacy",
"(",
")",
";",
"request",
".",
"setDefaultName",
"(",
"listName",
")",
";",
"// Send the package to the server",
"setRequest",
"(",
"request",
")",
";",
"}"
] | Set or change the default list to listName.
@param listName the list name to set as the default one.
@throws XMPPErrorException
@throws NoResponseException
@throws NotConnectedException
@throws InterruptedException | [
"Set",
"or",
"change",
"the",
"default",
"list",
"to",
"listName",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/privacy/PrivacyListManager.java#L471-L478 |
26,717 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/privacy/PrivacyListManager.java | PrivacyListManager.declineDefaultList | public void declineDefaultList() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
// The request of the list is an privacy message with an empty list
Privacy request = new Privacy();
request.setDeclineDefaultList(true);
// Send the package to the server
setRequest(request);
} | java | public void declineDefaultList() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
// The request of the list is an privacy message with an empty list
Privacy request = new Privacy();
request.setDeclineDefaultList(true);
// Send the package to the server
setRequest(request);
} | [
"public",
"void",
"declineDefaultList",
"(",
")",
"throws",
"NoResponseException",
",",
"XMPPErrorException",
",",
"NotConnectedException",
",",
"InterruptedException",
"{",
"// The request of the list is an privacy message with an empty list",
"Privacy",
"request",
"=",
"new",
"Privacy",
"(",
")",
";",
"request",
".",
"setDeclineDefaultList",
"(",
"true",
")",
";",
"// Send the package to the server",
"setRequest",
"(",
"request",
")",
";",
"}"
] | Client declines the use of default lists.
@throws XMPPErrorException
@throws NoResponseException
@throws NotConnectedException
@throws InterruptedException | [
"Client",
"declines",
"the",
"use",
"of",
"default",
"lists",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/privacy/PrivacyListManager.java#L487-L494 |
26,718 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/privacy/PrivacyListManager.java | PrivacyListManager.createPrivacyList | public void createPrivacyList(String listName, List<PrivacyItem> privacyItems) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
updatePrivacyList(listName, privacyItems);
} | java | public void createPrivacyList(String listName, List<PrivacyItem> privacyItems) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
updatePrivacyList(listName, privacyItems);
} | [
"public",
"void",
"createPrivacyList",
"(",
"String",
"listName",
",",
"List",
"<",
"PrivacyItem",
">",
"privacyItems",
")",
"throws",
"NoResponseException",
",",
"XMPPErrorException",
",",
"NotConnectedException",
",",
"InterruptedException",
"{",
"updatePrivacyList",
"(",
"listName",
",",
"privacyItems",
")",
";",
"}"
] | The client has created a new list. It send the new one to the server.
@param listName the list that has changed its content.
@param privacyItems a List with every privacy item in the list.
@throws XMPPErrorException
@throws NoResponseException
@throws NotConnectedException
@throws InterruptedException | [
"The",
"client",
"has",
"created",
"a",
"new",
"list",
".",
"It",
"send",
"the",
"new",
"one",
"to",
"the",
"server",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/privacy/PrivacyListManager.java#L506-L508 |
26,719 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/privacy/PrivacyListManager.java | PrivacyListManager.deletePrivacyList | public void deletePrivacyList(String listName) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
// The request of the list is an privacy message with an empty list
Privacy request = new Privacy();
request.setPrivacyList(listName, new ArrayList<PrivacyItem>());
// Send the package to the server
setRequest(request);
} | java | public void deletePrivacyList(String listName) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
// The request of the list is an privacy message with an empty list
Privacy request = new Privacy();
request.setPrivacyList(listName, new ArrayList<PrivacyItem>());
// Send the package to the server
setRequest(request);
} | [
"public",
"void",
"deletePrivacyList",
"(",
"String",
"listName",
")",
"throws",
"NoResponseException",
",",
"XMPPErrorException",
",",
"NotConnectedException",
",",
"InterruptedException",
"{",
"// The request of the list is an privacy message with an empty list",
"Privacy",
"request",
"=",
"new",
"Privacy",
"(",
")",
";",
"request",
".",
"setPrivacyList",
"(",
"listName",
",",
"new",
"ArrayList",
"<",
"PrivacyItem",
">",
"(",
")",
")",
";",
"// Send the package to the server",
"setRequest",
"(",
"request",
")",
";",
"}"
] | Remove a privacy list.
@param listName the list that has changed its content.
@throws XMPPErrorException
@throws NoResponseException
@throws NotConnectedException
@throws InterruptedException | [
"Remove",
"a",
"privacy",
"list",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/privacy/PrivacyListManager.java#L540-L547 |
26,720 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/bookmarks/BookmarkManager.java | BookmarkManager.getBookmarkedConferences | public List<BookmarkedConference> getBookmarkedConferences() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
retrieveBookmarks();
return Collections.unmodifiableList(bookmarks.getBookmarkedConferences());
} | java | public List<BookmarkedConference> getBookmarkedConferences() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
retrieveBookmarks();
return Collections.unmodifiableList(bookmarks.getBookmarkedConferences());
} | [
"public",
"List",
"<",
"BookmarkedConference",
">",
"getBookmarkedConferences",
"(",
")",
"throws",
"NoResponseException",
",",
"XMPPErrorException",
",",
"NotConnectedException",
",",
"InterruptedException",
"{",
"retrieveBookmarks",
"(",
")",
";",
"return",
"Collections",
".",
"unmodifiableList",
"(",
"bookmarks",
".",
"getBookmarkedConferences",
"(",
")",
")",
";",
"}"
] | Returns all currently bookmarked conferences.
@return returns all currently bookmarked conferences
@throws XMPPErrorException
@throws NoResponseException
@throws NotConnectedException
@throws InterruptedException
@see BookmarkedConference | [
"Returns",
"all",
"currently",
"bookmarked",
"conferences",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/bookmarks/BookmarkManager.java#L96-L99 |
26,721 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/bookmarks/BookmarkManager.java | BookmarkManager.addBookmarkedConference | public void addBookmarkedConference(String name, EntityBareJid jid, boolean isAutoJoin,
Resourcepart nickname, String password) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
retrieveBookmarks();
BookmarkedConference bookmark
= new BookmarkedConference(name, jid, isAutoJoin, nickname, password);
List<BookmarkedConference> conferences = bookmarks.getBookmarkedConferences();
if (conferences.contains(bookmark)) {
BookmarkedConference oldConference = conferences.get(conferences.indexOf(bookmark));
if (oldConference.isShared()) {
throw new IllegalArgumentException("Cannot modify shared bookmark");
}
oldConference.setAutoJoin(isAutoJoin);
oldConference.setName(name);
oldConference.setNickname(nickname);
oldConference.setPassword(password);
}
else {
bookmarks.addBookmarkedConference(bookmark);
}
privateDataManager.setPrivateData(bookmarks);
} | java | public void addBookmarkedConference(String name, EntityBareJid jid, boolean isAutoJoin,
Resourcepart nickname, String password) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
retrieveBookmarks();
BookmarkedConference bookmark
= new BookmarkedConference(name, jid, isAutoJoin, nickname, password);
List<BookmarkedConference> conferences = bookmarks.getBookmarkedConferences();
if (conferences.contains(bookmark)) {
BookmarkedConference oldConference = conferences.get(conferences.indexOf(bookmark));
if (oldConference.isShared()) {
throw new IllegalArgumentException("Cannot modify shared bookmark");
}
oldConference.setAutoJoin(isAutoJoin);
oldConference.setName(name);
oldConference.setNickname(nickname);
oldConference.setPassword(password);
}
else {
bookmarks.addBookmarkedConference(bookmark);
}
privateDataManager.setPrivateData(bookmarks);
} | [
"public",
"void",
"addBookmarkedConference",
"(",
"String",
"name",
",",
"EntityBareJid",
"jid",
",",
"boolean",
"isAutoJoin",
",",
"Resourcepart",
"nickname",
",",
"String",
"password",
")",
"throws",
"NoResponseException",
",",
"XMPPErrorException",
",",
"NotConnectedException",
",",
"InterruptedException",
"{",
"retrieveBookmarks",
"(",
")",
";",
"BookmarkedConference",
"bookmark",
"=",
"new",
"BookmarkedConference",
"(",
"name",
",",
"jid",
",",
"isAutoJoin",
",",
"nickname",
",",
"password",
")",
";",
"List",
"<",
"BookmarkedConference",
">",
"conferences",
"=",
"bookmarks",
".",
"getBookmarkedConferences",
"(",
")",
";",
"if",
"(",
"conferences",
".",
"contains",
"(",
"bookmark",
")",
")",
"{",
"BookmarkedConference",
"oldConference",
"=",
"conferences",
".",
"get",
"(",
"conferences",
".",
"indexOf",
"(",
"bookmark",
")",
")",
";",
"if",
"(",
"oldConference",
".",
"isShared",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Cannot modify shared bookmark\"",
")",
";",
"}",
"oldConference",
".",
"setAutoJoin",
"(",
"isAutoJoin",
")",
";",
"oldConference",
".",
"setName",
"(",
"name",
")",
";",
"oldConference",
".",
"setNickname",
"(",
"nickname",
")",
";",
"oldConference",
".",
"setPassword",
"(",
"password",
")",
";",
"}",
"else",
"{",
"bookmarks",
".",
"addBookmarkedConference",
"(",
"bookmark",
")",
";",
"}",
"privateDataManager",
".",
"setPrivateData",
"(",
"bookmarks",
")",
";",
"}"
] | Adds or updates a conference in the bookmarks.
@param name the name of the conference
@param jid the jid of the conference
@param isAutoJoin whether or not to join this conference automatically on login
@param nickname the nickname to use for the user when joining the conference
@param password the password to use for the user when joining the conference
@throws XMPPErrorException thrown when there is an issue retrieving the current bookmarks from
the server.
@throws NoResponseException if there was no response from the server.
@throws NotConnectedException
@throws InterruptedException | [
"Adds",
"or",
"updates",
"a",
"conference",
"in",
"the",
"bookmarks",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/bookmarks/BookmarkManager.java#L115-L135 |
26,722 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/bookmarks/BookmarkManager.java | BookmarkManager.removeBookmarkedConference | public void removeBookmarkedConference(EntityBareJid jid) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
retrieveBookmarks();
Iterator<BookmarkedConference> it = bookmarks.getBookmarkedConferences().iterator();
while (it.hasNext()) {
BookmarkedConference conference = it.next();
if (conference.getJid().equals(jid)) {
if (conference.isShared()) {
throw new IllegalArgumentException("Conference is shared and can't be removed");
}
it.remove();
privateDataManager.setPrivateData(bookmarks);
return;
}
}
} | java | public void removeBookmarkedConference(EntityBareJid jid) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
retrieveBookmarks();
Iterator<BookmarkedConference> it = bookmarks.getBookmarkedConferences().iterator();
while (it.hasNext()) {
BookmarkedConference conference = it.next();
if (conference.getJid().equals(jid)) {
if (conference.isShared()) {
throw new IllegalArgumentException("Conference is shared and can't be removed");
}
it.remove();
privateDataManager.setPrivateData(bookmarks);
return;
}
}
} | [
"public",
"void",
"removeBookmarkedConference",
"(",
"EntityBareJid",
"jid",
")",
"throws",
"NoResponseException",
",",
"XMPPErrorException",
",",
"NotConnectedException",
",",
"InterruptedException",
"{",
"retrieveBookmarks",
"(",
")",
";",
"Iterator",
"<",
"BookmarkedConference",
">",
"it",
"=",
"bookmarks",
".",
"getBookmarkedConferences",
"(",
")",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"it",
".",
"hasNext",
"(",
")",
")",
"{",
"BookmarkedConference",
"conference",
"=",
"it",
".",
"next",
"(",
")",
";",
"if",
"(",
"conference",
".",
"getJid",
"(",
")",
".",
"equals",
"(",
"jid",
")",
")",
"{",
"if",
"(",
"conference",
".",
"isShared",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Conference is shared and can't be removed\"",
")",
";",
"}",
"it",
".",
"remove",
"(",
")",
";",
"privateDataManager",
".",
"setPrivateData",
"(",
"bookmarks",
")",
";",
"return",
";",
"}",
"}",
"}"
] | Removes a conference from the bookmarks.
@param jid the jid of the conference to be removed.
@throws XMPPErrorException thrown when there is a problem with the connection attempting to
retrieve the bookmarks or persist the bookmarks.
@throws NoResponseException if there was no response from the server.
@throws NotConnectedException
@throws InterruptedException
@throws IllegalArgumentException thrown when the conference being removed is a shared
conference | [
"Removes",
"a",
"conference",
"from",
"the",
"bookmarks",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/bookmarks/BookmarkManager.java#L149-L163 |
26,723 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/bookmarks/BookmarkManager.java | BookmarkManager.getBookmarkedURLs | public List<BookmarkedURL> getBookmarkedURLs() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
retrieveBookmarks();
return Collections.unmodifiableList(bookmarks.getBookmarkedURLS());
} | java | public List<BookmarkedURL> getBookmarkedURLs() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
retrieveBookmarks();
return Collections.unmodifiableList(bookmarks.getBookmarkedURLS());
} | [
"public",
"List",
"<",
"BookmarkedURL",
">",
"getBookmarkedURLs",
"(",
")",
"throws",
"NoResponseException",
",",
"XMPPErrorException",
",",
"NotConnectedException",
",",
"InterruptedException",
"{",
"retrieveBookmarks",
"(",
")",
";",
"return",
"Collections",
".",
"unmodifiableList",
"(",
"bookmarks",
".",
"getBookmarkedURLS",
"(",
")",
")",
";",
"}"
] | Returns an unmodifiable collection of all bookmarked urls.
@return returns an unmodifiable collection of all bookmarked urls.
@throws XMPPErrorException thrown when there is a problem retriving bookmarks from the server.
@throws NoResponseException if there was no response from the server.
@throws NotConnectedException
@throws InterruptedException | [
"Returns",
"an",
"unmodifiable",
"collection",
"of",
"all",
"bookmarked",
"urls",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/bookmarks/BookmarkManager.java#L174-L177 |
26,724 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/bookmarks/BookmarkManager.java | BookmarkManager.addBookmarkedURL | public void addBookmarkedURL(String URL, String name, boolean isRSS) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
retrieveBookmarks();
BookmarkedURL bookmark = new BookmarkedURL(URL, name, isRSS);
List<BookmarkedURL> urls = bookmarks.getBookmarkedURLS();
if (urls.contains(bookmark)) {
BookmarkedURL oldURL = urls.get(urls.indexOf(bookmark));
if (oldURL.isShared()) {
throw new IllegalArgumentException("Cannot modify shared bookmarks");
}
oldURL.setName(name);
oldURL.setRss(isRSS);
}
else {
bookmarks.addBookmarkedURL(bookmark);
}
privateDataManager.setPrivateData(bookmarks);
} | java | public void addBookmarkedURL(String URL, String name, boolean isRSS) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
retrieveBookmarks();
BookmarkedURL bookmark = new BookmarkedURL(URL, name, isRSS);
List<BookmarkedURL> urls = bookmarks.getBookmarkedURLS();
if (urls.contains(bookmark)) {
BookmarkedURL oldURL = urls.get(urls.indexOf(bookmark));
if (oldURL.isShared()) {
throw new IllegalArgumentException("Cannot modify shared bookmarks");
}
oldURL.setName(name);
oldURL.setRss(isRSS);
}
else {
bookmarks.addBookmarkedURL(bookmark);
}
privateDataManager.setPrivateData(bookmarks);
} | [
"public",
"void",
"addBookmarkedURL",
"(",
"String",
"URL",
",",
"String",
"name",
",",
"boolean",
"isRSS",
")",
"throws",
"NoResponseException",
",",
"XMPPErrorException",
",",
"NotConnectedException",
",",
"InterruptedException",
"{",
"retrieveBookmarks",
"(",
")",
";",
"BookmarkedURL",
"bookmark",
"=",
"new",
"BookmarkedURL",
"(",
"URL",
",",
"name",
",",
"isRSS",
")",
";",
"List",
"<",
"BookmarkedURL",
">",
"urls",
"=",
"bookmarks",
".",
"getBookmarkedURLS",
"(",
")",
";",
"if",
"(",
"urls",
".",
"contains",
"(",
"bookmark",
")",
")",
"{",
"BookmarkedURL",
"oldURL",
"=",
"urls",
".",
"get",
"(",
"urls",
".",
"indexOf",
"(",
"bookmark",
")",
")",
";",
"if",
"(",
"oldURL",
".",
"isShared",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Cannot modify shared bookmarks\"",
")",
";",
"}",
"oldURL",
".",
"setName",
"(",
"name",
")",
";",
"oldURL",
".",
"setRss",
"(",
"isRSS",
")",
";",
"}",
"else",
"{",
"bookmarks",
".",
"addBookmarkedURL",
"(",
"bookmark",
")",
";",
"}",
"privateDataManager",
".",
"setPrivateData",
"(",
"bookmarks",
")",
";",
"}"
] | Adds a new url or updates an already existing url in the bookmarks.
@param URL the url of the bookmark
@param name the name of the bookmark
@param isRSS whether or not the url is an rss feed
@throws XMPPErrorException thrown when there is an error retriving or saving bookmarks from or to
the server
@throws NoResponseException if there was no response from the server.
@throws NotConnectedException
@throws InterruptedException | [
"Adds",
"a",
"new",
"url",
"or",
"updates",
"an",
"already",
"existing",
"url",
"in",
"the",
"bookmarks",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/bookmarks/BookmarkManager.java#L191-L207 |
26,725 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/bookmarks/BookmarkManager.java | BookmarkManager.removeBookmarkedURL | public void removeBookmarkedURL(String bookmarkURL) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
retrieveBookmarks();
Iterator<BookmarkedURL> it = bookmarks.getBookmarkedURLS().iterator();
while (it.hasNext()) {
BookmarkedURL bookmark = it.next();
if (bookmark.getURL().equalsIgnoreCase(bookmarkURL)) {
if (bookmark.isShared()) {
throw new IllegalArgumentException("Cannot delete a shared bookmark.");
}
it.remove();
privateDataManager.setPrivateData(bookmarks);
return;
}
}
} | java | public void removeBookmarkedURL(String bookmarkURL) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
retrieveBookmarks();
Iterator<BookmarkedURL> it = bookmarks.getBookmarkedURLS().iterator();
while (it.hasNext()) {
BookmarkedURL bookmark = it.next();
if (bookmark.getURL().equalsIgnoreCase(bookmarkURL)) {
if (bookmark.isShared()) {
throw new IllegalArgumentException("Cannot delete a shared bookmark.");
}
it.remove();
privateDataManager.setPrivateData(bookmarks);
return;
}
}
} | [
"public",
"void",
"removeBookmarkedURL",
"(",
"String",
"bookmarkURL",
")",
"throws",
"NoResponseException",
",",
"XMPPErrorException",
",",
"NotConnectedException",
",",
"InterruptedException",
"{",
"retrieveBookmarks",
"(",
")",
";",
"Iterator",
"<",
"BookmarkedURL",
">",
"it",
"=",
"bookmarks",
".",
"getBookmarkedURLS",
"(",
")",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"it",
".",
"hasNext",
"(",
")",
")",
"{",
"BookmarkedURL",
"bookmark",
"=",
"it",
".",
"next",
"(",
")",
";",
"if",
"(",
"bookmark",
".",
"getURL",
"(",
")",
".",
"equalsIgnoreCase",
"(",
"bookmarkURL",
")",
")",
"{",
"if",
"(",
"bookmark",
".",
"isShared",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Cannot delete a shared bookmark.\"",
")",
";",
"}",
"it",
".",
"remove",
"(",
")",
";",
"privateDataManager",
".",
"setPrivateData",
"(",
"bookmarks",
")",
";",
"return",
";",
"}",
"}",
"}"
] | Removes a url from the bookmarks.
@param bookmarkURL the url of the bookmark to remove
@throws XMPPErrorException thrown if there is an error retriving or saving bookmarks from or to
the server.
@throws NoResponseException if there was no response from the server.
@throws NotConnectedException
@throws InterruptedException | [
"Removes",
"a",
"url",
"from",
"the",
"bookmarks",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/bookmarks/BookmarkManager.java#L219-L233 |
26,726 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ConfigureForm.java | ConfigureForm.setAccessModel | public void setAccessModel(AccessModel accessModel) {
addField(ConfigureNodeFields.access_model, FormField.Type.list_single);
setAnswer(ConfigureNodeFields.access_model.getFieldName(), getListSingle(accessModel.toString()));
} | java | public void setAccessModel(AccessModel accessModel) {
addField(ConfigureNodeFields.access_model, FormField.Type.list_single);
setAnswer(ConfigureNodeFields.access_model.getFieldName(), getListSingle(accessModel.toString()));
} | [
"public",
"void",
"setAccessModel",
"(",
"AccessModel",
"accessModel",
")",
"{",
"addField",
"(",
"ConfigureNodeFields",
".",
"access_model",
",",
"FormField",
".",
"Type",
".",
"list_single",
")",
";",
"setAnswer",
"(",
"ConfigureNodeFields",
".",
"access_model",
".",
"getFieldName",
"(",
")",
",",
"getListSingle",
"(",
"accessModel",
".",
"toString",
"(",
")",
")",
")",
";",
"}"
] | Sets the value of access model.
@param accessModel | [
"Sets",
"the",
"value",
"of",
"access",
"model",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ConfigureForm.java#L88-L91 |
26,727 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ConfigureForm.java | ConfigureForm.setBodyXSLT | public void setBodyXSLT(String bodyXslt) {
addField(ConfigureNodeFields.body_xslt, FormField.Type.text_single);
setAnswer(ConfigureNodeFields.body_xslt.getFieldName(), bodyXslt);
} | java | public void setBodyXSLT(String bodyXslt) {
addField(ConfigureNodeFields.body_xslt, FormField.Type.text_single);
setAnswer(ConfigureNodeFields.body_xslt.getFieldName(), bodyXslt);
} | [
"public",
"void",
"setBodyXSLT",
"(",
"String",
"bodyXslt",
")",
"{",
"addField",
"(",
"ConfigureNodeFields",
".",
"body_xslt",
",",
"FormField",
".",
"Type",
".",
"text_single",
")",
";",
"setAnswer",
"(",
"ConfigureNodeFields",
".",
"body_xslt",
".",
"getFieldName",
"(",
")",
",",
"bodyXslt",
")",
";",
"}"
] | Set the URL of an XSL transformation which can be applied to payloads in order to
generate an appropriate message body element.
@param bodyXslt The URL of an XSL | [
"Set",
"the",
"URL",
"of",
"an",
"XSL",
"transformation",
"which",
"can",
"be",
"applied",
"to",
"payloads",
"in",
"order",
"to",
"generate",
"an",
"appropriate",
"message",
"body",
"element",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ConfigureForm.java#L109-L112 |
26,728 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ConfigureForm.java | ConfigureForm.setChildren | public void setChildren(List<String> children) {
addField(ConfigureNodeFields.children, FormField.Type.text_multi);
setAnswer(ConfigureNodeFields.children.getFieldName(), children);
} | java | public void setChildren(List<String> children) {
addField(ConfigureNodeFields.children, FormField.Type.text_multi);
setAnswer(ConfigureNodeFields.children.getFieldName(), children);
} | [
"public",
"void",
"setChildren",
"(",
"List",
"<",
"String",
">",
"children",
")",
"{",
"addField",
"(",
"ConfigureNodeFields",
".",
"children",
",",
"FormField",
".",
"Type",
".",
"text_multi",
")",
";",
"setAnswer",
"(",
"ConfigureNodeFields",
".",
"children",
".",
"getFieldName",
"(",
")",
",",
"children",
")",
";",
"}"
] | Set the list of child node ids that are associated with a collection node.
@param children | [
"Set",
"the",
"list",
"of",
"child",
"node",
"ids",
"that",
"are",
"associated",
"with",
"a",
"collection",
"node",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ConfigureForm.java#L128-L131 |
26,729 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ConfigureForm.java | ConfigureForm.getChildrenAssociationPolicy | public ChildrenAssociationPolicy getChildrenAssociationPolicy() {
String value = getFieldValue(ConfigureNodeFields.children_association_policy);
if (value == null)
return null;
else
return ChildrenAssociationPolicy.valueOf(value);
} | java | public ChildrenAssociationPolicy getChildrenAssociationPolicy() {
String value = getFieldValue(ConfigureNodeFields.children_association_policy);
if (value == null)
return null;
else
return ChildrenAssociationPolicy.valueOf(value);
} | [
"public",
"ChildrenAssociationPolicy",
"getChildrenAssociationPolicy",
"(",
")",
"{",
"String",
"value",
"=",
"getFieldValue",
"(",
"ConfigureNodeFields",
".",
"children_association_policy",
")",
";",
"if",
"(",
"value",
"==",
"null",
")",
"return",
"null",
";",
"else",
"return",
"ChildrenAssociationPolicy",
".",
"valueOf",
"(",
"value",
")",
";",
"}"
] | Returns the policy that determines who may associate children with the node.
@return The current policy | [
"Returns",
"the",
"policy",
"that",
"determines",
"who",
"may",
"associate",
"children",
"with",
"the",
"node",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ConfigureForm.java#L138-L145 |
26,730 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ConfigureForm.java | ConfigureForm.setChildrenAssociationPolicy | public void setChildrenAssociationPolicy(ChildrenAssociationPolicy policy) {
addField(ConfigureNodeFields.children_association_policy, FormField.Type.list_single);
List<String> values = new ArrayList<>(1);
values.add(policy.toString());
setAnswer(ConfigureNodeFields.children_association_policy.getFieldName(), values);
} | java | public void setChildrenAssociationPolicy(ChildrenAssociationPolicy policy) {
addField(ConfigureNodeFields.children_association_policy, FormField.Type.list_single);
List<String> values = new ArrayList<>(1);
values.add(policy.toString());
setAnswer(ConfigureNodeFields.children_association_policy.getFieldName(), values);
} | [
"public",
"void",
"setChildrenAssociationPolicy",
"(",
"ChildrenAssociationPolicy",
"policy",
")",
"{",
"addField",
"(",
"ConfigureNodeFields",
".",
"children_association_policy",
",",
"FormField",
".",
"Type",
".",
"list_single",
")",
";",
"List",
"<",
"String",
">",
"values",
"=",
"new",
"ArrayList",
"<>",
"(",
"1",
")",
";",
"values",
".",
"add",
"(",
"policy",
".",
"toString",
"(",
")",
")",
";",
"setAnswer",
"(",
"ConfigureNodeFields",
".",
"children_association_policy",
".",
"getFieldName",
"(",
")",
",",
"values",
")",
";",
"}"
] | Sets the policy that determines who may associate children with the node.
@param policy The policy being set | [
"Sets",
"the",
"policy",
"that",
"determines",
"who",
"may",
"associate",
"children",
"with",
"the",
"node",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ConfigureForm.java#L152-L157 |
26,731 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ConfigureForm.java | ConfigureForm.setChildrenMax | public void setChildrenMax(int max) {
addField(ConfigureNodeFields.children_max, FormField.Type.text_single);
setAnswer(ConfigureNodeFields.children_max.getFieldName(), max);
} | java | public void setChildrenMax(int max) {
addField(ConfigureNodeFields.children_max, FormField.Type.text_single);
setAnswer(ConfigureNodeFields.children_max.getFieldName(), max);
} | [
"public",
"void",
"setChildrenMax",
"(",
"int",
"max",
")",
"{",
"addField",
"(",
"ConfigureNodeFields",
".",
"children_max",
",",
"FormField",
".",
"Type",
".",
"text_single",
")",
";",
"setAnswer",
"(",
"ConfigureNodeFields",
".",
"children_max",
".",
"getFieldName",
"(",
")",
",",
"max",
")",
";",
"}"
] | Set the maximum number of child nodes that can be associated with a collection node.
@param max The maximum number of child nodes. | [
"Set",
"the",
"maximum",
"number",
"of",
"child",
"nodes",
"that",
"can",
"be",
"associated",
"with",
"a",
"collection",
"node",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ConfigureForm.java#L196-L199 |
26,732 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ConfigureForm.java | ConfigureForm.setCollection | public void setCollection(String collection) {
addField(ConfigureNodeFields.collection, FormField.Type.text_single);
setAnswer(ConfigureNodeFields.collection.getFieldName(), collection);
} | java | public void setCollection(String collection) {
addField(ConfigureNodeFields.collection, FormField.Type.text_single);
setAnswer(ConfigureNodeFields.collection.getFieldName(), collection);
} | [
"public",
"void",
"setCollection",
"(",
"String",
"collection",
")",
"{",
"addField",
"(",
"ConfigureNodeFields",
".",
"collection",
",",
"FormField",
".",
"Type",
".",
"text_single",
")",
";",
"setAnswer",
"(",
"ConfigureNodeFields",
".",
"collection",
".",
"getFieldName",
"(",
")",
",",
"collection",
")",
";",
"}"
] | Sets the collection node which the node is affiliated with.
@param collection The node id of the collection node | [
"Sets",
"the",
"collection",
"node",
"which",
"the",
"node",
"is",
"affiliated",
"with",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ConfigureForm.java#L215-L218 |
26,733 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ConfigureForm.java | ConfigureForm.setDataformXSLT | public void setDataformXSLT(String url) {
addField(ConfigureNodeFields.dataform_xslt, FormField.Type.text_single);
setAnswer(ConfigureNodeFields.dataform_xslt.getFieldName(), url);
} | java | public void setDataformXSLT(String url) {
addField(ConfigureNodeFields.dataform_xslt, FormField.Type.text_single);
setAnswer(ConfigureNodeFields.dataform_xslt.getFieldName(), url);
} | [
"public",
"void",
"setDataformXSLT",
"(",
"String",
"url",
")",
"{",
"addField",
"(",
"ConfigureNodeFields",
".",
"dataform_xslt",
",",
"FormField",
".",
"Type",
".",
"text_single",
")",
";",
"setAnswer",
"(",
"ConfigureNodeFields",
".",
"dataform_xslt",
".",
"getFieldName",
"(",
")",
",",
"url",
")",
";",
"}"
] | Sets the URL of an XSL transformation which can be applied to the payload
format in order to generate a valid Data Forms result that the client could
display using a generic Data Forms rendering engine.
@param url The URL of an XSL transformation | [
"Sets",
"the",
"URL",
"of",
"an",
"XSL",
"transformation",
"which",
"can",
"be",
"applied",
"to",
"the",
"payload",
"format",
"in",
"order",
"to",
"generate",
"a",
"valid",
"Data",
"Forms",
"result",
"that",
"the",
"client",
"could",
"display",
"using",
"a",
"generic",
"Data",
"Forms",
"rendering",
"engine",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ConfigureForm.java#L238-L241 |
26,734 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ConfigureForm.java | ConfigureForm.setDeliverPayloads | public void setDeliverPayloads(boolean deliver) {
addField(ConfigureNodeFields.deliver_payloads, FormField.Type.bool);
setAnswer(ConfigureNodeFields.deliver_payloads.getFieldName(), deliver);
} | java | public void setDeliverPayloads(boolean deliver) {
addField(ConfigureNodeFields.deliver_payloads, FormField.Type.bool);
setAnswer(ConfigureNodeFields.deliver_payloads.getFieldName(), deliver);
} | [
"public",
"void",
"setDeliverPayloads",
"(",
"boolean",
"deliver",
")",
"{",
"addField",
"(",
"ConfigureNodeFields",
".",
"deliver_payloads",
",",
"FormField",
".",
"Type",
".",
"bool",
")",
";",
"setAnswer",
"(",
"ConfigureNodeFields",
".",
"deliver_payloads",
".",
"getFieldName",
"(",
")",
",",
"deliver",
")",
";",
"}"
] | Sets whether the node will deliver payloads with event notifications.
@param deliver true if the payload will be delivered, false otherwise | [
"Sets",
"whether",
"the",
"node",
"will",
"deliver",
"payloads",
"with",
"event",
"notifications",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ConfigureForm.java#L257-L260 |
26,735 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ConfigureForm.java | ConfigureForm.getItemReply | public ItemReply getItemReply() {
String value = getFieldValue(ConfigureNodeFields.itemreply);
if (value == null)
return null;
else
return ItemReply.valueOf(value);
} | java | public ItemReply getItemReply() {
String value = getFieldValue(ConfigureNodeFields.itemreply);
if (value == null)
return null;
else
return ItemReply.valueOf(value);
} | [
"public",
"ItemReply",
"getItemReply",
"(",
")",
"{",
"String",
"value",
"=",
"getFieldValue",
"(",
"ConfigureNodeFields",
".",
"itemreply",
")",
";",
"if",
"(",
"value",
"==",
"null",
")",
"return",
"null",
";",
"else",
"return",
"ItemReply",
".",
"valueOf",
"(",
"value",
")",
";",
"}"
] | Determines who should get replies to items.
@return Who should get the reply | [
"Determines",
"who",
"should",
"get",
"replies",
"to",
"items",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ConfigureForm.java#L267-L274 |
26,736 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ConfigureForm.java | ConfigureForm.setItemReply | public void setItemReply(ItemReply reply) {
addField(ConfigureNodeFields.itemreply, FormField.Type.list_single);
setAnswer(ConfigureNodeFields.itemreply.getFieldName(), getListSingle(reply.toString()));
} | java | public void setItemReply(ItemReply reply) {
addField(ConfigureNodeFields.itemreply, FormField.Type.list_single);
setAnswer(ConfigureNodeFields.itemreply.getFieldName(), getListSingle(reply.toString()));
} | [
"public",
"void",
"setItemReply",
"(",
"ItemReply",
"reply",
")",
"{",
"addField",
"(",
"ConfigureNodeFields",
".",
"itemreply",
",",
"FormField",
".",
"Type",
".",
"list_single",
")",
";",
"setAnswer",
"(",
"ConfigureNodeFields",
".",
"itemreply",
".",
"getFieldName",
"(",
")",
",",
"getListSingle",
"(",
"reply",
".",
"toString",
"(",
")",
")",
")",
";",
"}"
] | Sets who should get the replies to items.
@param reply Defines who should get the reply | [
"Sets",
"who",
"should",
"get",
"the",
"replies",
"to",
"items",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ConfigureForm.java#L281-L284 |
26,737 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ConfigureForm.java | ConfigureForm.setMaxPayloadSize | public void setMaxPayloadSize(int max) {
addField(ConfigureNodeFields.max_payload_size, FormField.Type.text_single);
setAnswer(ConfigureNodeFields.max_payload_size.getFieldName(), max);
} | java | public void setMaxPayloadSize(int max) {
addField(ConfigureNodeFields.max_payload_size, FormField.Type.text_single);
setAnswer(ConfigureNodeFields.max_payload_size.getFieldName(), max);
} | [
"public",
"void",
"setMaxPayloadSize",
"(",
"int",
"max",
")",
"{",
"addField",
"(",
"ConfigureNodeFields",
".",
"max_payload_size",
",",
"FormField",
".",
"Type",
".",
"text_single",
")",
";",
"setAnswer",
"(",
"ConfigureNodeFields",
".",
"max_payload_size",
".",
"getFieldName",
"(",
")",
",",
"max",
")",
";",
"}"
] | Sets the maximum payload size in bytes.
@param max The maximum payload size | [
"Sets",
"the",
"maximum",
"payload",
"size",
"in",
"bytes",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ConfigureForm.java#L321-L324 |
26,738 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ConfigureForm.java | ConfigureForm.getNodeType | public NodeType getNodeType() {
String value = getFieldValue(ConfigureNodeFields.node_type);
if (value == null)
return null;
else
return NodeType.valueOf(value);
} | java | public NodeType getNodeType() {
String value = getFieldValue(ConfigureNodeFields.node_type);
if (value == null)
return null;
else
return NodeType.valueOf(value);
} | [
"public",
"NodeType",
"getNodeType",
"(",
")",
"{",
"String",
"value",
"=",
"getFieldValue",
"(",
"ConfigureNodeFields",
".",
"node_type",
")",
";",
"if",
"(",
"value",
"==",
"null",
")",
"return",
"null",
";",
"else",
"return",
"NodeType",
".",
"valueOf",
"(",
"value",
")",
";",
"}"
] | Gets the node type.
@return The node type | [
"Gets",
"the",
"node",
"type",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ConfigureForm.java#L331-L338 |
26,739 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ConfigureForm.java | ConfigureForm.setNotifyConfig | public void setNotifyConfig(boolean notify) {
addField(ConfigureNodeFields.notify_config, FormField.Type.bool);
setAnswer(ConfigureNodeFields.notify_config.getFieldName(), notify);
} | java | public void setNotifyConfig(boolean notify) {
addField(ConfigureNodeFields.notify_config, FormField.Type.bool);
setAnswer(ConfigureNodeFields.notify_config.getFieldName(), notify);
} | [
"public",
"void",
"setNotifyConfig",
"(",
"boolean",
"notify",
")",
"{",
"addField",
"(",
"ConfigureNodeFields",
".",
"notify_config",
",",
"FormField",
".",
"Type",
".",
"bool",
")",
";",
"setAnswer",
"(",
"ConfigureNodeFields",
".",
"notify_config",
".",
"getFieldName",
"(",
")",
",",
"notify",
")",
";",
"}"
] | Sets whether subscribers should be notified when the configuration changes.
@param notify true if subscribers should be notified, false otherwise | [
"Sets",
"whether",
"subscribers",
"should",
"be",
"notified",
"when",
"the",
"configuration",
"changes",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ConfigureForm.java#L364-L367 |
26,740 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ConfigureForm.java | ConfigureForm.setNotifyDelete | public void setNotifyDelete(boolean notify) {
addField(ConfigureNodeFields.notify_delete, FormField.Type.bool);
setAnswer(ConfigureNodeFields.notify_delete.getFieldName(), notify);
} | java | public void setNotifyDelete(boolean notify) {
addField(ConfigureNodeFields.notify_delete, FormField.Type.bool);
setAnswer(ConfigureNodeFields.notify_delete.getFieldName(), notify);
} | [
"public",
"void",
"setNotifyDelete",
"(",
"boolean",
"notify",
")",
"{",
"addField",
"(",
"ConfigureNodeFields",
".",
"notify_delete",
",",
"FormField",
".",
"Type",
".",
"bool",
")",
";",
"setAnswer",
"(",
"ConfigureNodeFields",
".",
"notify_delete",
".",
"getFieldName",
"(",
")",
",",
"notify",
")",
";",
"}"
] | Sets whether subscribers should be notified when the node is deleted.
@param notify true if subscribers should be notified, false otherwise | [
"Sets",
"whether",
"subscribers",
"should",
"be",
"notified",
"when",
"the",
"node",
"is",
"deleted",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ConfigureForm.java#L383-L386 |
26,741 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ConfigureForm.java | ConfigureForm.setNotifyRetract | public void setNotifyRetract(boolean notify) {
addField(ConfigureNodeFields.notify_retract, FormField.Type.bool);
setAnswer(ConfigureNodeFields.notify_retract.getFieldName(), notify);
} | java | public void setNotifyRetract(boolean notify) {
addField(ConfigureNodeFields.notify_retract, FormField.Type.bool);
setAnswer(ConfigureNodeFields.notify_retract.getFieldName(), notify);
} | [
"public",
"void",
"setNotifyRetract",
"(",
"boolean",
"notify",
")",
"{",
"addField",
"(",
"ConfigureNodeFields",
".",
"notify_retract",
",",
"FormField",
".",
"Type",
".",
"bool",
")",
";",
"setAnswer",
"(",
"ConfigureNodeFields",
".",
"notify_retract",
".",
"getFieldName",
"(",
")",
",",
"notify",
")",
";",
"}"
] | Sets whether subscribers should be notified when items are deleted
from the node.
@param notify true if subscribers should be notified, false otherwise | [
"Sets",
"whether",
"subscribers",
"should",
"be",
"notified",
"when",
"items",
"are",
"deleted",
"from",
"the",
"node",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ConfigureForm.java#L404-L407 |
26,742 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ConfigureForm.java | ConfigureForm.getNotificationType | public NotificationType getNotificationType() {
String value = getFieldValue(ConfigureNodeFields.notification_type);
if (value == null)
return null;
return NotificationType.valueOf(value);
} | java | public NotificationType getNotificationType() {
String value = getFieldValue(ConfigureNodeFields.notification_type);
if (value == null)
return null;
return NotificationType.valueOf(value);
} | [
"public",
"NotificationType",
"getNotificationType",
"(",
")",
"{",
"String",
"value",
"=",
"getFieldValue",
"(",
"ConfigureNodeFields",
".",
"notification_type",
")",
";",
"if",
"(",
"value",
"==",
"null",
")",
"return",
"null",
";",
"return",
"NotificationType",
".",
"valueOf",
"(",
"value",
")",
";",
"}"
] | Determines the type of notifications which are sent.
@return NotificationType for the node configuration
@since 4.3 | [
"Determines",
"the",
"type",
"of",
"notifications",
"which",
"are",
"sent",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ConfigureForm.java#L415-L420 |
26,743 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ConfigureForm.java | ConfigureForm.setNotificationType | public void setNotificationType(NotificationType notificationType) {
addField(ConfigureNodeFields.notification_type, FormField.Type.list_single);
setAnswer(ConfigureNodeFields.notification_type.getFieldName(), getListSingle(notificationType.toString()));
} | java | public void setNotificationType(NotificationType notificationType) {
addField(ConfigureNodeFields.notification_type, FormField.Type.list_single);
setAnswer(ConfigureNodeFields.notification_type.getFieldName(), getListSingle(notificationType.toString()));
} | [
"public",
"void",
"setNotificationType",
"(",
"NotificationType",
"notificationType",
")",
"{",
"addField",
"(",
"ConfigureNodeFields",
".",
"notification_type",
",",
"FormField",
".",
"Type",
".",
"list_single",
")",
";",
"setAnswer",
"(",
"ConfigureNodeFields",
".",
"notification_type",
".",
"getFieldName",
"(",
")",
",",
"getListSingle",
"(",
"notificationType",
".",
"toString",
"(",
")",
")",
")",
";",
"}"
] | Sets the NotificationType for the node.
@param notificationType The enum representing the possible options
@since 4.3 | [
"Sets",
"the",
"NotificationType",
"for",
"the",
"node",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ConfigureForm.java#L428-L431 |
26,744 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ConfigureForm.java | ConfigureForm.setPersistentItems | public void setPersistentItems(boolean persist) {
addField(ConfigureNodeFields.persist_items, FormField.Type.bool);
setAnswer(ConfigureNodeFields.persist_items.getFieldName(), persist);
} | java | public void setPersistentItems(boolean persist) {
addField(ConfigureNodeFields.persist_items, FormField.Type.bool);
setAnswer(ConfigureNodeFields.persist_items.getFieldName(), persist);
} | [
"public",
"void",
"setPersistentItems",
"(",
"boolean",
"persist",
")",
"{",
"addField",
"(",
"ConfigureNodeFields",
".",
"persist_items",
",",
"FormField",
".",
"Type",
".",
"bool",
")",
";",
"setAnswer",
"(",
"ConfigureNodeFields",
".",
"persist_items",
".",
"getFieldName",
"(",
")",
",",
"persist",
")",
";",
"}"
] | Sets whether items should be persisted in the node.
@param persist true if items should be persisted, false otherwise | [
"Sets",
"whether",
"items",
"should",
"be",
"persisted",
"in",
"the",
"node",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ConfigureForm.java#L447-L450 |
26,745 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ConfigureForm.java | ConfigureForm.setPresenceBasedDelivery | public void setPresenceBasedDelivery(boolean presenceBased) {
addField(ConfigureNodeFields.presence_based_delivery, FormField.Type.bool);
setAnswer(ConfigureNodeFields.presence_based_delivery.getFieldName(), presenceBased);
} | java | public void setPresenceBasedDelivery(boolean presenceBased) {
addField(ConfigureNodeFields.presence_based_delivery, FormField.Type.bool);
setAnswer(ConfigureNodeFields.presence_based_delivery.getFieldName(), presenceBased);
} | [
"public",
"void",
"setPresenceBasedDelivery",
"(",
"boolean",
"presenceBased",
")",
"{",
"addField",
"(",
"ConfigureNodeFields",
".",
"presence_based_delivery",
",",
"FormField",
".",
"Type",
".",
"bool",
")",
";",
"setAnswer",
"(",
"ConfigureNodeFields",
".",
"presence_based_delivery",
".",
"getFieldName",
"(",
")",
",",
"presenceBased",
")",
";",
"}"
] | Sets whether to deliver notifications to available users only.
@param presenceBased true if user must be available, false otherwise | [
"Sets",
"whether",
"to",
"deliver",
"notifications",
"to",
"available",
"users",
"only",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ConfigureForm.java#L466-L469 |
26,746 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ConfigureForm.java | ConfigureForm.getPublishModel | public PublishModel getPublishModel() {
String value = getFieldValue(ConfigureNodeFields.publish_model);
if (value == null)
return null;
else
return PublishModel.valueOf(value);
} | java | public PublishModel getPublishModel() {
String value = getFieldValue(ConfigureNodeFields.publish_model);
if (value == null)
return null;
else
return PublishModel.valueOf(value);
} | [
"public",
"PublishModel",
"getPublishModel",
"(",
")",
"{",
"String",
"value",
"=",
"getFieldValue",
"(",
"ConfigureNodeFields",
".",
"publish_model",
")",
";",
"if",
"(",
"value",
"==",
"null",
")",
"return",
"null",
";",
"else",
"return",
"PublishModel",
".",
"valueOf",
"(",
"value",
")",
";",
"}"
] | Gets the publishing model for the node, which determines who may publish to it.
@return The publishing model | [
"Gets",
"the",
"publishing",
"model",
"for",
"the",
"node",
"which",
"determines",
"who",
"may",
"publish",
"to",
"it",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ConfigureForm.java#L476-L483 |
26,747 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ConfigureForm.java | ConfigureForm.setPublishModel | public void setPublishModel(PublishModel publish) {
addField(ConfigureNodeFields.publish_model, FormField.Type.list_single);
setAnswer(ConfigureNodeFields.publish_model.getFieldName(), getListSingle(publish.toString()));
} | java | public void setPublishModel(PublishModel publish) {
addField(ConfigureNodeFields.publish_model, FormField.Type.list_single);
setAnswer(ConfigureNodeFields.publish_model.getFieldName(), getListSingle(publish.toString()));
} | [
"public",
"void",
"setPublishModel",
"(",
"PublishModel",
"publish",
")",
"{",
"addField",
"(",
"ConfigureNodeFields",
".",
"publish_model",
",",
"FormField",
".",
"Type",
".",
"list_single",
")",
";",
"setAnswer",
"(",
"ConfigureNodeFields",
".",
"publish_model",
".",
"getFieldName",
"(",
")",
",",
"getListSingle",
"(",
"publish",
".",
"toString",
"(",
")",
")",
")",
";",
"}"
] | Sets the publishing model for the node, which determines who may publish to it.
@param publish The enum representing the possible options for the publishing model | [
"Sets",
"the",
"publishing",
"model",
"for",
"the",
"node",
"which",
"determines",
"who",
"may",
"publish",
"to",
"it",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ConfigureForm.java#L490-L493 |
26,748 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ConfigureForm.java | ConfigureForm.setReplyRoom | public void setReplyRoom(List<String> replyRooms) {
addField(ConfigureNodeFields.replyroom, FormField.Type.list_multi);
setAnswer(ConfigureNodeFields.replyroom.getFieldName(), replyRooms);
} | java | public void setReplyRoom(List<String> replyRooms) {
addField(ConfigureNodeFields.replyroom, FormField.Type.list_multi);
setAnswer(ConfigureNodeFields.replyroom.getFieldName(), replyRooms);
} | [
"public",
"void",
"setReplyRoom",
"(",
"List",
"<",
"String",
">",
"replyRooms",
")",
"{",
"addField",
"(",
"ConfigureNodeFields",
".",
"replyroom",
",",
"FormField",
".",
"Type",
".",
"list_multi",
")",
";",
"setAnswer",
"(",
"ConfigureNodeFields",
".",
"replyroom",
".",
"getFieldName",
"(",
")",
",",
"replyRooms",
")",
";",
"}"
] | Sets the multi user chat rooms that are specified as reply rooms.
@param replyRooms The multi user chat room to use as reply rooms | [
"Sets",
"the",
"multi",
"user",
"chat",
"rooms",
"that",
"are",
"specified",
"as",
"reply",
"rooms",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ConfigureForm.java#L509-L512 |
26,749 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ConfigureForm.java | ConfigureForm.setReplyTo | public void setReplyTo(List<String> replyTos) {
addField(ConfigureNodeFields.replyto, FormField.Type.list_multi);
setAnswer(ConfigureNodeFields.replyto.getFieldName(), replyTos);
} | java | public void setReplyTo(List<String> replyTos) {
addField(ConfigureNodeFields.replyto, FormField.Type.list_multi);
setAnswer(ConfigureNodeFields.replyto.getFieldName(), replyTos);
} | [
"public",
"void",
"setReplyTo",
"(",
"List",
"<",
"String",
">",
"replyTos",
")",
"{",
"addField",
"(",
"ConfigureNodeFields",
".",
"replyto",
",",
"FormField",
".",
"Type",
".",
"list_multi",
")",
";",
"setAnswer",
"(",
"ConfigureNodeFields",
".",
"replyto",
".",
"getFieldName",
"(",
")",
",",
"replyTos",
")",
";",
"}"
] | Sets the specific JID's for reply to.
@param replyTos The JID's to reply to | [
"Sets",
"the",
"specific",
"JID",
"s",
"for",
"reply",
"to",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ConfigureForm.java#L528-L531 |
26,750 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ConfigureForm.java | ConfigureForm.setRosterGroupsAllowed | public void setRosterGroupsAllowed(List<String> groups) {
addField(ConfigureNodeFields.roster_groups_allowed, FormField.Type.list_multi);
setAnswer(ConfigureNodeFields.roster_groups_allowed.getFieldName(), groups);
} | java | public void setRosterGroupsAllowed(List<String> groups) {
addField(ConfigureNodeFields.roster_groups_allowed, FormField.Type.list_multi);
setAnswer(ConfigureNodeFields.roster_groups_allowed.getFieldName(), groups);
} | [
"public",
"void",
"setRosterGroupsAllowed",
"(",
"List",
"<",
"String",
">",
"groups",
")",
"{",
"addField",
"(",
"ConfigureNodeFields",
".",
"roster_groups_allowed",
",",
"FormField",
".",
"Type",
".",
"list_multi",
")",
";",
"setAnswer",
"(",
"ConfigureNodeFields",
".",
"roster_groups_allowed",
".",
"getFieldName",
"(",
")",
",",
"groups",
")",
";",
"}"
] | Sets the roster groups that are allowed to subscribe and retrieve items.
@param groups The roster groups | [
"Sets",
"the",
"roster",
"groups",
"that",
"are",
"allowed",
"to",
"subscribe",
"and",
"retrieve",
"items",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ConfigureForm.java#L547-L550 |
26,751 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ConfigureForm.java | ConfigureForm.setSubscribe | public void setSubscribe(boolean subscribe) {
addField(ConfigureNodeFields.subscribe, FormField.Type.bool);
setAnswer(ConfigureNodeFields.subscribe.getFieldName(), subscribe);
} | java | public void setSubscribe(boolean subscribe) {
addField(ConfigureNodeFields.subscribe, FormField.Type.bool);
setAnswer(ConfigureNodeFields.subscribe.getFieldName(), subscribe);
} | [
"public",
"void",
"setSubscribe",
"(",
"boolean",
"subscribe",
")",
"{",
"addField",
"(",
"ConfigureNodeFields",
".",
"subscribe",
",",
"FormField",
".",
"Type",
".",
"bool",
")",
";",
"setAnswer",
"(",
"ConfigureNodeFields",
".",
"subscribe",
".",
"getFieldName",
"(",
")",
",",
"subscribe",
")",
";",
"}"
] | Sets whether subscriptions are allowed.
@param subscribe true if they are, false otherwise | [
"Sets",
"whether",
"subscriptions",
"are",
"allowed",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ConfigureForm.java#L577-L580 |
26,752 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ConfigureForm.java | ConfigureForm.setTitle | @Override
public void setTitle(String title) {
addField(ConfigureNodeFields.title, FormField.Type.text_single);
setAnswer(ConfigureNodeFields.title.getFieldName(), title);
} | java | @Override
public void setTitle(String title) {
addField(ConfigureNodeFields.title, FormField.Type.text_single);
setAnswer(ConfigureNodeFields.title.getFieldName(), title);
} | [
"@",
"Override",
"public",
"void",
"setTitle",
"(",
"String",
"title",
")",
"{",
"addField",
"(",
"ConfigureNodeFields",
".",
"title",
",",
"FormField",
".",
"Type",
".",
"text_single",
")",
";",
"setAnswer",
"(",
"ConfigureNodeFields",
".",
"title",
".",
"getFieldName",
"(",
")",
",",
"title",
")",
";",
"}"
] | Sets a human readable title for the node.
@param title The node title | [
"Sets",
"a",
"human",
"readable",
"title",
"for",
"the",
"node",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ConfigureForm.java#L597-L601 |
26,753 | igniterealtime/Smack | smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoStore.java | OmemoStore.mergeCachedDeviceList | OmemoCachedDeviceList mergeCachedDeviceList(OmemoDevice userDevice, BareJid contact, OmemoDeviceListElement list) {
OmemoCachedDeviceList cached = loadCachedDeviceList(userDevice, contact);
if (cached == null) {
cached = new OmemoCachedDeviceList();
}
if (list == null) {
return cached;
}
for (int devId : list.getDeviceIds()) {
if (!cached.contains(devId)) {
setDateOfLastDeviceIdPublication(userDevice, new OmemoDevice(contact, devId), new Date());
}
}
cached.merge(list.getDeviceIds());
storeCachedDeviceList(userDevice, contact, cached);
return cached;
} | java | OmemoCachedDeviceList mergeCachedDeviceList(OmemoDevice userDevice, BareJid contact, OmemoDeviceListElement list) {
OmemoCachedDeviceList cached = loadCachedDeviceList(userDevice, contact);
if (cached == null) {
cached = new OmemoCachedDeviceList();
}
if (list == null) {
return cached;
}
for (int devId : list.getDeviceIds()) {
if (!cached.contains(devId)) {
setDateOfLastDeviceIdPublication(userDevice, new OmemoDevice(contact, devId), new Date());
}
}
cached.merge(list.getDeviceIds());
storeCachedDeviceList(userDevice, contact, cached);
return cached;
} | [
"OmemoCachedDeviceList",
"mergeCachedDeviceList",
"(",
"OmemoDevice",
"userDevice",
",",
"BareJid",
"contact",
",",
"OmemoDeviceListElement",
"list",
")",
"{",
"OmemoCachedDeviceList",
"cached",
"=",
"loadCachedDeviceList",
"(",
"userDevice",
",",
"contact",
")",
";",
"if",
"(",
"cached",
"==",
"null",
")",
"{",
"cached",
"=",
"new",
"OmemoCachedDeviceList",
"(",
")",
";",
"}",
"if",
"(",
"list",
"==",
"null",
")",
"{",
"return",
"cached",
";",
"}",
"for",
"(",
"int",
"devId",
":",
"list",
".",
"getDeviceIds",
"(",
")",
")",
"{",
"if",
"(",
"!",
"cached",
".",
"contains",
"(",
"devId",
")",
")",
"{",
"setDateOfLastDeviceIdPublication",
"(",
"userDevice",
",",
"new",
"OmemoDevice",
"(",
"contact",
",",
"devId",
")",
",",
"new",
"Date",
"(",
")",
")",
";",
"}",
"}",
"cached",
".",
"merge",
"(",
"list",
".",
"getDeviceIds",
"(",
")",
")",
";",
"storeCachedDeviceList",
"(",
"userDevice",
",",
"contact",
",",
"cached",
")",
";",
"return",
"cached",
";",
"}"
] | Merge the received OmemoDeviceListElement with the one we already have. If we had none, the received one is saved.
@param userDevice our OmemoDevice.
@param contact Contact we received the list from.
@param list List we received. | [
"Merge",
"the",
"received",
"OmemoDeviceListElement",
"with",
"the",
"one",
"we",
"already",
"have",
".",
"If",
"we",
"had",
"none",
"the",
"received",
"one",
"is",
"saved",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoStore.java#L104-L125 |
26,754 | igniterealtime/Smack | smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoStore.java | OmemoStore.removeOldSignedPreKeys | private void removeOldSignedPreKeys(OmemoDevice userDevice) {
if (OmemoConfiguration.getMaxNumberOfStoredSignedPreKeys() <= 0) {
return;
}
TreeMap<Integer, T_SigPreKey> signedPreKeys = loadOmemoSignedPreKeys(userDevice);
for (int i = 0; i < signedPreKeys.keySet().size() - OmemoConfiguration.getMaxNumberOfStoredSignedPreKeys(); i++) {
int keyId = signedPreKeys.firstKey();
LOGGER.log(Level.INFO, "Remove signedPreKey " + keyId + ".");
removeOmemoSignedPreKey(userDevice, i);
signedPreKeys = loadOmemoSignedPreKeys(userDevice);
}
} | java | private void removeOldSignedPreKeys(OmemoDevice userDevice) {
if (OmemoConfiguration.getMaxNumberOfStoredSignedPreKeys() <= 0) {
return;
}
TreeMap<Integer, T_SigPreKey> signedPreKeys = loadOmemoSignedPreKeys(userDevice);
for (int i = 0; i < signedPreKeys.keySet().size() - OmemoConfiguration.getMaxNumberOfStoredSignedPreKeys(); i++) {
int keyId = signedPreKeys.firstKey();
LOGGER.log(Level.INFO, "Remove signedPreKey " + keyId + ".");
removeOmemoSignedPreKey(userDevice, i);
signedPreKeys = loadOmemoSignedPreKeys(userDevice);
}
} | [
"private",
"void",
"removeOldSignedPreKeys",
"(",
"OmemoDevice",
"userDevice",
")",
"{",
"if",
"(",
"OmemoConfiguration",
".",
"getMaxNumberOfStoredSignedPreKeys",
"(",
")",
"<=",
"0",
")",
"{",
"return",
";",
"}",
"TreeMap",
"<",
"Integer",
",",
"T_SigPreKey",
">",
"signedPreKeys",
"=",
"loadOmemoSignedPreKeys",
"(",
"userDevice",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"signedPreKeys",
".",
"keySet",
"(",
")",
".",
"size",
"(",
")",
"-",
"OmemoConfiguration",
".",
"getMaxNumberOfStoredSignedPreKeys",
"(",
")",
";",
"i",
"++",
")",
"{",
"int",
"keyId",
"=",
"signedPreKeys",
".",
"firstKey",
"(",
")",
";",
"LOGGER",
".",
"log",
"(",
"Level",
".",
"INFO",
",",
"\"Remove signedPreKey \"",
"+",
"keyId",
"+",
"\".\"",
")",
";",
"removeOmemoSignedPreKey",
"(",
"userDevice",
",",
"i",
")",
";",
"signedPreKeys",
"=",
"loadOmemoSignedPreKeys",
"(",
"userDevice",
")",
";",
"}",
"}"
] | Remove the oldest signedPreKey until there are only MAX_NUMBER_OF_STORED_SIGNED_PREKEYS left.
@param userDevice our OmemoDevice. | [
"Remove",
"the",
"oldest",
"signedPreKey",
"until",
"there",
"are",
"only",
"MAX_NUMBER_OF_STORED_SIGNED_PREKEYS",
"left",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoStore.java#L162-L175 |
26,755 | igniterealtime/Smack | smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoStore.java | OmemoStore.packOmemoBundle | OmemoBundleElement_VAxolotl packOmemoBundle(OmemoDevice userDevice)
throws CorruptedOmemoKeyException {
int currentSignedPreKeyId = loadCurrentOmemoSignedPreKeyId(userDevice);
T_SigPreKey currentSignedPreKey = loadOmemoSignedPreKeys(userDevice).get(currentSignedPreKeyId);
return new OmemoBundleElement_VAxolotl(
currentSignedPreKeyId,
keyUtil().signedPreKeyPublicForBundle(currentSignedPreKey),
keyUtil().signedPreKeySignatureFromKey(currentSignedPreKey),
keyUtil().identityKeyForBundle(keyUtil().identityKeyFromPair(loadOmemoIdentityKeyPair(userDevice))),
keyUtil().preKeyPublicKeysForBundle(loadOmemoPreKeys(userDevice))
);
} | java | OmemoBundleElement_VAxolotl packOmemoBundle(OmemoDevice userDevice)
throws CorruptedOmemoKeyException {
int currentSignedPreKeyId = loadCurrentOmemoSignedPreKeyId(userDevice);
T_SigPreKey currentSignedPreKey = loadOmemoSignedPreKeys(userDevice).get(currentSignedPreKeyId);
return new OmemoBundleElement_VAxolotl(
currentSignedPreKeyId,
keyUtil().signedPreKeyPublicForBundle(currentSignedPreKey),
keyUtil().signedPreKeySignatureFromKey(currentSignedPreKey),
keyUtil().identityKeyForBundle(keyUtil().identityKeyFromPair(loadOmemoIdentityKeyPair(userDevice))),
keyUtil().preKeyPublicKeysForBundle(loadOmemoPreKeys(userDevice))
);
} | [
"OmemoBundleElement_VAxolotl",
"packOmemoBundle",
"(",
"OmemoDevice",
"userDevice",
")",
"throws",
"CorruptedOmemoKeyException",
"{",
"int",
"currentSignedPreKeyId",
"=",
"loadCurrentOmemoSignedPreKeyId",
"(",
"userDevice",
")",
";",
"T_SigPreKey",
"currentSignedPreKey",
"=",
"loadOmemoSignedPreKeys",
"(",
"userDevice",
")",
".",
"get",
"(",
"currentSignedPreKeyId",
")",
";",
"return",
"new",
"OmemoBundleElement_VAxolotl",
"(",
"currentSignedPreKeyId",
",",
"keyUtil",
"(",
")",
".",
"signedPreKeyPublicForBundle",
"(",
"currentSignedPreKey",
")",
",",
"keyUtil",
"(",
")",
".",
"signedPreKeySignatureFromKey",
"(",
"currentSignedPreKey",
")",
",",
"keyUtil",
"(",
")",
".",
"identityKeyForBundle",
"(",
"keyUtil",
"(",
")",
".",
"identityKeyFromPair",
"(",
"loadOmemoIdentityKeyPair",
"(",
"userDevice",
")",
")",
")",
",",
"keyUtil",
"(",
")",
".",
"preKeyPublicKeysForBundle",
"(",
"loadOmemoPreKeys",
"(",
"userDevice",
")",
")",
")",
";",
"}"
] | Pack a OmemoBundleElement containing our key material.
@param userDevice our OmemoDevice.
@return OmemoBundleElement
@throws CorruptedOmemoKeyException when a key could not be loaded | [
"Pack",
"a",
"OmemoBundleElement",
"containing",
"our",
"key",
"material",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoStore.java#L184-L197 |
26,756 | igniterealtime/Smack | smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoStore.java | OmemoStore.replenishKeys | public void replenishKeys(OmemoDevice userDevice)
throws CorruptedOmemoKeyException {
T_IdKeyPair identityKeyPair = loadOmemoIdentityKeyPair(userDevice);
if (identityKeyPair == null) {
identityKeyPair = generateOmemoIdentityKeyPair();
storeOmemoIdentityKeyPair(userDevice, identityKeyPair);
}
TreeMap<Integer, T_SigPreKey> signedPreKeys = loadOmemoSignedPreKeys(userDevice);
if (signedPreKeys.size() == 0) {
changeSignedPreKey(userDevice);
}
TreeMap<Integer, T_PreKey> preKeys = loadOmemoPreKeys(userDevice);
int newKeysCount = PRE_KEY_COUNT_PER_BUNDLE - preKeys.size();
int startId = preKeys.size() == 0 ? 0 : preKeys.lastKey();
if (newKeysCount > 0) {
TreeMap<Integer, T_PreKey> newKeys = generateOmemoPreKeys(startId + 1, newKeysCount);
storeOmemoPreKeys(userDevice, newKeys);
}
} | java | public void replenishKeys(OmemoDevice userDevice)
throws CorruptedOmemoKeyException {
T_IdKeyPair identityKeyPair = loadOmemoIdentityKeyPair(userDevice);
if (identityKeyPair == null) {
identityKeyPair = generateOmemoIdentityKeyPair();
storeOmemoIdentityKeyPair(userDevice, identityKeyPair);
}
TreeMap<Integer, T_SigPreKey> signedPreKeys = loadOmemoSignedPreKeys(userDevice);
if (signedPreKeys.size() == 0) {
changeSignedPreKey(userDevice);
}
TreeMap<Integer, T_PreKey> preKeys = loadOmemoPreKeys(userDevice);
int newKeysCount = PRE_KEY_COUNT_PER_BUNDLE - preKeys.size();
int startId = preKeys.size() == 0 ? 0 : preKeys.lastKey();
if (newKeysCount > 0) {
TreeMap<Integer, T_PreKey> newKeys = generateOmemoPreKeys(startId + 1, newKeysCount);
storeOmemoPreKeys(userDevice, newKeys);
}
} | [
"public",
"void",
"replenishKeys",
"(",
"OmemoDevice",
"userDevice",
")",
"throws",
"CorruptedOmemoKeyException",
"{",
"T_IdKeyPair",
"identityKeyPair",
"=",
"loadOmemoIdentityKeyPair",
"(",
"userDevice",
")",
";",
"if",
"(",
"identityKeyPair",
"==",
"null",
")",
"{",
"identityKeyPair",
"=",
"generateOmemoIdentityKeyPair",
"(",
")",
";",
"storeOmemoIdentityKeyPair",
"(",
"userDevice",
",",
"identityKeyPair",
")",
";",
"}",
"TreeMap",
"<",
"Integer",
",",
"T_SigPreKey",
">",
"signedPreKeys",
"=",
"loadOmemoSignedPreKeys",
"(",
"userDevice",
")",
";",
"if",
"(",
"signedPreKeys",
".",
"size",
"(",
")",
"==",
"0",
")",
"{",
"changeSignedPreKey",
"(",
"userDevice",
")",
";",
"}",
"TreeMap",
"<",
"Integer",
",",
"T_PreKey",
">",
"preKeys",
"=",
"loadOmemoPreKeys",
"(",
"userDevice",
")",
";",
"int",
"newKeysCount",
"=",
"PRE_KEY_COUNT_PER_BUNDLE",
"-",
"preKeys",
".",
"size",
"(",
")",
";",
"int",
"startId",
"=",
"preKeys",
".",
"size",
"(",
")",
"==",
"0",
"?",
"0",
":",
"preKeys",
".",
"lastKey",
"(",
")",
";",
"if",
"(",
"newKeysCount",
">",
"0",
")",
"{",
"TreeMap",
"<",
"Integer",
",",
"T_PreKey",
">",
"newKeys",
"=",
"generateOmemoPreKeys",
"(",
"startId",
"+",
"1",
",",
"newKeysCount",
")",
";",
"storeOmemoPreKeys",
"(",
"userDevice",
",",
"newKeys",
")",
";",
"}",
"}"
] | Replenish our supply of keys. If we are missing any type of keys, generate them fresh.
@param userDevice
@throws CorruptedOmemoKeyException | [
"Replenish",
"our",
"supply",
"of",
"keys",
".",
"If",
"we",
"are",
"missing",
"any",
"type",
"of",
"keys",
"generate",
"them",
"fresh",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoStore.java#L204-L226 |
26,757 | igniterealtime/Smack | smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoStore.java | OmemoStore.generateOmemoPreKeys | public TreeMap<Integer, T_PreKey> generateOmemoPreKeys(int startId, int count) {
return keyUtil().generateOmemoPreKeys(startId, count);
} | java | public TreeMap<Integer, T_PreKey> generateOmemoPreKeys(int startId, int count) {
return keyUtil().generateOmemoPreKeys(startId, count);
} | [
"public",
"TreeMap",
"<",
"Integer",
",",
"T_PreKey",
">",
"generateOmemoPreKeys",
"(",
"int",
"startId",
",",
"int",
"count",
")",
"{",
"return",
"keyUtil",
"(",
")",
".",
"generateOmemoPreKeys",
"(",
"startId",
",",
"count",
")",
";",
"}"
] | Generate 'count' new PreKeys beginning with id 'startId'.
These preKeys are published and can be used by contacts to establish sessions with us.
@param startId start id
@param count how many keys do we want to generate
@return Map of new preKeys | [
"Generate",
"count",
"new",
"PreKeys",
"beginning",
"with",
"id",
"startId",
".",
"These",
"preKeys",
"are",
"published",
"and",
"can",
"be",
"used",
"by",
"contacts",
"to",
"establish",
"sessions",
"with",
"us",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoStore.java#L376-L378 |
26,758 | igniterealtime/Smack | smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoStore.java | OmemoStore.storeOmemoPreKeys | public void storeOmemoPreKeys(OmemoDevice userDevice, TreeMap<Integer, T_PreKey> preKeyHashMap) {
for (Map.Entry<Integer, T_PreKey> entry : preKeyHashMap.entrySet()) {
storeOmemoPreKey(userDevice, entry.getKey(), entry.getValue());
}
} | java | public void storeOmemoPreKeys(OmemoDevice userDevice, TreeMap<Integer, T_PreKey> preKeyHashMap) {
for (Map.Entry<Integer, T_PreKey> entry : preKeyHashMap.entrySet()) {
storeOmemoPreKey(userDevice, entry.getKey(), entry.getValue());
}
} | [
"public",
"void",
"storeOmemoPreKeys",
"(",
"OmemoDevice",
"userDevice",
",",
"TreeMap",
"<",
"Integer",
",",
"T_PreKey",
">",
"preKeyHashMap",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"Integer",
",",
"T_PreKey",
">",
"entry",
":",
"preKeyHashMap",
".",
"entrySet",
"(",
")",
")",
"{",
"storeOmemoPreKey",
"(",
"userDevice",
",",
"entry",
".",
"getKey",
"(",
")",
",",
"entry",
".",
"getValue",
"(",
")",
")",
";",
"}",
"}"
] | Store a whole bunch of preKeys.
@param userDevice our OmemoDevice.
@param preKeyHashMap HashMap of preKeys | [
"Store",
"a",
"whole",
"bunch",
"of",
"preKeys",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoStore.java#L404-L408 |
26,759 | igniterealtime/Smack | smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoStore.java | OmemoStore.generateOmemoSignedPreKey | public T_SigPreKey generateOmemoSignedPreKey(T_IdKeyPair identityKeyPair, int signedPreKeyId)
throws CorruptedOmemoKeyException {
return keyUtil().generateOmemoSignedPreKey(identityKeyPair, signedPreKeyId);
} | java | public T_SigPreKey generateOmemoSignedPreKey(T_IdKeyPair identityKeyPair, int signedPreKeyId)
throws CorruptedOmemoKeyException {
return keyUtil().generateOmemoSignedPreKey(identityKeyPair, signedPreKeyId);
} | [
"public",
"T_SigPreKey",
"generateOmemoSignedPreKey",
"(",
"T_IdKeyPair",
"identityKeyPair",
",",
"int",
"signedPreKeyId",
")",
"throws",
"CorruptedOmemoKeyException",
"{",
"return",
"keyUtil",
"(",
")",
".",
"generateOmemoSignedPreKey",
"(",
"identityKeyPair",
",",
"signedPreKeyId",
")",
";",
"}"
] | Generate a new signed preKey.
@param identityKeyPair identityKeyPair used to sign the preKey
@param signedPreKeyId id that the preKey will have
@return signedPreKey
@throws CorruptedOmemoKeyException when something goes wrong | [
"Generate",
"a",
"new",
"signed",
"preKey",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoStore.java#L456-L459 |
26,760 | igniterealtime/Smack | smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoStore.java | OmemoStore.getFingerprint | public OmemoFingerprint getFingerprint(OmemoDevice userDevice)
throws CorruptedOmemoKeyException {
T_IdKeyPair keyPair = loadOmemoIdentityKeyPair(userDevice);
if (keyPair == null) {
return null;
}
return keyUtil().getFingerprintOfIdentityKey(keyUtil().identityKeyFromPair(keyPair));
} | java | public OmemoFingerprint getFingerprint(OmemoDevice userDevice)
throws CorruptedOmemoKeyException {
T_IdKeyPair keyPair = loadOmemoIdentityKeyPair(userDevice);
if (keyPair == null) {
return null;
}
return keyUtil().getFingerprintOfIdentityKey(keyUtil().identityKeyFromPair(keyPair));
} | [
"public",
"OmemoFingerprint",
"getFingerprint",
"(",
"OmemoDevice",
"userDevice",
")",
"throws",
"CorruptedOmemoKeyException",
"{",
"T_IdKeyPair",
"keyPair",
"=",
"loadOmemoIdentityKeyPair",
"(",
"userDevice",
")",
";",
"if",
"(",
"keyPair",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"keyUtil",
"(",
")",
".",
"getFingerprintOfIdentityKey",
"(",
"keyUtil",
"(",
")",
".",
"identityKeyFromPair",
"(",
"keyPair",
")",
")",
";",
"}"
] | Return our identityKeys fingerprint.
@param userDevice our OmemoDevice.
@return fingerprint of our identityKeyPair
@throws CorruptedOmemoKeyException if the identityKey of userDevice is corrupted. | [
"Return",
"our",
"identityKeys",
"fingerprint",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoStore.java#L583-L592 |
26,761 | igniterealtime/Smack | smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoStore.java | OmemoStore.getFingerprint | public OmemoFingerprint getFingerprint(OmemoDevice userDevice, OmemoDevice contactsDevice)
throws CorruptedOmemoKeyException, NoIdentityKeyException {
T_IdKey identityKey = loadOmemoIdentityKey(userDevice, contactsDevice);
if (identityKey == null) {
throw new NoIdentityKeyException(contactsDevice);
}
return keyUtil().getFingerprintOfIdentityKey(identityKey);
} | java | public OmemoFingerprint getFingerprint(OmemoDevice userDevice, OmemoDevice contactsDevice)
throws CorruptedOmemoKeyException, NoIdentityKeyException {
T_IdKey identityKey = loadOmemoIdentityKey(userDevice, contactsDevice);
if (identityKey == null) {
throw new NoIdentityKeyException(contactsDevice);
}
return keyUtil().getFingerprintOfIdentityKey(identityKey);
} | [
"public",
"OmemoFingerprint",
"getFingerprint",
"(",
"OmemoDevice",
"userDevice",
",",
"OmemoDevice",
"contactsDevice",
")",
"throws",
"CorruptedOmemoKeyException",
",",
"NoIdentityKeyException",
"{",
"T_IdKey",
"identityKey",
"=",
"loadOmemoIdentityKey",
"(",
"userDevice",
",",
"contactsDevice",
")",
";",
"if",
"(",
"identityKey",
"==",
"null",
")",
"{",
"throw",
"new",
"NoIdentityKeyException",
"(",
"contactsDevice",
")",
";",
"}",
"return",
"keyUtil",
"(",
")",
".",
"getFingerprintOfIdentityKey",
"(",
"identityKey",
")",
";",
"}"
] | Return the fingerprint of the identityKey belonging to contactsDevice.
@param userDevice our OmemoDevice.
@param contactsDevice OmemoDevice we want to have the fingerprint for.
@return fingerprint of the userDevices IdentityKey.
@throws CorruptedOmemoKeyException if the IdentityKey is corrupted.
@throws NoIdentityKeyException if no IdentityKey for contactsDevice has been found locally. | [
"Return",
"the",
"fingerprint",
"of",
"the",
"identityKey",
"belonging",
"to",
"contactsDevice",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoStore.java#L603-L611 |
26,762 | igniterealtime/Smack | smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoStore.java | OmemoStore.getFingerprintAndMaybeBuildSession | public OmemoFingerprint getFingerprintAndMaybeBuildSession(OmemoManager.LoggedInOmemoManager managerGuard, OmemoDevice contactsDevice)
throws CannotEstablishOmemoSessionException, CorruptedOmemoKeyException,
SmackException.NotConnectedException, InterruptedException, SmackException.NoResponseException {
OmemoManager omemoManager = managerGuard.get();
// Load identityKey
T_IdKey identityKey = loadOmemoIdentityKey(omemoManager.getOwnDevice(), contactsDevice);
if (identityKey == null) {
// Key cannot be loaded. Maybe it doesn't exist. Fetch a bundle to get it...
OmemoService.getInstance().buildFreshSessionWithDevice(omemoManager.getConnection(),
omemoManager.getOwnDevice(), contactsDevice);
}
// Load identityKey again
identityKey = loadOmemoIdentityKey(omemoManager.getOwnDevice(), contactsDevice);
if (identityKey == null) {
return null;
}
return keyUtil().getFingerprintOfIdentityKey(identityKey);
} | java | public OmemoFingerprint getFingerprintAndMaybeBuildSession(OmemoManager.LoggedInOmemoManager managerGuard, OmemoDevice contactsDevice)
throws CannotEstablishOmemoSessionException, CorruptedOmemoKeyException,
SmackException.NotConnectedException, InterruptedException, SmackException.NoResponseException {
OmemoManager omemoManager = managerGuard.get();
// Load identityKey
T_IdKey identityKey = loadOmemoIdentityKey(omemoManager.getOwnDevice(), contactsDevice);
if (identityKey == null) {
// Key cannot be loaded. Maybe it doesn't exist. Fetch a bundle to get it...
OmemoService.getInstance().buildFreshSessionWithDevice(omemoManager.getConnection(),
omemoManager.getOwnDevice(), contactsDevice);
}
// Load identityKey again
identityKey = loadOmemoIdentityKey(omemoManager.getOwnDevice(), contactsDevice);
if (identityKey == null) {
return null;
}
return keyUtil().getFingerprintOfIdentityKey(identityKey);
} | [
"public",
"OmemoFingerprint",
"getFingerprintAndMaybeBuildSession",
"(",
"OmemoManager",
".",
"LoggedInOmemoManager",
"managerGuard",
",",
"OmemoDevice",
"contactsDevice",
")",
"throws",
"CannotEstablishOmemoSessionException",
",",
"CorruptedOmemoKeyException",
",",
"SmackException",
".",
"NotConnectedException",
",",
"InterruptedException",
",",
"SmackException",
".",
"NoResponseException",
"{",
"OmemoManager",
"omemoManager",
"=",
"managerGuard",
".",
"get",
"(",
")",
";",
"// Load identityKey",
"T_IdKey",
"identityKey",
"=",
"loadOmemoIdentityKey",
"(",
"omemoManager",
".",
"getOwnDevice",
"(",
")",
",",
"contactsDevice",
")",
";",
"if",
"(",
"identityKey",
"==",
"null",
")",
"{",
"// Key cannot be loaded. Maybe it doesn't exist. Fetch a bundle to get it...",
"OmemoService",
".",
"getInstance",
"(",
")",
".",
"buildFreshSessionWithDevice",
"(",
"omemoManager",
".",
"getConnection",
"(",
")",
",",
"omemoManager",
".",
"getOwnDevice",
"(",
")",
",",
"contactsDevice",
")",
";",
"}",
"// Load identityKey again",
"identityKey",
"=",
"loadOmemoIdentityKey",
"(",
"omemoManager",
".",
"getOwnDevice",
"(",
")",
",",
"contactsDevice",
")",
";",
"if",
"(",
"identityKey",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"keyUtil",
"(",
")",
".",
"getFingerprintOfIdentityKey",
"(",
"identityKey",
")",
";",
"}"
] | Return the fingerprint of the given devices announced identityKey.
If we have no local copy of the identityKey of the contact, build a fresh session in order to get the key.
@param managerGuard authenticated OmemoManager
@param contactsDevice OmemoDevice we want to get the fingerprint from
@return fingerprint
@throws CannotEstablishOmemoSessionException If we have no local copy of the identityKey of the contact
and are unable to build a fresh session
@throws CorruptedOmemoKeyException If the identityKey we have of the contact is corrupted
@throws SmackException.NotConnectedException
@throws InterruptedException
@throws SmackException.NoResponseException | [
"Return",
"the",
"fingerprint",
"of",
"the",
"given",
"devices",
"announced",
"identityKey",
".",
"If",
"we",
"have",
"no",
"local",
"copy",
"of",
"the",
"identityKey",
"of",
"the",
"contact",
"build",
"a",
"fresh",
"session",
"in",
"order",
"to",
"get",
"the",
"key",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoStore.java#L628-L648 |
26,763 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/privacy/packet/Privacy.java | Privacy.setPrivacyList | public List<PrivacyItem> setPrivacyList(String listName, List<PrivacyItem> listItem) {
// Add new list to the itemLists
this.getItemLists().put(listName, listItem);
return listItem;
} | java | public List<PrivacyItem> setPrivacyList(String listName, List<PrivacyItem> listItem) {
// Add new list to the itemLists
this.getItemLists().put(listName, listItem);
return listItem;
} | [
"public",
"List",
"<",
"PrivacyItem",
">",
"setPrivacyList",
"(",
"String",
"listName",
",",
"List",
"<",
"PrivacyItem",
">",
"listItem",
")",
"{",
"// Add new list to the itemLists",
"this",
".",
"getItemLists",
"(",
")",
".",
"put",
"(",
"listName",
",",
"listItem",
")",
";",
"return",
"listItem",
";",
"}"
] | Set or update a privacy list with privacy items.
@param listName the name of the new privacy list.
@param listItem the {@link PrivacyItem} that rules the list.
@return the privacy List. | [
"Set",
"or",
"update",
"a",
"privacy",
"list",
"with",
"privacy",
"items",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/privacy/packet/Privacy.java#L71-L75 |
26,764 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/privacy/packet/Privacy.java | Privacy.deletePrivacyList | public void deletePrivacyList(String listName) {
// Remove the list from the cache
// CHECKSTYLE:OFF
this.getItemLists().remove(listName);
// CHECKSTYLE:ON
// Check if deleted list was the default list
if (this.getDefaultName() != null && listName.equals(this.getDefaultName())) {
// CHECKSTYLE:OFF
this.setDefaultName(null);
// CHECKSTYLE:ON
}
} | java | public void deletePrivacyList(String listName) {
// Remove the list from the cache
// CHECKSTYLE:OFF
this.getItemLists().remove(listName);
// CHECKSTYLE:ON
// Check if deleted list was the default list
if (this.getDefaultName() != null && listName.equals(this.getDefaultName())) {
// CHECKSTYLE:OFF
this.setDefaultName(null);
// CHECKSTYLE:ON
}
} | [
"public",
"void",
"deletePrivacyList",
"(",
"String",
"listName",
")",
"{",
"// Remove the list from the cache",
"// CHECKSTYLE:OFF",
"this",
".",
"getItemLists",
"(",
")",
".",
"remove",
"(",
"listName",
")",
";",
"// CHECKSTYLE:ON",
"// Check if deleted list was the default list",
"if",
"(",
"this",
".",
"getDefaultName",
"(",
")",
"!=",
"null",
"&&",
"listName",
".",
"equals",
"(",
"this",
".",
"getDefaultName",
"(",
")",
")",
")",
"{",
"// CHECKSTYLE:OFF",
"this",
".",
"setDefaultName",
"(",
"null",
")",
";",
"// CHECKSTYLE:ON",
"}",
"}"
] | Deletes an existing privacy list. If the privacy list being deleted was the default list
then the user will end up with no default list. Therefore, the user will have to set a new
default list.
@param listName the name of the list being deleted. | [
"Deletes",
"an",
"existing",
"privacy",
"list",
".",
"If",
"the",
"privacy",
"list",
"being",
"deleted",
"was",
"the",
"default",
"list",
"then",
"the",
"user",
"will",
"end",
"up",
"with",
"no",
"default",
"list",
".",
"Therefore",
"the",
"user",
"will",
"have",
"to",
"set",
"a",
"new",
"default",
"list",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/privacy/packet/Privacy.java#L94-L106 |
26,765 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/privacy/packet/Privacy.java | Privacy.getItem | public PrivacyItem getItem(String listName, int order) {
// CHECKSTYLE:OFF
Iterator<PrivacyItem> values = getPrivacyList(listName).iterator();
PrivacyItem itemFound = null;
while (itemFound == null && values.hasNext()) {
PrivacyItem element = values.next();
if (element.getOrder() == order) {
itemFound = element;
}
}
return itemFound;
// CHECKSTYLE:ON
} | java | public PrivacyItem getItem(String listName, int order) {
// CHECKSTYLE:OFF
Iterator<PrivacyItem> values = getPrivacyList(listName).iterator();
PrivacyItem itemFound = null;
while (itemFound == null && values.hasNext()) {
PrivacyItem element = values.next();
if (element.getOrder() == order) {
itemFound = element;
}
}
return itemFound;
// CHECKSTYLE:ON
} | [
"public",
"PrivacyItem",
"getItem",
"(",
"String",
"listName",
",",
"int",
"order",
")",
"{",
"// CHECKSTYLE:OFF",
"Iterator",
"<",
"PrivacyItem",
">",
"values",
"=",
"getPrivacyList",
"(",
"listName",
")",
".",
"iterator",
"(",
")",
";",
"PrivacyItem",
"itemFound",
"=",
"null",
";",
"while",
"(",
"itemFound",
"==",
"null",
"&&",
"values",
".",
"hasNext",
"(",
")",
")",
"{",
"PrivacyItem",
"element",
"=",
"values",
".",
"next",
"(",
")",
";",
"if",
"(",
"element",
".",
"getOrder",
"(",
")",
"==",
"order",
")",
"{",
"itemFound",
"=",
"element",
";",
"}",
"}",
"return",
"itemFound",
";",
"// CHECKSTYLE:ON",
"}"
] | Returns the privacy item in the specified order.
@param listName the name of the privacy list.
@param order the order of the element.
@return a List with {@link PrivacyItem} | [
"Returns",
"the",
"privacy",
"item",
"in",
"the",
"specified",
"order",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/privacy/packet/Privacy.java#L157-L169 |
26,766 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/privacy/packet/Privacy.java | Privacy.changeDefaultList | public boolean changeDefaultList(String newDefault) {
if (this.getItemLists().containsKey(newDefault)) {
this.setDefaultName(newDefault);
return true;
} else {
// CHECKSTYLE:OFF
return false;
// CHECKSTYLE:ON
}
} | java | public boolean changeDefaultList(String newDefault) {
if (this.getItemLists().containsKey(newDefault)) {
this.setDefaultName(newDefault);
return true;
} else {
// CHECKSTYLE:OFF
return false;
// CHECKSTYLE:ON
}
} | [
"public",
"boolean",
"changeDefaultList",
"(",
"String",
"newDefault",
")",
"{",
"if",
"(",
"this",
".",
"getItemLists",
"(",
")",
".",
"containsKey",
"(",
"newDefault",
")",
")",
"{",
"this",
".",
"setDefaultName",
"(",
"newDefault",
")",
";",
"return",
"true",
";",
"}",
"else",
"{",
"// CHECKSTYLE:OFF",
"return",
"false",
";",
"// CHECKSTYLE:ON",
"}",
"}"
] | Sets a given privacy list as the new user default list.
@param newDefault the new default privacy list.
@return if the default list was changed. | [
"Sets",
"a",
"given",
"privacy",
"list",
"as",
"the",
"new",
"user",
"default",
"list",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/privacy/packet/Privacy.java#L177-L186 |
26,767 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/receipts/DeliveryReceiptManager.java | DeliveryReceiptManager.getInstanceFor | public static synchronized DeliveryReceiptManager getInstanceFor(XMPPConnection connection) {
DeliveryReceiptManager receiptManager = instances.get(connection);
if (receiptManager == null) {
receiptManager = new DeliveryReceiptManager(connection);
instances.put(connection, receiptManager);
}
return receiptManager;
} | java | public static synchronized DeliveryReceiptManager getInstanceFor(XMPPConnection connection) {
DeliveryReceiptManager receiptManager = instances.get(connection);
if (receiptManager == null) {
receiptManager = new DeliveryReceiptManager(connection);
instances.put(connection, receiptManager);
}
return receiptManager;
} | [
"public",
"static",
"synchronized",
"DeliveryReceiptManager",
"getInstanceFor",
"(",
"XMPPConnection",
"connection",
")",
"{",
"DeliveryReceiptManager",
"receiptManager",
"=",
"instances",
".",
"get",
"(",
"connection",
")",
";",
"if",
"(",
"receiptManager",
"==",
"null",
")",
"{",
"receiptManager",
"=",
"new",
"DeliveryReceiptManager",
"(",
"connection",
")",
";",
"instances",
".",
"put",
"(",
"connection",
",",
"receiptManager",
")",
";",
"}",
"return",
"receiptManager",
";",
"}"
] | Obtain the DeliveryReceiptManager responsible for a connection.
@param connection the connection object.
@return the DeliveryReceiptManager instance for the given connection | [
"Obtain",
"the",
"DeliveryReceiptManager",
"responsible",
"for",
"a",
"connection",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/receipts/DeliveryReceiptManager.java#L196-L205 |
26,768 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/receipts/DeliveryReceiptManager.java | DeliveryReceiptManager.isSupported | public boolean isSupported(Jid jid) throws SmackException, XMPPException, InterruptedException {
return ServiceDiscoveryManager.getInstanceFor(connection()).supportsFeature(jid,
DeliveryReceipt.NAMESPACE);
} | java | public boolean isSupported(Jid jid) throws SmackException, XMPPException, InterruptedException {
return ServiceDiscoveryManager.getInstanceFor(connection()).supportsFeature(jid,
DeliveryReceipt.NAMESPACE);
} | [
"public",
"boolean",
"isSupported",
"(",
"Jid",
"jid",
")",
"throws",
"SmackException",
",",
"XMPPException",
",",
"InterruptedException",
"{",
"return",
"ServiceDiscoveryManager",
".",
"getInstanceFor",
"(",
"connection",
"(",
")",
")",
".",
"supportsFeature",
"(",
"jid",
",",
"DeliveryReceipt",
".",
"NAMESPACE",
")",
";",
"}"
] | Returns true if Delivery Receipts are supported by a given JID.
@param jid
@return true if supported
@throws SmackException if there was no response from the server.
@throws XMPPException
@throws InterruptedException | [
"Returns",
"true",
"if",
"Delivery",
"Receipts",
"are",
"supported",
"by",
"a",
"given",
"JID",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/receipts/DeliveryReceiptManager.java#L216-L219 |
26,769 | igniterealtime/Smack | smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/packet/JingleContentDescription.java | JingleContentDescription.addAudioPayloadTypes | public void addAudioPayloadTypes(final List<PayloadType.Audio> pts) {
synchronized (payloads) {
Iterator<PayloadType.Audio> ptIter = pts.iterator();
while (ptIter.hasNext()) {
PayloadType.Audio pt = ptIter.next();
addJinglePayloadType(new JinglePayloadType.Audio(pt));
}
}
} | java | public void addAudioPayloadTypes(final List<PayloadType.Audio> pts) {
synchronized (payloads) {
Iterator<PayloadType.Audio> ptIter = pts.iterator();
while (ptIter.hasNext()) {
PayloadType.Audio pt = ptIter.next();
addJinglePayloadType(new JinglePayloadType.Audio(pt));
}
}
} | [
"public",
"void",
"addAudioPayloadTypes",
"(",
"final",
"List",
"<",
"PayloadType",
".",
"Audio",
">",
"pts",
")",
"{",
"synchronized",
"(",
"payloads",
")",
"{",
"Iterator",
"<",
"PayloadType",
".",
"Audio",
">",
"ptIter",
"=",
"pts",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"ptIter",
".",
"hasNext",
"(",
")",
")",
"{",
"PayloadType",
".",
"Audio",
"pt",
"=",
"ptIter",
".",
"next",
"(",
")",
";",
"addJinglePayloadType",
"(",
"new",
"JinglePayloadType",
".",
"Audio",
"(",
"pt",
")",
")",
";",
"}",
"}",
"}"
] | Adds a list of payloads to the packet.
@param pts the payloads to add. | [
"Adds",
"a",
"list",
"of",
"payloads",
"to",
"the",
"packet",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/packet/JingleContentDescription.java#L84-L92 |
26,770 | igniterealtime/Smack | smack-core/src/main/java/org/jivesoftware/smack/util/StringUtils.java | StringUtils.escapeForXml | private static CharSequence escapeForXml(final CharSequence input, final XmlEscapeMode xmlEscapeMode) {
if (input == null) {
return null;
}
final int len = input.length();
final StringBuilder out = new StringBuilder((int) (len * 1.3));
CharSequence toAppend;
char ch;
int last = 0;
int i = 0;
while (i < len) {
toAppend = null;
ch = input.charAt(i);
switch (xmlEscapeMode) {
case safe:
switch (ch) {
case '<':
toAppend = LT_ENCODE;
break;
case '>':
toAppend = GT_ENCODE;
break;
case '&':
toAppend = AMP_ENCODE;
break;
case '"':
toAppend = QUOTE_ENCODE;
break;
case '\'':
toAppend = APOS_ENCODE;
break;
default:
break;
}
break;
case forAttribute:
// No need to escape '>' for attributes.
switch (ch) {
case '<':
toAppend = LT_ENCODE;
break;
case '&':
toAppend = AMP_ENCODE;
break;
case '"':
toAppend = QUOTE_ENCODE;
break;
case '\'':
toAppend = APOS_ENCODE;
break;
default:
break;
}
break;
case forAttributeApos:
// No need to escape '>' and '"' for attributes using '\'' as quote.
switch (ch) {
case '<':
toAppend = LT_ENCODE;
break;
case '&':
toAppend = AMP_ENCODE;
break;
case '\'':
toAppend = APOS_ENCODE;
break;
default:
break;
}
break;
case forText:
// No need to escape '"', '\'', and '>' for text.
switch (ch) {
case '<':
toAppend = LT_ENCODE;
break;
case '&':
toAppend = AMP_ENCODE;
break;
default:
break;
}
break;
}
if (toAppend != null) {
if (i > last) {
out.append(input, last, i);
}
out.append(toAppend);
last = ++i;
} else {
i++;
}
}
if (last == 0) {
return input;
}
if (i > last) {
out.append(input, last, i);
}
return out;
} | java | private static CharSequence escapeForXml(final CharSequence input, final XmlEscapeMode xmlEscapeMode) {
if (input == null) {
return null;
}
final int len = input.length();
final StringBuilder out = new StringBuilder((int) (len * 1.3));
CharSequence toAppend;
char ch;
int last = 0;
int i = 0;
while (i < len) {
toAppend = null;
ch = input.charAt(i);
switch (xmlEscapeMode) {
case safe:
switch (ch) {
case '<':
toAppend = LT_ENCODE;
break;
case '>':
toAppend = GT_ENCODE;
break;
case '&':
toAppend = AMP_ENCODE;
break;
case '"':
toAppend = QUOTE_ENCODE;
break;
case '\'':
toAppend = APOS_ENCODE;
break;
default:
break;
}
break;
case forAttribute:
// No need to escape '>' for attributes.
switch (ch) {
case '<':
toAppend = LT_ENCODE;
break;
case '&':
toAppend = AMP_ENCODE;
break;
case '"':
toAppend = QUOTE_ENCODE;
break;
case '\'':
toAppend = APOS_ENCODE;
break;
default:
break;
}
break;
case forAttributeApos:
// No need to escape '>' and '"' for attributes using '\'' as quote.
switch (ch) {
case '<':
toAppend = LT_ENCODE;
break;
case '&':
toAppend = AMP_ENCODE;
break;
case '\'':
toAppend = APOS_ENCODE;
break;
default:
break;
}
break;
case forText:
// No need to escape '"', '\'', and '>' for text.
switch (ch) {
case '<':
toAppend = LT_ENCODE;
break;
case '&':
toAppend = AMP_ENCODE;
break;
default:
break;
}
break;
}
if (toAppend != null) {
if (i > last) {
out.append(input, last, i);
}
out.append(toAppend);
last = ++i;
} else {
i++;
}
}
if (last == 0) {
return input;
}
if (i > last) {
out.append(input, last, i);
}
return out;
} | [
"private",
"static",
"CharSequence",
"escapeForXml",
"(",
"final",
"CharSequence",
"input",
",",
"final",
"XmlEscapeMode",
"xmlEscapeMode",
")",
"{",
"if",
"(",
"input",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"final",
"int",
"len",
"=",
"input",
".",
"length",
"(",
")",
";",
"final",
"StringBuilder",
"out",
"=",
"new",
"StringBuilder",
"(",
"(",
"int",
")",
"(",
"len",
"*",
"1.3",
")",
")",
";",
"CharSequence",
"toAppend",
";",
"char",
"ch",
";",
"int",
"last",
"=",
"0",
";",
"int",
"i",
"=",
"0",
";",
"while",
"(",
"i",
"<",
"len",
")",
"{",
"toAppend",
"=",
"null",
";",
"ch",
"=",
"input",
".",
"charAt",
"(",
"i",
")",
";",
"switch",
"(",
"xmlEscapeMode",
")",
"{",
"case",
"safe",
":",
"switch",
"(",
"ch",
")",
"{",
"case",
"'",
"'",
":",
"toAppend",
"=",
"LT_ENCODE",
";",
"break",
";",
"case",
"'",
"'",
":",
"toAppend",
"=",
"GT_ENCODE",
";",
"break",
";",
"case",
"'",
"'",
":",
"toAppend",
"=",
"AMP_ENCODE",
";",
"break",
";",
"case",
"'",
"'",
":",
"toAppend",
"=",
"QUOTE_ENCODE",
";",
"break",
";",
"case",
"'",
"'",
":",
"toAppend",
"=",
"APOS_ENCODE",
";",
"break",
";",
"default",
":",
"break",
";",
"}",
"break",
";",
"case",
"forAttribute",
":",
"// No need to escape '>' for attributes.",
"switch",
"(",
"ch",
")",
"{",
"case",
"'",
"'",
":",
"toAppend",
"=",
"LT_ENCODE",
";",
"break",
";",
"case",
"'",
"'",
":",
"toAppend",
"=",
"AMP_ENCODE",
";",
"break",
";",
"case",
"'",
"'",
":",
"toAppend",
"=",
"QUOTE_ENCODE",
";",
"break",
";",
"case",
"'",
"'",
":",
"toAppend",
"=",
"APOS_ENCODE",
";",
"break",
";",
"default",
":",
"break",
";",
"}",
"break",
";",
"case",
"forAttributeApos",
":",
"// No need to escape '>' and '\"' for attributes using '\\'' as quote.",
"switch",
"(",
"ch",
")",
"{",
"case",
"'",
"'",
":",
"toAppend",
"=",
"LT_ENCODE",
";",
"break",
";",
"case",
"'",
"'",
":",
"toAppend",
"=",
"AMP_ENCODE",
";",
"break",
";",
"case",
"'",
"'",
":",
"toAppend",
"=",
"APOS_ENCODE",
";",
"break",
";",
"default",
":",
"break",
";",
"}",
"break",
";",
"case",
"forText",
":",
"// No need to escape '\"', '\\'', and '>' for text.",
"switch",
"(",
"ch",
")",
"{",
"case",
"'",
"'",
":",
"toAppend",
"=",
"LT_ENCODE",
";",
"break",
";",
"case",
"'",
"'",
":",
"toAppend",
"=",
"AMP_ENCODE",
";",
"break",
";",
"default",
":",
"break",
";",
"}",
"break",
";",
"}",
"if",
"(",
"toAppend",
"!=",
"null",
")",
"{",
"if",
"(",
"i",
">",
"last",
")",
"{",
"out",
".",
"append",
"(",
"input",
",",
"last",
",",
"i",
")",
";",
"}",
"out",
".",
"append",
"(",
"toAppend",
")",
";",
"last",
"=",
"++",
"i",
";",
"}",
"else",
"{",
"i",
"++",
";",
"}",
"}",
"if",
"(",
"last",
"==",
"0",
")",
"{",
"return",
"input",
";",
"}",
"if",
"(",
"i",
">",
"last",
")",
"{",
"out",
".",
"append",
"(",
"input",
",",
"last",
",",
"i",
")",
";",
"}",
"return",
"out",
";",
"}"
] | Escapes all necessary characters in the CharSequence so that it can be used
in an XML doc.
@param input the CharSequence to escape.
@return the string with appropriate characters escaped. | [
"Escapes",
"all",
"necessary",
"characters",
"in",
"the",
"CharSequence",
"so",
"that",
"it",
"can",
"be",
"used",
"in",
"an",
"XML",
"doc",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-core/src/main/java/org/jivesoftware/smack/util/StringUtils.java#L105-L206 |
26,771 | igniterealtime/Smack | smack-core/src/main/java/org/jivesoftware/smack/util/StringUtils.java | StringUtils.encodeHex | public static String encodeHex(byte[] bytes) {
char[] hexChars = new char[bytes.length * 2];
for (int j = 0; j < bytes.length; j++) {
int v = bytes[j] & 0xFF;
hexChars[j * 2] = HEX_CHARS[v >>> 4];
hexChars[j * 2 + 1] = HEX_CHARS[v & 0x0F];
}
return new String(hexChars);
} | java | public static String encodeHex(byte[] bytes) {
char[] hexChars = new char[bytes.length * 2];
for (int j = 0; j < bytes.length; j++) {
int v = bytes[j] & 0xFF;
hexChars[j * 2] = HEX_CHARS[v >>> 4];
hexChars[j * 2 + 1] = HEX_CHARS[v & 0x0F];
}
return new String(hexChars);
} | [
"public",
"static",
"String",
"encodeHex",
"(",
"byte",
"[",
"]",
"bytes",
")",
"{",
"char",
"[",
"]",
"hexChars",
"=",
"new",
"char",
"[",
"bytes",
".",
"length",
"*",
"2",
"]",
";",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"bytes",
".",
"length",
";",
"j",
"++",
")",
"{",
"int",
"v",
"=",
"bytes",
"[",
"j",
"]",
"&",
"0xFF",
";",
"hexChars",
"[",
"j",
"*",
"2",
"]",
"=",
"HEX_CHARS",
"[",
"v",
">>>",
"4",
"]",
";",
"hexChars",
"[",
"j",
"*",
"2",
"+",
"1",
"]",
"=",
"HEX_CHARS",
"[",
"v",
"&",
"0x0F",
"]",
";",
"}",
"return",
"new",
"String",
"(",
"hexChars",
")",
";",
"}"
] | Encodes an array of bytes as String representation of hexadecimal.
@param bytes an array of bytes to convert to a hex string.
@return generated hex string. | [
"Encodes",
"an",
"array",
"of",
"bytes",
"as",
"String",
"representation",
"of",
"hexadecimal",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-core/src/main/java/org/jivesoftware/smack/util/StringUtils.java#L236-L244 |
26,772 | igniterealtime/Smack | smack-core/src/main/java/org/jivesoftware/smack/util/StringUtils.java | StringUtils.isNotEmpty | public static boolean isNotEmpty(CharSequence... css) {
for (CharSequence cs : css) {
if (StringUtils.isNullOrEmpty(cs)) {
return false;
}
}
return true;
} | java | public static boolean isNotEmpty(CharSequence... css) {
for (CharSequence cs : css) {
if (StringUtils.isNullOrEmpty(cs)) {
return false;
}
}
return true;
} | [
"public",
"static",
"boolean",
"isNotEmpty",
"(",
"CharSequence",
"...",
"css",
")",
"{",
"for",
"(",
"CharSequence",
"cs",
":",
"css",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isNullOrEmpty",
"(",
"cs",
")",
")",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}"
] | Returns true if all given CharSequences are not empty.
@param css the CharSequences to test.
@return true if all given CharSequences are not empty. | [
"Returns",
"true",
"if",
"all",
"given",
"CharSequences",
"are",
"not",
"empty",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-core/src/main/java/org/jivesoftware/smack/util/StringUtils.java#L339-L346 |
26,773 | igniterealtime/Smack | smack-core/src/main/java/org/jivesoftware/smack/util/StringUtils.java | StringUtils.toStringBuilder | public static StringBuilder toStringBuilder(Collection<? extends Object> collection, String delimiter) {
StringBuilder sb = new StringBuilder(collection.size() * 20);
for (Iterator<? extends Object> it = collection.iterator(); it.hasNext();) {
Object cs = it.next();
sb.append(cs);
if (it.hasNext()) {
sb.append(delimiter);
}
}
return sb;
} | java | public static StringBuilder toStringBuilder(Collection<? extends Object> collection, String delimiter) {
StringBuilder sb = new StringBuilder(collection.size() * 20);
for (Iterator<? extends Object> it = collection.iterator(); it.hasNext();) {
Object cs = it.next();
sb.append(cs);
if (it.hasNext()) {
sb.append(delimiter);
}
}
return sb;
} | [
"public",
"static",
"StringBuilder",
"toStringBuilder",
"(",
"Collection",
"<",
"?",
"extends",
"Object",
">",
"collection",
",",
"String",
"delimiter",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
"collection",
".",
"size",
"(",
")",
"*",
"20",
")",
";",
"for",
"(",
"Iterator",
"<",
"?",
"extends",
"Object",
">",
"it",
"=",
"collection",
".",
"iterator",
"(",
")",
";",
"it",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"Object",
"cs",
"=",
"it",
".",
"next",
"(",
")",
";",
"sb",
".",
"append",
"(",
"cs",
")",
";",
"if",
"(",
"it",
".",
"hasNext",
"(",
")",
")",
"{",
"sb",
".",
"append",
"(",
"delimiter",
")",
";",
"}",
"}",
"return",
"sb",
";",
"}"
] | Transform a collection of objects to a delimited String.
@param collection the collection to transform.
@param delimiter the delimiter used to delimit the Strings.
@return a StringBuilder with all the elements of the collection. | [
"Transform",
"a",
"collection",
"of",
"objects",
"to",
"a",
"delimited",
"String",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-core/src/main/java/org/jivesoftware/smack/util/StringUtils.java#L390-L400 |
26,774 | igniterealtime/Smack | smack-core/src/main/java/org/jivesoftware/smack/filter/FromMatchesFilter.java | FromMatchesFilter.create | public static FromMatchesFilter create(Jid address) {
return new FromMatchesFilter(address, address != null ? address.hasNoResource() : false) ;
} | java | public static FromMatchesFilter create(Jid address) {
return new FromMatchesFilter(address, address != null ? address.hasNoResource() : false) ;
} | [
"public",
"static",
"FromMatchesFilter",
"create",
"(",
"Jid",
"address",
")",
"{",
"return",
"new",
"FromMatchesFilter",
"(",
"address",
",",
"address",
"!=",
"null",
"?",
"address",
".",
"hasNoResource",
"(",
")",
":",
"false",
")",
";",
"}"
] | Creates a filter matching on the "from" field. If the filter address is bare, compares
the filter address with the bare from address. Otherwise, compares the filter address
with the full from address.
@param address The address to filter for. If <code>null</code> is given, the stanza must not
have a from address.
@return filter for the "from" address. | [
"Creates",
"a",
"filter",
"matching",
"on",
"the",
"from",
"field",
".",
"If",
"the",
"filter",
"address",
"is",
"bare",
"compares",
"the",
"filter",
"address",
"with",
"the",
"bare",
"from",
"address",
".",
"Otherwise",
"compares",
"the",
"filter",
"address",
"with",
"the",
"full",
"from",
"address",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-core/src/main/java/org/jivesoftware/smack/filter/FromMatchesFilter.java#L57-L59 |
26,775 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/xdata/XDataManager.java | XDataManager.getInstanceFor | public static synchronized XDataManager getInstanceFor(XMPPConnection connection) {
XDataManager xDataManager = INSTANCES.get(connection);
if (xDataManager == null) {
xDataManager = new XDataManager(connection);
INSTANCES.put(connection, xDataManager);
}
return xDataManager;
} | java | public static synchronized XDataManager getInstanceFor(XMPPConnection connection) {
XDataManager xDataManager = INSTANCES.get(connection);
if (xDataManager == null) {
xDataManager = new XDataManager(connection);
INSTANCES.put(connection, xDataManager);
}
return xDataManager;
} | [
"public",
"static",
"synchronized",
"XDataManager",
"getInstanceFor",
"(",
"XMPPConnection",
"connection",
")",
"{",
"XDataManager",
"xDataManager",
"=",
"INSTANCES",
".",
"get",
"(",
"connection",
")",
";",
"if",
"(",
"xDataManager",
"==",
"null",
")",
"{",
"xDataManager",
"=",
"new",
"XDataManager",
"(",
"connection",
")",
";",
"INSTANCES",
".",
"put",
"(",
"connection",
",",
"xDataManager",
")",
";",
"}",
"return",
"xDataManager",
";",
"}"
] | Get the XDataManager for the given XMPP connection.
@param connection the XMPPConnection.
@return the XDataManager | [
"Get",
"the",
"XDataManager",
"for",
"the",
"given",
"XMPP",
"connection",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/xdata/XDataManager.java#L59-L66 |
26,776 | igniterealtime/Smack | smack-experimental/src/main/java/org/jivesoftware/smackx/colors/ConsistentColor.java | ConsistentColor.RGBFrom | public static float[] RGBFrom(CharSequence input, ConsistentColorSettings settings) {
double angle = createAngle(input);
double correctedAngle = applyColorDeficiencyCorrection(angle, settings.getDeficiency());
double[] CbCr = angleToCbCr(correctedAngle);
float[] rgb = CbCrToRGB(CbCr, Y);
return rgb;
} | java | public static float[] RGBFrom(CharSequence input, ConsistentColorSettings settings) {
double angle = createAngle(input);
double correctedAngle = applyColorDeficiencyCorrection(angle, settings.getDeficiency());
double[] CbCr = angleToCbCr(correctedAngle);
float[] rgb = CbCrToRGB(CbCr, Y);
return rgb;
} | [
"public",
"static",
"float",
"[",
"]",
"RGBFrom",
"(",
"CharSequence",
"input",
",",
"ConsistentColorSettings",
"settings",
")",
"{",
"double",
"angle",
"=",
"createAngle",
"(",
"input",
")",
";",
"double",
"correctedAngle",
"=",
"applyColorDeficiencyCorrection",
"(",
"angle",
",",
"settings",
".",
"getDeficiency",
"(",
")",
")",
";",
"double",
"[",
"]",
"CbCr",
"=",
"angleToCbCr",
"(",
"correctedAngle",
")",
";",
"float",
"[",
"]",
"rgb",
"=",
"CbCrToRGB",
"(",
"CbCr",
",",
"Y",
")",
";",
"return",
"rgb",
";",
"}"
] | Return the consistent RGB color value for the input.
This method respects the color vision deficiency mode set by the user.
@param input input string (for example username)
@param settings the settings for consistent color creation.
@return consistent color of that username as RGB values in range [0,1]. | [
"Return",
"the",
"consistent",
"RGB",
"color",
"value",
"for",
"the",
"input",
".",
"This",
"method",
"respects",
"the",
"color",
"vision",
"deficiency",
"mode",
"set",
"by",
"the",
"user",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-experimental/src/main/java/org/jivesoftware/smackx/colors/ConsistentColor.java#L189-L195 |
26,777 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/LeafNode.java | LeafNode.getItems | public <T extends Item> List<T> getItems() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
return getItems((List<ExtensionElement>) null, null);
} | java | public <T extends Item> List<T> getItems() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
return getItems((List<ExtensionElement>) null, null);
} | [
"public",
"<",
"T",
"extends",
"Item",
">",
"List",
"<",
"T",
">",
"getItems",
"(",
")",
"throws",
"NoResponseException",
",",
"XMPPErrorException",
",",
"NotConnectedException",
",",
"InterruptedException",
"{",
"return",
"getItems",
"(",
"(",
"List",
"<",
"ExtensionElement",
">",
")",
"null",
",",
"null",
")",
";",
"}"
] | Get the current items stored in the node.
@param <T> type of the items.
@return List of {@link Item} in the node
@throws XMPPErrorException
@throws NoResponseException if there was no response from the server.
@throws NotConnectedException
@throws InterruptedException | [
"Get",
"the",
"current",
"items",
"stored",
"in",
"the",
"node",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/LeafNode.java#L72-L74 |
26,778 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/LeafNode.java | LeafNode.getItems | public <T extends Item> List<T> getItems(String subscriptionId) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
PubSub request = createPubsubPacket(Type.get, new GetItemsRequest(getId(), subscriptionId));
return getItems(request);
} | java | public <T extends Item> List<T> getItems(String subscriptionId) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
PubSub request = createPubsubPacket(Type.get, new GetItemsRequest(getId(), subscriptionId));
return getItems(request);
} | [
"public",
"<",
"T",
"extends",
"Item",
">",
"List",
"<",
"T",
">",
"getItems",
"(",
"String",
"subscriptionId",
")",
"throws",
"NoResponseException",
",",
"XMPPErrorException",
",",
"NotConnectedException",
",",
"InterruptedException",
"{",
"PubSub",
"request",
"=",
"createPubsubPacket",
"(",
"Type",
".",
"get",
",",
"new",
"GetItemsRequest",
"(",
"getId",
"(",
")",
",",
"subscriptionId",
")",
")",
";",
"return",
"getItems",
"(",
"request",
")",
";",
"}"
] | Get the current items stored in the node based
on the subscription associated with the provided
subscription id.
@param subscriptionId - The subscription id for the
associated subscription.
@param <T> type of the items.
@return List of {@link Item} in the node
@throws XMPPErrorException
@throws NoResponseException if there was no response from the server.
@throws NotConnectedException
@throws InterruptedException | [
"Get",
"the",
"current",
"items",
"stored",
"in",
"the",
"node",
"based",
"on",
"the",
"subscription",
"associated",
"with",
"the",
"provided",
"subscription",
"id",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/LeafNode.java#L91-L94 |
26,779 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/LeafNode.java | LeafNode.send | @SuppressWarnings("unchecked")
@Deprecated
public <T extends Item> void send(T item) throws NotConnectedException, InterruptedException, NoResponseException, XMPPErrorException {
publish(item);
} | java | @SuppressWarnings("unchecked")
@Deprecated
public <T extends Item> void send(T item) throws NotConnectedException, InterruptedException, NoResponseException, XMPPErrorException {
publish(item);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"@",
"Deprecated",
"public",
"<",
"T",
"extends",
"Item",
">",
"void",
"send",
"(",
"T",
"item",
")",
"throws",
"NotConnectedException",
",",
"InterruptedException",
",",
"NoResponseException",
",",
"XMPPErrorException",
"{",
"publish",
"(",
"item",
")",
";",
"}"
] | Publishes an event to the node. This is a simple item
with no payload.
If the id is null, an empty item (one without an id) will be sent.
Please note that this is not the same as {@link #send()}, which
publishes an event with NO item.
@param item - The item being sent
@param <T> type of the items.
@throws NotConnectedException
@throws InterruptedException
@throws XMPPErrorException
@throws NoResponseException
@deprecated use {@link #publish(Item)} instead. | [
"Publishes",
"an",
"event",
"to",
"the",
"node",
".",
"This",
"is",
"a",
"simple",
"item",
"with",
"no",
"payload",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/LeafNode.java#L239-L243 |
26,780 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/LeafNode.java | LeafNode.publish | public void publish() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
PubSub packet = createPubsubPacket(Type.set, new NodeExtension(PubSubElementType.PUBLISH, getId()));
pubSubManager.getConnection().createStanzaCollectorAndSend(packet).nextResultOrThrow();
} | java | public void publish() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
PubSub packet = createPubsubPacket(Type.set, new NodeExtension(PubSubElementType.PUBLISH, getId()));
pubSubManager.getConnection().createStanzaCollectorAndSend(packet).nextResultOrThrow();
} | [
"public",
"void",
"publish",
"(",
")",
"throws",
"NoResponseException",
",",
"XMPPErrorException",
",",
"NotConnectedException",
",",
"InterruptedException",
"{",
"PubSub",
"packet",
"=",
"createPubsubPacket",
"(",
"Type",
".",
"set",
",",
"new",
"NodeExtension",
"(",
"PubSubElementType",
".",
"PUBLISH",
",",
"getId",
"(",
")",
")",
")",
";",
"pubSubManager",
".",
"getConnection",
"(",
")",
".",
"createStanzaCollectorAndSend",
"(",
"packet",
")",
".",
"nextResultOrThrow",
"(",
")",
";",
"}"
] | Publishes an event to the node. This is an empty event
with no item.
This is only acceptable for nodes with {@link ConfigureForm#isPersistItems()}=false
and {@link ConfigureForm#isDeliverPayloads()}=false.
@throws XMPPErrorException
@throws NoResponseException
@throws NotConnectedException
@throws InterruptedException | [
"Publishes",
"an",
"event",
"to",
"the",
"node",
".",
"This",
"is",
"an",
"empty",
"event",
"with",
"no",
"item",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/LeafNode.java#L278-L282 |
26,781 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/LeafNode.java | LeafNode.publish | @SuppressWarnings("unchecked")
public <T extends Item> void publish(T item) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
Collection<T> items = new ArrayList<>(1);
items.add((item == null ? (T) new Item() : item));
publish(items);
} | java | @SuppressWarnings("unchecked")
public <T extends Item> void publish(T item) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
Collection<T> items = new ArrayList<>(1);
items.add((item == null ? (T) new Item() : item));
publish(items);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"T",
"extends",
"Item",
">",
"void",
"publish",
"(",
"T",
"item",
")",
"throws",
"NoResponseException",
",",
"XMPPErrorException",
",",
"NotConnectedException",
",",
"InterruptedException",
"{",
"Collection",
"<",
"T",
">",
"items",
"=",
"new",
"ArrayList",
"<>",
"(",
"1",
")",
";",
"items",
".",
"add",
"(",
"(",
"item",
"==",
"null",
"?",
"(",
"T",
")",
"new",
"Item",
"(",
")",
":",
"item",
")",
")",
";",
"publish",
"(",
"items",
")",
";",
"}"
] | Publishes an event to the node. This can be either a simple item
with no payload, or one with it. This is determined by the Node
configuration.
If the node has <b>deliver_payload=false</b>, the Item must not
have a payload.
If the id is null, an empty item (one without an id) will be sent.
Please note that this is not the same as {@link #send()}, which
publishes an event with NO item.
@param item - The item being sent
@param <T> type of the items.
@throws XMPPErrorException
@throws NoResponseException
@throws NotConnectedException
@throws InterruptedException | [
"Publishes",
"an",
"event",
"to",
"the",
"node",
".",
"This",
"can",
"be",
"either",
"a",
"simple",
"item",
"with",
"no",
"payload",
"or",
"one",
"with",
"it",
".",
"This",
"is",
"determined",
"by",
"the",
"Node",
"configuration",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/LeafNode.java#L305-L310 |
26,782 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/LeafNode.java | LeafNode.deleteAllItems | public void deleteAllItems() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
PubSub request = createPubsubPacket(Type.set, new NodeExtension(PubSubElementType.PURGE_OWNER, getId()));
pubSubManager.getConnection().createStanzaCollectorAndSend(request).nextResultOrThrow();
} | java | public void deleteAllItems() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
PubSub request = createPubsubPacket(Type.set, new NodeExtension(PubSubElementType.PURGE_OWNER, getId()));
pubSubManager.getConnection().createStanzaCollectorAndSend(request).nextResultOrThrow();
} | [
"public",
"void",
"deleteAllItems",
"(",
")",
"throws",
"NoResponseException",
",",
"XMPPErrorException",
",",
"NotConnectedException",
",",
"InterruptedException",
"{",
"PubSub",
"request",
"=",
"createPubsubPacket",
"(",
"Type",
".",
"set",
",",
"new",
"NodeExtension",
"(",
"PubSubElementType",
".",
"PURGE_OWNER",
",",
"getId",
"(",
")",
")",
")",
";",
"pubSubManager",
".",
"getConnection",
"(",
")",
".",
"createStanzaCollectorAndSend",
"(",
"request",
")",
".",
"nextResultOrThrow",
"(",
")",
";",
"}"
] | Purges the node of all items.
<p>Note: Some implementations may keep the last item
sent.
@throws XMPPErrorException
@throws NoResponseException if there was no response from the server.
@throws NotConnectedException
@throws InterruptedException | [
"Purges",
"the",
"node",
"of",
"all",
"items",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/LeafNode.java#L343-L347 |
26,783 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/LeafNode.java | LeafNode.deleteItem | public void deleteItem(String itemId) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
Collection<String> items = new ArrayList<>(1);
items.add(itemId);
deleteItem(items);
} | java | public void deleteItem(String itemId) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
Collection<String> items = new ArrayList<>(1);
items.add(itemId);
deleteItem(items);
} | [
"public",
"void",
"deleteItem",
"(",
"String",
"itemId",
")",
"throws",
"NoResponseException",
",",
"XMPPErrorException",
",",
"NotConnectedException",
",",
"InterruptedException",
"{",
"Collection",
"<",
"String",
">",
"items",
"=",
"new",
"ArrayList",
"<>",
"(",
"1",
")",
";",
"items",
".",
"add",
"(",
"itemId",
")",
";",
"deleteItem",
"(",
"items",
")",
";",
"}"
] | Delete the item with the specified id from the node.
@param itemId The id of the item
@throws XMPPErrorException
@throws NoResponseException
@throws NotConnectedException
@throws InterruptedException | [
"Delete",
"the",
"item",
"with",
"the",
"specified",
"id",
"from",
"the",
"node",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/LeafNode.java#L358-L362 |
26,784 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/LeafNode.java | LeafNode.deleteItem | public void deleteItem(Collection<String> itemIds) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
List<Item> items = new ArrayList<>(itemIds.size());
for (String id : itemIds) {
items.add(new Item(id));
}
PubSub request = createPubsubPacket(Type.set, new ItemsExtension(ItemsExtension.ItemsElementType.retract, getId(), items));
pubSubManager.getConnection().createStanzaCollectorAndSend(request).nextResultOrThrow();
} | java | public void deleteItem(Collection<String> itemIds) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
List<Item> items = new ArrayList<>(itemIds.size());
for (String id : itemIds) {
items.add(new Item(id));
}
PubSub request = createPubsubPacket(Type.set, new ItemsExtension(ItemsExtension.ItemsElementType.retract, getId(), items));
pubSubManager.getConnection().createStanzaCollectorAndSend(request).nextResultOrThrow();
} | [
"public",
"void",
"deleteItem",
"(",
"Collection",
"<",
"String",
">",
"itemIds",
")",
"throws",
"NoResponseException",
",",
"XMPPErrorException",
",",
"NotConnectedException",
",",
"InterruptedException",
"{",
"List",
"<",
"Item",
">",
"items",
"=",
"new",
"ArrayList",
"<>",
"(",
"itemIds",
".",
"size",
"(",
")",
")",
";",
"for",
"(",
"String",
"id",
":",
"itemIds",
")",
"{",
"items",
".",
"add",
"(",
"new",
"Item",
"(",
"id",
")",
")",
";",
"}",
"PubSub",
"request",
"=",
"createPubsubPacket",
"(",
"Type",
".",
"set",
",",
"new",
"ItemsExtension",
"(",
"ItemsExtension",
".",
"ItemsElementType",
".",
"retract",
",",
"getId",
"(",
")",
",",
"items",
")",
")",
";",
"pubSubManager",
".",
"getConnection",
"(",
")",
".",
"createStanzaCollectorAndSend",
"(",
"request",
")",
".",
"nextResultOrThrow",
"(",
")",
";",
"}"
] | Delete the items with the specified id's from the node.
@param itemIds The list of id's of items to delete
@throws XMPPErrorException
@throws NoResponseException if there was no response from the server.
@throws NotConnectedException
@throws InterruptedException | [
"Delete",
"the",
"items",
"with",
"the",
"specified",
"id",
"s",
"from",
"the",
"node",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/LeafNode.java#L373-L381 |
26,785 | igniterealtime/Smack | smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/OpenPgpManager.java | OpenPgpManager.generateAndImportKeyPair | public OpenPgpV4Fingerprint generateAndImportKeyPair(BareJid ourJid)
throws NoSuchAlgorithmException, InvalidAlgorithmParameterException, NoSuchProviderException,
PGPException, IOException {
throwIfNoProviderSet();
OpenPgpStore store = provider.getStore();
PGPKeyRing keys = store.generateKeyRing(ourJid);
try {
store.importSecretKey(ourJid, keys.getSecretKeys());
store.importPublicKey(ourJid, keys.getPublicKeys());
} catch (MissingUserIdOnKeyException e) {
// This should never throw, since we set our jid literally one line above this comment.
throw new AssertionError(e);
}
OpenPgpV4Fingerprint fingerprint = new OpenPgpV4Fingerprint(keys.getSecretKeys());
store.setTrust(ourJid, fingerprint, OpenPgpTrustStore.Trust.trusted);
return fingerprint;
} | java | public OpenPgpV4Fingerprint generateAndImportKeyPair(BareJid ourJid)
throws NoSuchAlgorithmException, InvalidAlgorithmParameterException, NoSuchProviderException,
PGPException, IOException {
throwIfNoProviderSet();
OpenPgpStore store = provider.getStore();
PGPKeyRing keys = store.generateKeyRing(ourJid);
try {
store.importSecretKey(ourJid, keys.getSecretKeys());
store.importPublicKey(ourJid, keys.getPublicKeys());
} catch (MissingUserIdOnKeyException e) {
// This should never throw, since we set our jid literally one line above this comment.
throw new AssertionError(e);
}
OpenPgpV4Fingerprint fingerprint = new OpenPgpV4Fingerprint(keys.getSecretKeys());
store.setTrust(ourJid, fingerprint, OpenPgpTrustStore.Trust.trusted);
return fingerprint;
} | [
"public",
"OpenPgpV4Fingerprint",
"generateAndImportKeyPair",
"(",
"BareJid",
"ourJid",
")",
"throws",
"NoSuchAlgorithmException",
",",
"InvalidAlgorithmParameterException",
",",
"NoSuchProviderException",
",",
"PGPException",
",",
"IOException",
"{",
"throwIfNoProviderSet",
"(",
")",
";",
"OpenPgpStore",
"store",
"=",
"provider",
".",
"getStore",
"(",
")",
";",
"PGPKeyRing",
"keys",
"=",
"store",
".",
"generateKeyRing",
"(",
"ourJid",
")",
";",
"try",
"{",
"store",
".",
"importSecretKey",
"(",
"ourJid",
",",
"keys",
".",
"getSecretKeys",
"(",
")",
")",
";",
"store",
".",
"importPublicKey",
"(",
"ourJid",
",",
"keys",
".",
"getPublicKeys",
"(",
")",
")",
";",
"}",
"catch",
"(",
"MissingUserIdOnKeyException",
"e",
")",
"{",
"// This should never throw, since we set our jid literally one line above this comment.",
"throw",
"new",
"AssertionError",
"(",
"e",
")",
";",
"}",
"OpenPgpV4Fingerprint",
"fingerprint",
"=",
"new",
"OpenPgpV4Fingerprint",
"(",
"keys",
".",
"getSecretKeys",
"(",
")",
")",
";",
"store",
".",
"setTrust",
"(",
"ourJid",
",",
"fingerprint",
",",
"OpenPgpTrustStore",
".",
"Trust",
".",
"trusted",
")",
";",
"return",
"fingerprint",
";",
"}"
] | Generate a fresh OpenPGP key pair and import it.
@param ourJid our {@link BareJid}.
@return {@link OpenPgpV4Fingerprint} of the generated key.
@throws NoSuchAlgorithmException if the JVM doesn't support one of the used algorithms.
@throws InvalidAlgorithmParameterException if the used algorithm parameters are invalid.
@throws NoSuchProviderException if we are missing a cryptographic provider.
@throws PGPException PGP is brittle.
@throws IOException IO is dangerous. | [
"Generate",
"a",
"fresh",
"OpenPGP",
"key",
"pair",
"and",
"import",
"it",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/OpenPgpManager.java#L297-L317 |
26,786 | igniterealtime/Smack | smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/OpenPgpManager.java | OpenPgpManager.serverSupportsSecretKeyBackups | public static boolean serverSupportsSecretKeyBackups(XMPPConnection connection)
throws XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException,
SmackException.NoResponseException {
return ServiceDiscoveryManager.getInstanceFor(connection)
.serverSupportsFeature(PubSubFeature.access_whitelist.toString());
} | java | public static boolean serverSupportsSecretKeyBackups(XMPPConnection connection)
throws XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException,
SmackException.NoResponseException {
return ServiceDiscoveryManager.getInstanceFor(connection)
.serverSupportsFeature(PubSubFeature.access_whitelist.toString());
} | [
"public",
"static",
"boolean",
"serverSupportsSecretKeyBackups",
"(",
"XMPPConnection",
"connection",
")",
"throws",
"XMPPException",
".",
"XMPPErrorException",
",",
"SmackException",
".",
"NotConnectedException",
",",
"InterruptedException",
",",
"SmackException",
".",
"NoResponseException",
"{",
"return",
"ServiceDiscoveryManager",
".",
"getInstanceFor",
"(",
"connection",
")",
".",
"serverSupportsFeature",
"(",
"PubSubFeature",
".",
"access_whitelist",
".",
"toString",
"(",
")",
")",
";",
"}"
] | Determine, if we can sync secret keys using private PEP nodes as described in the XEP.
Requirements on the server side are support for PEP and support for the whitelist access model of PubSub.
@see <a href="https://xmpp.org/extensions/xep-0373.html#synchro-pep">XEP-0373 §5</a>
@param connection XMPP connection
@return true, if the server supports secret key backups, otherwise false.
@throws XMPPException.XMPPErrorException in case of an XMPP protocol error.
@throws SmackException.NotConnectedException if we are not connected.
@throws InterruptedException if the thread is interrupted.
@throws SmackException.NoResponseException if the server doesn't respond. | [
"Determine",
"if",
"we",
"can",
"sync",
"secret",
"keys",
"using",
"private",
"PEP",
"nodes",
"as",
"described",
"in",
"the",
"XEP",
".",
"Requirements",
"on",
"the",
"server",
"side",
"are",
"support",
"for",
"PEP",
"and",
"support",
"for",
"the",
"whitelist",
"access",
"model",
"of",
"PubSub",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/OpenPgpManager.java#L372-L377 |
26,787 | igniterealtime/Smack | smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/OpenPgpManager.java | OpenPgpManager.backupSecretKeyToServer | public void backupSecretKeyToServer(DisplayBackupCodeCallback displayCodeCallback,
SecretKeyBackupSelectionCallback selectKeyCallback)
throws InterruptedException, PubSubException.NotALeafNodeException,
XMPPException.XMPPErrorException, SmackException.NotConnectedException, SmackException.NoResponseException,
SmackException.NotLoggedInException, IOException,
SmackException.FeatureNotSupportedException, PGPException, MissingOpenPgpKeyException {
throwIfNoProviderSet();
throwIfNotAuthenticated();
BareJid ownJid = connection().getUser().asBareJid();
String backupCode = SecretKeyBackupHelper.generateBackupPassword();
PGPSecretKeyRingCollection secretKeyRings = provider.getStore().getSecretKeysOf(ownJid);
Set<OpenPgpV4Fingerprint> availableKeyPairs = new HashSet<>();
for (PGPSecretKeyRing ring : secretKeyRings) {
availableKeyPairs.add(new OpenPgpV4Fingerprint(ring));
}
Set<OpenPgpV4Fingerprint> selectedKeyPairs = selectKeyCallback.selectKeysToBackup(availableKeyPairs);
SecretkeyElement secretKey = SecretKeyBackupHelper.createSecretkeyElement(provider, ownJid, selectedKeyPairs, backupCode);
OpenPgpPubSubUtil.depositSecretKey(connection(), secretKey);
displayCodeCallback.displayBackupCode(backupCode);
} | java | public void backupSecretKeyToServer(DisplayBackupCodeCallback displayCodeCallback,
SecretKeyBackupSelectionCallback selectKeyCallback)
throws InterruptedException, PubSubException.NotALeafNodeException,
XMPPException.XMPPErrorException, SmackException.NotConnectedException, SmackException.NoResponseException,
SmackException.NotLoggedInException, IOException,
SmackException.FeatureNotSupportedException, PGPException, MissingOpenPgpKeyException {
throwIfNoProviderSet();
throwIfNotAuthenticated();
BareJid ownJid = connection().getUser().asBareJid();
String backupCode = SecretKeyBackupHelper.generateBackupPassword();
PGPSecretKeyRingCollection secretKeyRings = provider.getStore().getSecretKeysOf(ownJid);
Set<OpenPgpV4Fingerprint> availableKeyPairs = new HashSet<>();
for (PGPSecretKeyRing ring : secretKeyRings) {
availableKeyPairs.add(new OpenPgpV4Fingerprint(ring));
}
Set<OpenPgpV4Fingerprint> selectedKeyPairs = selectKeyCallback.selectKeysToBackup(availableKeyPairs);
SecretkeyElement secretKey = SecretKeyBackupHelper.createSecretkeyElement(provider, ownJid, selectedKeyPairs, backupCode);
OpenPgpPubSubUtil.depositSecretKey(connection(), secretKey);
displayCodeCallback.displayBackupCode(backupCode);
} | [
"public",
"void",
"backupSecretKeyToServer",
"(",
"DisplayBackupCodeCallback",
"displayCodeCallback",
",",
"SecretKeyBackupSelectionCallback",
"selectKeyCallback",
")",
"throws",
"InterruptedException",
",",
"PubSubException",
".",
"NotALeafNodeException",
",",
"XMPPException",
".",
"XMPPErrorException",
",",
"SmackException",
".",
"NotConnectedException",
",",
"SmackException",
".",
"NoResponseException",
",",
"SmackException",
".",
"NotLoggedInException",
",",
"IOException",
",",
"SmackException",
".",
"FeatureNotSupportedException",
",",
"PGPException",
",",
"MissingOpenPgpKeyException",
"{",
"throwIfNoProviderSet",
"(",
")",
";",
"throwIfNotAuthenticated",
"(",
")",
";",
"BareJid",
"ownJid",
"=",
"connection",
"(",
")",
".",
"getUser",
"(",
")",
".",
"asBareJid",
"(",
")",
";",
"String",
"backupCode",
"=",
"SecretKeyBackupHelper",
".",
"generateBackupPassword",
"(",
")",
";",
"PGPSecretKeyRingCollection",
"secretKeyRings",
"=",
"provider",
".",
"getStore",
"(",
")",
".",
"getSecretKeysOf",
"(",
"ownJid",
")",
";",
"Set",
"<",
"OpenPgpV4Fingerprint",
">",
"availableKeyPairs",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"for",
"(",
"PGPSecretKeyRing",
"ring",
":",
"secretKeyRings",
")",
"{",
"availableKeyPairs",
".",
"add",
"(",
"new",
"OpenPgpV4Fingerprint",
"(",
"ring",
")",
")",
";",
"}",
"Set",
"<",
"OpenPgpV4Fingerprint",
">",
"selectedKeyPairs",
"=",
"selectKeyCallback",
".",
"selectKeysToBackup",
"(",
"availableKeyPairs",
")",
";",
"SecretkeyElement",
"secretKey",
"=",
"SecretKeyBackupHelper",
".",
"createSecretkeyElement",
"(",
"provider",
",",
"ownJid",
",",
"selectedKeyPairs",
",",
"backupCode",
")",
";",
"OpenPgpPubSubUtil",
".",
"depositSecretKey",
"(",
"connection",
"(",
")",
",",
"secretKey",
")",
";",
"displayCodeCallback",
".",
"displayBackupCode",
"(",
"backupCode",
")",
";",
"}"
] | Upload the encrypted secret key to a private PEP node.
@see <a href="https://xmpp.org/extensions/xep-0373.html#synchro-pep">XEP-0373 §5</a>
@param displayCodeCallback callback, which will receive the backup password used to encrypt the secret key.
@param selectKeyCallback callback, which will receive the users choice of which keys will be backed up.
@throws InterruptedException if the thread is interrupted.
@throws PubSubException.NotALeafNodeException if the private node is not a {@link LeafNode}.
@throws XMPPException.XMPPErrorException in case of an XMPP protocol error.
@throws SmackException.NotConnectedException if we are not connected.
@throws SmackException.NoResponseException if the server doesn't respond.
@throws SmackException.NotLoggedInException if we are not logged in.
@throws IOException IO is dangerous.
@throws SmackException.FeatureNotSupportedException if the server doesn't support the PubSub whitelist access model.
@throws PGPException PGP is brittle
@throws MissingOpenPgpKeyException in case we have no OpenPGP key pair to back up. | [
"Upload",
"the",
"encrypted",
"secret",
"key",
"to",
"a",
"private",
"PEP",
"node",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/OpenPgpManager.java#L404-L430 |
26,788 | igniterealtime/Smack | smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/OpenPgpManager.java | OpenPgpManager.restoreSecretKeyServerBackup | public OpenPgpV4Fingerprint restoreSecretKeyServerBackup(AskForBackupCodeCallback codeCallback)
throws InterruptedException, PubSubException.NotALeafNodeException, XMPPException.XMPPErrorException,
SmackException.NotConnectedException, SmackException.NoResponseException,
InvalidBackupCodeException, SmackException.NotLoggedInException, IOException, MissingUserIdOnKeyException,
NoBackupFoundException, PGPException {
throwIfNoProviderSet();
throwIfNotAuthenticated();
SecretkeyElement backup = OpenPgpPubSubUtil.fetchSecretKey(pepManager);
if (backup == null) {
throw new NoBackupFoundException();
}
String backupCode = codeCallback.askForBackupCode();
PGPSecretKeyRing secretKeys = SecretKeyBackupHelper.restoreSecretKeyBackup(backup, backupCode);
provider.getStore().importSecretKey(getJidOrThrow(), secretKeys);
provider.getStore().importPublicKey(getJidOrThrow(), BCUtil.publicKeyRingFromSecretKeyRing(secretKeys));
ByteArrayOutputStream buffer = new ByteArrayOutputStream(2048);
for (PGPSecretKey sk : secretKeys) {
PGPPublicKey pk = sk.getPublicKey();
if (pk != null) pk.encode(buffer);
}
PGPPublicKeyRing publicKeys = new PGPPublicKeyRing(buffer.toByteArray(), new BcKeyFingerprintCalculator());
provider.getStore().importPublicKey(getJidOrThrow(), publicKeys);
return new OpenPgpV4Fingerprint(secretKeys);
} | java | public OpenPgpV4Fingerprint restoreSecretKeyServerBackup(AskForBackupCodeCallback codeCallback)
throws InterruptedException, PubSubException.NotALeafNodeException, XMPPException.XMPPErrorException,
SmackException.NotConnectedException, SmackException.NoResponseException,
InvalidBackupCodeException, SmackException.NotLoggedInException, IOException, MissingUserIdOnKeyException,
NoBackupFoundException, PGPException {
throwIfNoProviderSet();
throwIfNotAuthenticated();
SecretkeyElement backup = OpenPgpPubSubUtil.fetchSecretKey(pepManager);
if (backup == null) {
throw new NoBackupFoundException();
}
String backupCode = codeCallback.askForBackupCode();
PGPSecretKeyRing secretKeys = SecretKeyBackupHelper.restoreSecretKeyBackup(backup, backupCode);
provider.getStore().importSecretKey(getJidOrThrow(), secretKeys);
provider.getStore().importPublicKey(getJidOrThrow(), BCUtil.publicKeyRingFromSecretKeyRing(secretKeys));
ByteArrayOutputStream buffer = new ByteArrayOutputStream(2048);
for (PGPSecretKey sk : secretKeys) {
PGPPublicKey pk = sk.getPublicKey();
if (pk != null) pk.encode(buffer);
}
PGPPublicKeyRing publicKeys = new PGPPublicKeyRing(buffer.toByteArray(), new BcKeyFingerprintCalculator());
provider.getStore().importPublicKey(getJidOrThrow(), publicKeys);
return new OpenPgpV4Fingerprint(secretKeys);
} | [
"public",
"OpenPgpV4Fingerprint",
"restoreSecretKeyServerBackup",
"(",
"AskForBackupCodeCallback",
"codeCallback",
")",
"throws",
"InterruptedException",
",",
"PubSubException",
".",
"NotALeafNodeException",
",",
"XMPPException",
".",
"XMPPErrorException",
",",
"SmackException",
".",
"NotConnectedException",
",",
"SmackException",
".",
"NoResponseException",
",",
"InvalidBackupCodeException",
",",
"SmackException",
".",
"NotLoggedInException",
",",
"IOException",
",",
"MissingUserIdOnKeyException",
",",
"NoBackupFoundException",
",",
"PGPException",
"{",
"throwIfNoProviderSet",
"(",
")",
";",
"throwIfNotAuthenticated",
"(",
")",
";",
"SecretkeyElement",
"backup",
"=",
"OpenPgpPubSubUtil",
".",
"fetchSecretKey",
"(",
"pepManager",
")",
";",
"if",
"(",
"backup",
"==",
"null",
")",
"{",
"throw",
"new",
"NoBackupFoundException",
"(",
")",
";",
"}",
"String",
"backupCode",
"=",
"codeCallback",
".",
"askForBackupCode",
"(",
")",
";",
"PGPSecretKeyRing",
"secretKeys",
"=",
"SecretKeyBackupHelper",
".",
"restoreSecretKeyBackup",
"(",
"backup",
",",
"backupCode",
")",
";",
"provider",
".",
"getStore",
"(",
")",
".",
"importSecretKey",
"(",
"getJidOrThrow",
"(",
")",
",",
"secretKeys",
")",
";",
"provider",
".",
"getStore",
"(",
")",
".",
"importPublicKey",
"(",
"getJidOrThrow",
"(",
")",
",",
"BCUtil",
".",
"publicKeyRingFromSecretKeyRing",
"(",
"secretKeys",
")",
")",
";",
"ByteArrayOutputStream",
"buffer",
"=",
"new",
"ByteArrayOutputStream",
"(",
"2048",
")",
";",
"for",
"(",
"PGPSecretKey",
"sk",
":",
"secretKeys",
")",
"{",
"PGPPublicKey",
"pk",
"=",
"sk",
".",
"getPublicKey",
"(",
")",
";",
"if",
"(",
"pk",
"!=",
"null",
")",
"pk",
".",
"encode",
"(",
"buffer",
")",
";",
"}",
"PGPPublicKeyRing",
"publicKeys",
"=",
"new",
"PGPPublicKeyRing",
"(",
"buffer",
".",
"toByteArray",
"(",
")",
",",
"new",
"BcKeyFingerprintCalculator",
"(",
")",
")",
";",
"provider",
".",
"getStore",
"(",
")",
".",
"importPublicKey",
"(",
"getJidOrThrow",
"(",
")",
",",
"publicKeys",
")",
";",
"return",
"new",
"OpenPgpV4Fingerprint",
"(",
"secretKeys",
")",
";",
"}"
] | Fetch a secret key backup from the server and try to restore a selected secret key from it.
@param codeCallback callback for prompting the user to provide the secret backup code.
@return fingerprint of the restored secret key
@throws InterruptedException if the thread gets interrupted.
@throws PubSubException.NotALeafNodeException if the private node is not a {@link LeafNode}.
@throws XMPPException.XMPPErrorException in case of an XMPP protocol error.
@throws SmackException.NotConnectedException if we are not connected.
@throws SmackException.NoResponseException if the server doesn't respond.
@throws InvalidBackupCodeException if the user-provided backup code is invalid.
@throws SmackException.NotLoggedInException if we are not logged in
@throws IOException IO is dangerous
@throws MissingUserIdOnKeyException if the key that is to be imported is missing a user-id with our jid
@throws NoBackupFoundException if no secret key backup has been found
@throws PGPException in case the restored secret key is damaged. | [
"Fetch",
"a",
"secret",
"key",
"backup",
"from",
"the",
"server",
"and",
"try",
"to",
"restore",
"a",
"selected",
"secret",
"key",
"from",
"it",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/OpenPgpManager.java#L466-L493 |
26,789 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/privacy/packet/PrivacyItem.java | PrivacyItem.toXML | public String toXML() {
StringBuilder buf = new StringBuilder();
buf.append("<item");
if (this.isAllow()) {
buf.append(" action=\"allow\"");
} else {
buf.append(" action=\"deny\"");
}
buf.append(" order=\"").append(getOrder()).append('"');
if (getType() != null) {
buf.append(" type=\"").append(getType()).append('"');
}
if (getValue() != null) {
buf.append(" value=\"").append(getValue()).append('"');
}
if (isFilterEverything()) {
buf.append("/>");
} else {
buf.append('>');
if (this.isFilterIQ()) {
buf.append("<iq/>");
}
if (this.isFilterMessage()) {
buf.append("<message/>");
}
if (this.isFilterPresenceIn()) {
buf.append("<presence-in/>");
}
if (this.isFilterPresenceOut()) {
buf.append("<presence-out/>");
}
buf.append("</item>");
}
// CHECKSTYLE:ON
return buf.toString();
} | java | public String toXML() {
StringBuilder buf = new StringBuilder();
buf.append("<item");
if (this.isAllow()) {
buf.append(" action=\"allow\"");
} else {
buf.append(" action=\"deny\"");
}
buf.append(" order=\"").append(getOrder()).append('"');
if (getType() != null) {
buf.append(" type=\"").append(getType()).append('"');
}
if (getValue() != null) {
buf.append(" value=\"").append(getValue()).append('"');
}
if (isFilterEverything()) {
buf.append("/>");
} else {
buf.append('>');
if (this.isFilterIQ()) {
buf.append("<iq/>");
}
if (this.isFilterMessage()) {
buf.append("<message/>");
}
if (this.isFilterPresenceIn()) {
buf.append("<presence-in/>");
}
if (this.isFilterPresenceOut()) {
buf.append("<presence-out/>");
}
buf.append("</item>");
}
// CHECKSTYLE:ON
return buf.toString();
} | [
"public",
"String",
"toXML",
"(",
")",
"{",
"StringBuilder",
"buf",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"buf",
".",
"append",
"(",
"\"<item\"",
")",
";",
"if",
"(",
"this",
".",
"isAllow",
"(",
")",
")",
"{",
"buf",
".",
"append",
"(",
"\" action=\\\"allow\\\"\"",
")",
";",
"}",
"else",
"{",
"buf",
".",
"append",
"(",
"\" action=\\\"deny\\\"\"",
")",
";",
"}",
"buf",
".",
"append",
"(",
"\" order=\\\"\"",
")",
".",
"append",
"(",
"getOrder",
"(",
")",
")",
".",
"append",
"(",
"'",
"'",
")",
";",
"if",
"(",
"getType",
"(",
")",
"!=",
"null",
")",
"{",
"buf",
".",
"append",
"(",
"\" type=\\\"\"",
")",
".",
"append",
"(",
"getType",
"(",
")",
")",
".",
"append",
"(",
"'",
"'",
")",
";",
"}",
"if",
"(",
"getValue",
"(",
")",
"!=",
"null",
")",
"{",
"buf",
".",
"append",
"(",
"\" value=\\\"\"",
")",
".",
"append",
"(",
"getValue",
"(",
")",
")",
".",
"append",
"(",
"'",
"'",
")",
";",
"}",
"if",
"(",
"isFilterEverything",
"(",
")",
")",
"{",
"buf",
".",
"append",
"(",
"\"/>\"",
")",
";",
"}",
"else",
"{",
"buf",
".",
"append",
"(",
"'",
"'",
")",
";",
"if",
"(",
"this",
".",
"isFilterIQ",
"(",
")",
")",
"{",
"buf",
".",
"append",
"(",
"\"<iq/>\"",
")",
";",
"}",
"if",
"(",
"this",
".",
"isFilterMessage",
"(",
")",
")",
"{",
"buf",
".",
"append",
"(",
"\"<message/>\"",
")",
";",
"}",
"if",
"(",
"this",
".",
"isFilterPresenceIn",
"(",
")",
")",
"{",
"buf",
".",
"append",
"(",
"\"<presence-in/>\"",
")",
";",
"}",
"if",
"(",
"this",
".",
"isFilterPresenceOut",
"(",
")",
")",
"{",
"buf",
".",
"append",
"(",
"\"<presence-out/>\"",
")",
";",
"}",
"buf",
".",
"append",
"(",
"\"</item>\"",
")",
";",
"}",
"// CHECKSTYLE:ON",
"return",
"buf",
".",
"toString",
"(",
")",
";",
"}"
] | Answer an xml representation of the receiver according to the RFC 3921.
@return the text xml representation. | [
"Answer",
"an",
"xml",
"representation",
"of",
"the",
"receiver",
"according",
"to",
"the",
"RFC",
"3921",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/privacy/packet/PrivacyItem.java#L291-L326 |
26,790 | igniterealtime/Smack | smack-core/src/main/java/org/jivesoftware/smack/provider/IntrospectionProvider.java | IntrospectionProvider.decode | private static Object decode(Class<?> type, String value) throws ClassNotFoundException {
String name = type.getName();
switch (name) {
case "java.lang.String":
return value;
case "boolean":
// CHECKSTYLE:OFF
return Boolean.valueOf(value);
// CHECKSTYLE:ON
case "int":
return Integer.valueOf(value);
case "long":
return Long.valueOf(value);
case "float":
return Float.valueOf(value);
case "double":
return Double.valueOf(value);
case "short":
return Short.valueOf(value);
case "byte":
return Byte.valueOf(value);
case "java.lang.Class":
return Class.forName(value);
}
return null;
} | java | private static Object decode(Class<?> type, String value) throws ClassNotFoundException {
String name = type.getName();
switch (name) {
case "java.lang.String":
return value;
case "boolean":
// CHECKSTYLE:OFF
return Boolean.valueOf(value);
// CHECKSTYLE:ON
case "int":
return Integer.valueOf(value);
case "long":
return Long.valueOf(value);
case "float":
return Float.valueOf(value);
case "double":
return Double.valueOf(value);
case "short":
return Short.valueOf(value);
case "byte":
return Byte.valueOf(value);
case "java.lang.Class":
return Class.forName(value);
}
return null;
} | [
"private",
"static",
"Object",
"decode",
"(",
"Class",
"<",
"?",
">",
"type",
",",
"String",
"value",
")",
"throws",
"ClassNotFoundException",
"{",
"String",
"name",
"=",
"type",
".",
"getName",
"(",
")",
";",
"switch",
"(",
"name",
")",
"{",
"case",
"\"java.lang.String\"",
":",
"return",
"value",
";",
"case",
"\"boolean\"",
":",
"// CHECKSTYLE:OFF",
"return",
"Boolean",
".",
"valueOf",
"(",
"value",
")",
";",
"// CHECKSTYLE:ON",
"case",
"\"int\"",
":",
"return",
"Integer",
".",
"valueOf",
"(",
"value",
")",
";",
"case",
"\"long\"",
":",
"return",
"Long",
".",
"valueOf",
"(",
"value",
")",
";",
"case",
"\"float\"",
":",
"return",
"Float",
".",
"valueOf",
"(",
"value",
")",
";",
"case",
"\"double\"",
":",
"return",
"Double",
".",
"valueOf",
"(",
"value",
")",
";",
"case",
"\"short\"",
":",
"return",
"Short",
".",
"valueOf",
"(",
"value",
")",
";",
"case",
"\"byte\"",
":",
"return",
"Byte",
".",
"valueOf",
"(",
"value",
")",
";",
"case",
"\"java.lang.Class\"",
":",
"return",
"Class",
".",
"forName",
"(",
"value",
")",
";",
"}",
"return",
"null",
";",
"}"
] | Decodes a String into an object of the specified type. If the object
type is not supported, null will be returned.
@param type the type of the property.
@param value the encode String value to decode.
@return the String value decoded into the specified type.
@throws ClassNotFoundException | [
"Decodes",
"a",
"String",
"into",
"an",
"object",
"of",
"the",
"specified",
"type",
".",
"If",
"the",
"object",
"type",
"is",
"not",
"supported",
"null",
"will",
"be",
"returned",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-core/src/main/java/org/jivesoftware/smack/provider/IntrospectionProvider.java#L120-L145 |
26,791 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/xhtmlim/XHTMLManager.java | XHTMLManager.getBodies | public static List<CharSequence> getBodies(Message message) {
XHTMLExtension xhtmlExtension = XHTMLExtension.from(message);
if (xhtmlExtension != null)
return xhtmlExtension.getBodies();
else
return null;
} | java | public static List<CharSequence> getBodies(Message message) {
XHTMLExtension xhtmlExtension = XHTMLExtension.from(message);
if (xhtmlExtension != null)
return xhtmlExtension.getBodies();
else
return null;
} | [
"public",
"static",
"List",
"<",
"CharSequence",
">",
"getBodies",
"(",
"Message",
"message",
")",
"{",
"XHTMLExtension",
"xhtmlExtension",
"=",
"XHTMLExtension",
".",
"from",
"(",
"message",
")",
";",
"if",
"(",
"xhtmlExtension",
"!=",
"null",
")",
"return",
"xhtmlExtension",
".",
"getBodies",
"(",
")",
";",
"else",
"return",
"null",
";",
"}"
] | Returns an Iterator for the XHTML bodies in the message. Returns null if
the message does not contain an XHTML extension.
@param message an XHTML message
@return an Iterator for the bodies in the message or null if none. | [
"Returns",
"an",
"Iterator",
"for",
"the",
"XHTML",
"bodies",
"in",
"the",
"message",
".",
"Returns",
"null",
"if",
"the",
"message",
"does",
"not",
"contain",
"an",
"XHTML",
"extension",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/xhtmlim/XHTMLManager.java#L60-L66 |
26,792 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/xhtmlim/XHTMLManager.java | XHTMLManager.addBody | public static void addBody(Message message, XHTMLText xhtmlText) {
XHTMLExtension xhtmlExtension = XHTMLExtension.from(message);
if (xhtmlExtension == null) {
// Create an XHTMLExtension and add it to the message
xhtmlExtension = new XHTMLExtension();
message.addExtension(xhtmlExtension);
}
// Add the required bodies to the message
xhtmlExtension.addBody(xhtmlText.toXML());
} | java | public static void addBody(Message message, XHTMLText xhtmlText) {
XHTMLExtension xhtmlExtension = XHTMLExtension.from(message);
if (xhtmlExtension == null) {
// Create an XHTMLExtension and add it to the message
xhtmlExtension = new XHTMLExtension();
message.addExtension(xhtmlExtension);
}
// Add the required bodies to the message
xhtmlExtension.addBody(xhtmlText.toXML());
} | [
"public",
"static",
"void",
"addBody",
"(",
"Message",
"message",
",",
"XHTMLText",
"xhtmlText",
")",
"{",
"XHTMLExtension",
"xhtmlExtension",
"=",
"XHTMLExtension",
".",
"from",
"(",
"message",
")",
";",
"if",
"(",
"xhtmlExtension",
"==",
"null",
")",
"{",
"// Create an XHTMLExtension and add it to the message",
"xhtmlExtension",
"=",
"new",
"XHTMLExtension",
"(",
")",
";",
"message",
".",
"addExtension",
"(",
"xhtmlExtension",
")",
";",
"}",
"// Add the required bodies to the message",
"xhtmlExtension",
".",
"addBody",
"(",
"xhtmlText",
".",
"toXML",
"(",
")",
")",
";",
"}"
] | Adds an XHTML body to the message.
@param message the message that will receive the XHTML body
@param xhtmlText the string to add as an XHTML body to the message | [
"Adds",
"an",
"XHTML",
"body",
"to",
"the",
"message",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/xhtmlim/XHTMLManager.java#L74-L83 |
26,793 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/xhtmlim/XHTMLManager.java | XHTMLManager.isXHTMLMessage | public static boolean isXHTMLMessage(Message message) {
return message.getExtension(XHTMLExtension.ELEMENT, XHTMLExtension.NAMESPACE) != null;
} | java | public static boolean isXHTMLMessage(Message message) {
return message.getExtension(XHTMLExtension.ELEMENT, XHTMLExtension.NAMESPACE) != null;
} | [
"public",
"static",
"boolean",
"isXHTMLMessage",
"(",
"Message",
"message",
")",
"{",
"return",
"message",
".",
"getExtension",
"(",
"XHTMLExtension",
".",
"ELEMENT",
",",
"XHTMLExtension",
".",
"NAMESPACE",
")",
"!=",
"null",
";",
"}"
] | Returns true if the message contains an XHTML extension.
@param message the message to check if contains an XHTML extension or not
@return a boolean indicating whether the message is an XHTML message | [
"Returns",
"true",
"if",
"the",
"message",
"contains",
"an",
"XHTML",
"extension",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/xhtmlim/XHTMLManager.java#L91-L93 |
26,794 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/xhtmlim/XHTMLManager.java | XHTMLManager.isServiceEnabled | public static boolean isServiceEnabled(XMPPConnection connection, Jid userID)
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
return ServiceDiscoveryManager.getInstanceFor(connection).supportsFeature(userID, XHTMLExtension.NAMESPACE);
} | java | public static boolean isServiceEnabled(XMPPConnection connection, Jid userID)
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
return ServiceDiscoveryManager.getInstanceFor(connection).supportsFeature(userID, XHTMLExtension.NAMESPACE);
} | [
"public",
"static",
"boolean",
"isServiceEnabled",
"(",
"XMPPConnection",
"connection",
",",
"Jid",
"userID",
")",
"throws",
"NoResponseException",
",",
"XMPPErrorException",
",",
"NotConnectedException",
",",
"InterruptedException",
"{",
"return",
"ServiceDiscoveryManager",
".",
"getInstanceFor",
"(",
"connection",
")",
".",
"supportsFeature",
"(",
"userID",
",",
"XHTMLExtension",
".",
"NAMESPACE",
")",
";",
"}"
] | Returns true if the specified user handles XHTML messages.
@param connection the connection to use to perform the service discovery
@param userID the user to check. A fully qualified xmpp ID, e.g. jdoe@example.com
@return a boolean indicating whether the specified user handles XHTML messages
@throws XMPPErrorException
@throws NoResponseException
@throws NotConnectedException
@throws InterruptedException | [
"Returns",
"true",
"if",
"the",
"specified",
"user",
"handles",
"XHTML",
"messages",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/xhtmlim/XHTMLManager.java#L137-L140 |
26,795 | igniterealtime/Smack | smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/FileBasedOmemoStore.java | FileBasedOmemoStore.deleteDirectory | public static void deleteDirectory(File root) {
File[] currList;
Stack<File> stack = new Stack<>();
stack.push(root);
while (!stack.isEmpty()) {
if (stack.lastElement().isDirectory()) {
currList = stack.lastElement().listFiles();
if (currList != null && currList.length > 0) {
for (File curr : currList) {
stack.push(curr);
}
} else {
stack.pop().delete();
}
} else {
stack.pop().delete();
}
}
} | java | public static void deleteDirectory(File root) {
File[] currList;
Stack<File> stack = new Stack<>();
stack.push(root);
while (!stack.isEmpty()) {
if (stack.lastElement().isDirectory()) {
currList = stack.lastElement().listFiles();
if (currList != null && currList.length > 0) {
for (File curr : currList) {
stack.push(curr);
}
} else {
stack.pop().delete();
}
} else {
stack.pop().delete();
}
}
} | [
"public",
"static",
"void",
"deleteDirectory",
"(",
"File",
"root",
")",
"{",
"File",
"[",
"]",
"currList",
";",
"Stack",
"<",
"File",
">",
"stack",
"=",
"new",
"Stack",
"<>",
"(",
")",
";",
"stack",
".",
"push",
"(",
"root",
")",
";",
"while",
"(",
"!",
"stack",
".",
"isEmpty",
"(",
")",
")",
"{",
"if",
"(",
"stack",
".",
"lastElement",
"(",
")",
".",
"isDirectory",
"(",
")",
")",
"{",
"currList",
"=",
"stack",
".",
"lastElement",
"(",
")",
".",
"listFiles",
"(",
")",
";",
"if",
"(",
"currList",
"!=",
"null",
"&&",
"currList",
".",
"length",
">",
"0",
")",
"{",
"for",
"(",
"File",
"curr",
":",
"currList",
")",
"{",
"stack",
".",
"push",
"(",
"curr",
")",
";",
"}",
"}",
"else",
"{",
"stack",
".",
"pop",
"(",
")",
".",
"delete",
"(",
")",
";",
"}",
"}",
"else",
"{",
"stack",
".",
"pop",
"(",
")",
".",
"delete",
"(",
")",
";",
"}",
"}",
"}"
] | Delete a directory with all subdirectories.
@param root | [
"Delete",
"a",
"directory",
"with",
"all",
"subdirectories",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/FileBasedOmemoStore.java#L690-L708 |
26,796 | igniterealtime/Smack | smack-core/src/main/java/org/jivesoftware/smack/util/LazyStringBuilder.java | LazyStringBuilder.getAsList | public List<CharSequence> getAsList() {
if (cache != null) {
return Collections.singletonList((CharSequence) cache);
}
return Collections.unmodifiableList(list);
} | java | public List<CharSequence> getAsList() {
if (cache != null) {
return Collections.singletonList((CharSequence) cache);
}
return Collections.unmodifiableList(list);
} | [
"public",
"List",
"<",
"CharSequence",
">",
"getAsList",
"(",
")",
"{",
"if",
"(",
"cache",
"!=",
"null",
")",
"{",
"return",
"Collections",
".",
"singletonList",
"(",
"(",
"CharSequence",
")",
"cache",
")",
";",
"}",
"return",
"Collections",
".",
"unmodifiableList",
"(",
"list",
")",
";",
"}"
] | Get the List of CharSequences representation of this instance. The list is unmodifiable. If
the resulting String was already cached, a list with a single String entry will be returned.
@return a List of CharSequences representing this instance. | [
"Get",
"the",
"List",
"of",
"CharSequences",
"representation",
"of",
"this",
"instance",
".",
"The",
"list",
"is",
"unmodifiable",
".",
"If",
"the",
"resulting",
"String",
"was",
"already",
"cached",
"a",
"list",
"with",
"a",
"single",
"String",
"entry",
"will",
"be",
"returned",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-core/src/main/java/org/jivesoftware/smack/util/LazyStringBuilder.java#L135-L140 |
26,797 | igniterealtime/Smack | smack-core/src/main/java/org/jivesoftware/smack/util/XmlStringBuilder.java | XmlStringBuilder.attribute | public XmlStringBuilder attribute(String name, String value) {
assert value != null;
sb.append(' ').append(name).append("='");
escapeAttributeValue(value);
sb.append('\'');
return this;
} | java | public XmlStringBuilder attribute(String name, String value) {
assert value != null;
sb.append(' ').append(name).append("='");
escapeAttributeValue(value);
sb.append('\'');
return this;
} | [
"public",
"XmlStringBuilder",
"attribute",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"assert",
"value",
"!=",
"null",
";",
"sb",
".",
"append",
"(",
"'",
"'",
")",
".",
"append",
"(",
"name",
")",
".",
"append",
"(",
"\"='\"",
")",
";",
"escapeAttributeValue",
"(",
"value",
")",
";",
"sb",
".",
"append",
"(",
"'",
"'",
")",
";",
"return",
"this",
";",
"}"
] | Does nothing if value is null.
@param name
@param value
@return the XmlStringBuilder | [
"Does",
"nothing",
"if",
"value",
"is",
"null",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-core/src/main/java/org/jivesoftware/smack/util/XmlStringBuilder.java#L241-L247 |
26,798 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/FileTransfer.java | FileTransfer.isDone | public boolean isDone() {
return status == Status.cancelled || status == Status.error
|| status == Status.complete || status == Status.refused;
} | java | public boolean isDone() {
return status == Status.cancelled || status == Status.error
|| status == Status.complete || status == Status.refused;
} | [
"public",
"boolean",
"isDone",
"(",
")",
"{",
"return",
"status",
"==",
"Status",
".",
"cancelled",
"||",
"status",
"==",
"Status",
".",
"error",
"||",
"status",
"==",
"Status",
".",
"complete",
"||",
"status",
"==",
"Status",
".",
"refused",
";",
"}"
] | Returns true if the transfer has been cancelled, if it has stopped because
of a an error, or the transfer completed successfully.
@return Returns true if the transfer has been cancelled, if it has stopped
because of a an error, or the transfer completed successfully. | [
"Returns",
"true",
"if",
"the",
"transfer",
"has",
"been",
"cancelled",
"if",
"it",
"has",
"stopped",
"because",
"of",
"a",
"an",
"error",
"or",
"the",
"transfer",
"completed",
"successfully",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/FileTransfer.java#L135-L138 |
26,799 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/caps/cache/SimpleDirectoryPersistentCache.java | SimpleDirectoryPersistentCache.writeInfoToFile | private static void writeInfoToFile(File file, DiscoverInfo info) throws IOException {
try (DataOutputStream dos = new DataOutputStream(new FileOutputStream(file))) {
dos.writeUTF(info.toXML().toString());
}
} | java | private static void writeInfoToFile(File file, DiscoverInfo info) throws IOException {
try (DataOutputStream dos = new DataOutputStream(new FileOutputStream(file))) {
dos.writeUTF(info.toXML().toString());
}
} | [
"private",
"static",
"void",
"writeInfoToFile",
"(",
"File",
"file",
",",
"DiscoverInfo",
"info",
")",
"throws",
"IOException",
"{",
"try",
"(",
"DataOutputStream",
"dos",
"=",
"new",
"DataOutputStream",
"(",
"new",
"FileOutputStream",
"(",
"file",
")",
")",
")",
"{",
"dos",
".",
"writeUTF",
"(",
"info",
".",
"toXML",
"(",
")",
".",
"toString",
"(",
")",
")",
";",
"}",
"}"
] | Writes the DiscoverInfo stanza to an file
@param file
@param info
@throws IOException | [
"Writes",
"the",
"DiscoverInfo",
"stanza",
"to",
"an",
"file"
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/caps/cache/SimpleDirectoryPersistentCache.java#L132-L136 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.