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,800 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/caps/cache/SimpleDirectoryPersistentCache.java | SimpleDirectoryPersistentCache.restoreInfoFromFile | private static DiscoverInfo restoreInfoFromFile(File file) throws Exception {
String fileContent;
try (DataInputStream dis = new DataInputStream(new FileInputStream(file))) {
fileContent = dis.readUTF();
}
if (fileContent == null) {
return null;
}
return PacketParserUtils.parseStanza(fileContent);
} | java | private static DiscoverInfo restoreInfoFromFile(File file) throws Exception {
String fileContent;
try (DataInputStream dis = new DataInputStream(new FileInputStream(file))) {
fileContent = dis.readUTF();
}
if (fileContent == null) {
return null;
}
return PacketParserUtils.parseStanza(fileContent);
} | [
"private",
"static",
"DiscoverInfo",
"restoreInfoFromFile",
"(",
"File",
"file",
")",
"throws",
"Exception",
"{",
"String",
"fileContent",
";",
"try",
"(",
"DataInputStream",
"dis",
"=",
"new",
"DataInputStream",
"(",
"new",
"FileInputStream",
"(",
"file",
")",
")",
")",
"{",
"fileContent",
"=",
"dis",
".",
"readUTF",
"(",
")",
";",
"}",
"if",
"(",
"fileContent",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"PacketParserUtils",
".",
"parseStanza",
"(",
"fileContent",
")",
";",
"}"
] | Tries to restore an DiscoverInfo stanza from a file.
@param file
@return the restored DiscoverInfo
@throws Exception | [
"Tries",
"to",
"restore",
"an",
"DiscoverInfo",
"stanza",
"from",
"a",
"file",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/caps/cache/SimpleDirectoryPersistentCache.java#L145-L154 |
26,801 | igniterealtime/Smack | smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSessionStateEnded.java | JingleSessionStateEnded.processJingle | @Override
public IQ processJingle(JingleSession session, Jingle jingle, JingleActionEnum action) {
IQ response;
response = session.createJingleError(jingle, JingleError.MALFORMED_STANZA);
return response;
} | java | @Override
public IQ processJingle(JingleSession session, Jingle jingle, JingleActionEnum action) {
IQ response;
response = session.createJingleError(jingle, JingleError.MALFORMED_STANZA);
return response;
} | [
"@",
"Override",
"public",
"IQ",
"processJingle",
"(",
"JingleSession",
"session",
",",
"Jingle",
"jingle",
",",
"JingleActionEnum",
"action",
")",
"{",
"IQ",
"response",
";",
"response",
"=",
"session",
".",
"createJingleError",
"(",
"jingle",
",",
"JingleError",
".",
"MALFORMED_STANZA",
")",
";",
"return",
"response",
";",
"}"
] | Pretty much nothing is valid for receiving once we've ended the session. | [
"Pretty",
"much",
"nothing",
"is",
"valid",
"for",
"receiving",
"once",
"we",
"ve",
"ended",
"the",
"session",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSessionStateEnded.java#L69-L76 |
26,802 | igniterealtime/Smack | smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/internal/OmemoCachedDeviceList.java | OmemoCachedDeviceList.merge | public void merge(Set<Integer> deviceListUpdate) {
inactiveDevices.addAll(activeDevices);
activeDevices.clear();
activeDevices.addAll(deviceListUpdate);
inactiveDevices.removeAll(activeDevices);
} | java | public void merge(Set<Integer> deviceListUpdate) {
inactiveDevices.addAll(activeDevices);
activeDevices.clear();
activeDevices.addAll(deviceListUpdate);
inactiveDevices.removeAll(activeDevices);
} | [
"public",
"void",
"merge",
"(",
"Set",
"<",
"Integer",
">",
"deviceListUpdate",
")",
"{",
"inactiveDevices",
".",
"addAll",
"(",
"activeDevices",
")",
";",
"activeDevices",
".",
"clear",
"(",
")",
";",
"activeDevices",
".",
"addAll",
"(",
"deviceListUpdate",
")",
";",
"inactiveDevices",
".",
"removeAll",
"(",
"activeDevices",
")",
";",
"}"
] | Merge a device list update into the CachedDeviceList.
The source code should be self explanatory.
@param deviceListUpdate received device list update | [
"Merge",
"a",
"device",
"list",
"update",
"into",
"the",
"CachedDeviceList",
".",
"The",
"source",
"code",
"should",
"be",
"self",
"explanatory",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/internal/OmemoCachedDeviceList.java#L95-L100 |
26,803 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/xhtmlim/XHTMLText.java | XHTMLText.appendOpenAnchorTag | public XHTMLText appendOpenAnchorTag(String href, String style) {
text.halfOpenElement(A);
text.optAttribute(HREF, href);
text.optAttribute(STYLE, style);
text.rightAngleBracket();
return this;
} | java | public XHTMLText appendOpenAnchorTag(String href, String style) {
text.halfOpenElement(A);
text.optAttribute(HREF, href);
text.optAttribute(STYLE, style);
text.rightAngleBracket();
return this;
} | [
"public",
"XHTMLText",
"appendOpenAnchorTag",
"(",
"String",
"href",
",",
"String",
"style",
")",
"{",
"text",
".",
"halfOpenElement",
"(",
"A",
")",
";",
"text",
".",
"optAttribute",
"(",
"HREF",
",",
"href",
")",
";",
"text",
".",
"optAttribute",
"(",
"STYLE",
",",
"style",
")",
";",
"text",
".",
"rightAngleBracket",
"(",
")",
";",
"return",
"this",
";",
"}"
] | Appends a tag that indicates that an anchor section begins.
@param href indicates the URL being linked to
@param style the XHTML style of the anchor
@return this. | [
"Appends",
"a",
"tag",
"that",
"indicates",
"that",
"an",
"anchor",
"section",
"begins",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/xhtmlim/XHTMLText.java#L56-L62 |
26,804 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/xhtmlim/XHTMLText.java | XHTMLText.appendOpenBlockQuoteTag | public XHTMLText appendOpenBlockQuoteTag(String style) {
text.halfOpenElement(BLOCKQUOTE);
text.optAttribute(STYLE, style);
text.rightAngleBracket();
return this;
} | java | public XHTMLText appendOpenBlockQuoteTag(String style) {
text.halfOpenElement(BLOCKQUOTE);
text.optAttribute(STYLE, style);
text.rightAngleBracket();
return this;
} | [
"public",
"XHTMLText",
"appendOpenBlockQuoteTag",
"(",
"String",
"style",
")",
"{",
"text",
".",
"halfOpenElement",
"(",
"BLOCKQUOTE",
")",
";",
"text",
".",
"optAttribute",
"(",
"STYLE",
",",
"style",
")",
";",
"text",
".",
"rightAngleBracket",
"(",
")",
";",
"return",
"this",
";",
"}"
] | Appends a tag that indicates that a blockquote section begins.
@param style the XHTML style of the blockquote
@return this. | [
"Appends",
"a",
"tag",
"that",
"indicates",
"that",
"a",
"blockquote",
"section",
"begins",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/xhtmlim/XHTMLText.java#L81-L86 |
26,805 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/xhtmlim/XHTMLText.java | XHTMLText.appendOpenBodyTag | private XHTMLText appendOpenBodyTag(String style, String lang) {
text.halfOpenElement(Message.BODY);
text.xmlnsAttribute(NAMESPACE);
text.optElement(STYLE, style);
text.xmllangAttribute(lang);
text.rightAngleBracket();
return this;
} | java | private XHTMLText appendOpenBodyTag(String style, String lang) {
text.halfOpenElement(Message.BODY);
text.xmlnsAttribute(NAMESPACE);
text.optElement(STYLE, style);
text.xmllangAttribute(lang);
text.rightAngleBracket();
return this;
} | [
"private",
"XHTMLText",
"appendOpenBodyTag",
"(",
"String",
"style",
",",
"String",
"lang",
")",
"{",
"text",
".",
"halfOpenElement",
"(",
"Message",
".",
"BODY",
")",
";",
"text",
".",
"xmlnsAttribute",
"(",
"NAMESPACE",
")",
";",
"text",
".",
"optElement",
"(",
"STYLE",
",",
"style",
")",
";",
"text",
".",
"xmllangAttribute",
"(",
"lang",
")",
";",
"text",
".",
"rightAngleBracket",
"(",
")",
";",
"return",
"this",
";",
"}"
] | Appends a tag that indicates that a body section begins.
@param style the XHTML style of the body
@param lang the language of the body
@return this. | [
"Appends",
"a",
"tag",
"that",
"indicates",
"that",
"a",
"body",
"section",
"begins",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/xhtmlim/XHTMLText.java#L105-L112 |
26,806 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/xhtmlim/XHTMLText.java | XHTMLText.appendOpenHeaderTag | public XHTMLText appendOpenHeaderTag(int level, String style) {
if (level > 3 || level < 1) {
throw new IllegalArgumentException("Level must be between 1 and 3");
}
text.halfOpenElement(H + Integer.toString(level));
text.optAttribute(STYLE, style);
text.rightAngleBracket();
return this;
} | java | public XHTMLText appendOpenHeaderTag(int level, String style) {
if (level > 3 || level < 1) {
throw new IllegalArgumentException("Level must be between 1 and 3");
}
text.halfOpenElement(H + Integer.toString(level));
text.optAttribute(STYLE, style);
text.rightAngleBracket();
return this;
} | [
"public",
"XHTMLText",
"appendOpenHeaderTag",
"(",
"int",
"level",
",",
"String",
"style",
")",
"{",
"if",
"(",
"level",
">",
"3",
"||",
"level",
"<",
"1",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Level must be between 1 and 3\"",
")",
";",
"}",
"text",
".",
"halfOpenElement",
"(",
"H",
"+",
"Integer",
".",
"toString",
"(",
"level",
")",
")",
";",
"text",
".",
"optAttribute",
"(",
"STYLE",
",",
"style",
")",
";",
"text",
".",
"rightAngleBracket",
"(",
")",
";",
"return",
"this",
";",
"}"
] | Appends a tag that indicates a header, a title of a section of the message.
@param level the level of the Header. It must be a value between 1 and 3
@param style the XHTML style of the blockquote
@return this. | [
"Appends",
"a",
"tag",
"that",
"indicates",
"a",
"header",
"a",
"title",
"of",
"a",
"section",
"of",
"the",
"message",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/xhtmlim/XHTMLText.java#L200-L208 |
26,807 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/xhtmlim/XHTMLText.java | XHTMLText.appendCloseHeaderTag | public XHTMLText appendCloseHeaderTag(int level) {
if (level > 3 || level < 1) {
throw new IllegalArgumentException("Level must be between 1 and 3");
}
text.closeElement(H + Integer.toBinaryString(level));
return this;
} | java | public XHTMLText appendCloseHeaderTag(int level) {
if (level > 3 || level < 1) {
throw new IllegalArgumentException("Level must be between 1 and 3");
}
text.closeElement(H + Integer.toBinaryString(level));
return this;
} | [
"public",
"XHTMLText",
"appendCloseHeaderTag",
"(",
"int",
"level",
")",
"{",
"if",
"(",
"level",
">",
"3",
"||",
"level",
"<",
"1",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Level must be between 1 and 3\"",
")",
";",
"}",
"text",
".",
"closeElement",
"(",
"H",
"+",
"Integer",
".",
"toBinaryString",
"(",
"level",
")",
")",
";",
"return",
"this",
";",
"}"
] | Appends a tag that indicates that a header section ends.
@param level the level of the Header. It must be a value between 1 and 3
@return this. | [
"Appends",
"a",
"tag",
"that",
"indicates",
"that",
"a",
"header",
"section",
"ends",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/xhtmlim/XHTMLText.java#L216-L222 |
26,808 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/xhtmlim/XHTMLText.java | XHTMLText.appendImageTag | public XHTMLText appendImageTag(String align, String alt, String height, String src, String width) {
text.halfOpenElement(IMG);
text.optAttribute("align", align);
text.optAttribute("alt", alt);
text.optAttribute("height", height);
text.optAttribute("src", src);
text.optAttribute("width", width);
text.rightAngleBracket();
return this;
} | java | public XHTMLText appendImageTag(String align, String alt, String height, String src, String width) {
text.halfOpenElement(IMG);
text.optAttribute("align", align);
text.optAttribute("alt", alt);
text.optAttribute("height", height);
text.optAttribute("src", src);
text.optAttribute("width", width);
text.rightAngleBracket();
return this;
} | [
"public",
"XHTMLText",
"appendImageTag",
"(",
"String",
"align",
",",
"String",
"alt",
",",
"String",
"height",
",",
"String",
"src",
",",
"String",
"width",
")",
"{",
"text",
".",
"halfOpenElement",
"(",
"IMG",
")",
";",
"text",
".",
"optAttribute",
"(",
"\"align\"",
",",
"align",
")",
";",
"text",
".",
"optAttribute",
"(",
"\"alt\"",
",",
"alt",
")",
";",
"text",
".",
"optAttribute",
"(",
"\"height\"",
",",
"height",
")",
";",
"text",
".",
"optAttribute",
"(",
"\"src\"",
",",
"src",
")",
";",
"text",
".",
"optAttribute",
"(",
"\"width\"",
",",
"width",
")",
";",
"text",
".",
"rightAngleBracket",
"(",
")",
";",
"return",
"this",
";",
"}"
] | Appends a tag that indicates an image.
@param align how text should flow around the picture
@param alt the text to show if you don't show the picture
@param height how tall is the picture
@param src where to get the picture
@param width how wide is the picture
@return this. | [
"Appends",
"a",
"tag",
"that",
"indicates",
"an",
"image",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/xhtmlim/XHTMLText.java#L237-L246 |
26,809 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/xhtmlim/XHTMLText.java | XHTMLText.appendLineItemTag | public XHTMLText appendLineItemTag(String style) {
text.halfOpenElement(LI);
text.optAttribute(STYLE, style);
text.rightAngleBracket();
return this;
} | java | public XHTMLText appendLineItemTag(String style) {
text.halfOpenElement(LI);
text.optAttribute(STYLE, style);
text.rightAngleBracket();
return this;
} | [
"public",
"XHTMLText",
"appendLineItemTag",
"(",
"String",
"style",
")",
"{",
"text",
".",
"halfOpenElement",
"(",
"LI",
")",
";",
"text",
".",
"optAttribute",
"(",
"STYLE",
",",
"style",
")",
";",
"text",
".",
"rightAngleBracket",
"(",
")",
";",
"return",
"this",
";",
"}"
] | Appends a tag that indicates the start of a new line item within a list.
@param style the style of the line item
@return this. | [
"Appends",
"a",
"tag",
"that",
"indicates",
"the",
"start",
"of",
"a",
"new",
"line",
"item",
"within",
"a",
"list",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/xhtmlim/XHTMLText.java#L258-L263 |
26,810 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/xhtmlim/XHTMLText.java | XHTMLText.appendOpenOrderedListTag | public XHTMLText appendOpenOrderedListTag(String style) {
text.halfOpenElement(OL);
text.optAttribute(STYLE, style);
text.rightAngleBracket();
return this;
} | java | public XHTMLText appendOpenOrderedListTag(String style) {
text.halfOpenElement(OL);
text.optAttribute(STYLE, style);
text.rightAngleBracket();
return this;
} | [
"public",
"XHTMLText",
"appendOpenOrderedListTag",
"(",
"String",
"style",
")",
"{",
"text",
".",
"halfOpenElement",
"(",
"OL",
")",
";",
"text",
".",
"optAttribute",
"(",
"STYLE",
",",
"style",
")",
";",
"text",
".",
"rightAngleBracket",
"(",
")",
";",
"return",
"this",
";",
"}"
] | Appends a tag that creates an ordered list. "Ordered" means that the order of the items
in the list is important. To show this, browsers automatically number the list.
@param style the style of the ordered list
@return this. | [
"Appends",
"a",
"tag",
"that",
"creates",
"an",
"ordered",
"list",
".",
"Ordered",
"means",
"that",
"the",
"order",
"of",
"the",
"items",
"in",
"the",
"list",
"is",
"important",
".",
"To",
"show",
"this",
"browsers",
"automatically",
"number",
"the",
"list",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/xhtmlim/XHTMLText.java#L283-L288 |
26,811 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/xhtmlim/XHTMLText.java | XHTMLText.appendOpenUnorderedListTag | public XHTMLText appendOpenUnorderedListTag(String style) {
text.halfOpenElement(UL);
text.optAttribute(STYLE, style);
text.rightAngleBracket();
return this;
} | java | public XHTMLText appendOpenUnorderedListTag(String style) {
text.halfOpenElement(UL);
text.optAttribute(STYLE, style);
text.rightAngleBracket();
return this;
} | [
"public",
"XHTMLText",
"appendOpenUnorderedListTag",
"(",
"String",
"style",
")",
"{",
"text",
".",
"halfOpenElement",
"(",
"UL",
")",
";",
"text",
".",
"optAttribute",
"(",
"STYLE",
",",
"style",
")",
";",
"text",
".",
"rightAngleBracket",
"(",
")",
";",
"return",
"this",
";",
"}"
] | Appends a tag that creates an unordered list. The unordered part means that the items
in the list are not in any particular order.
@param style the style of the unordered list
@return this. | [
"Appends",
"a",
"tag",
"that",
"creates",
"an",
"unordered",
"list",
".",
"The",
"unordered",
"part",
"means",
"that",
"the",
"items",
"in",
"the",
"list",
"are",
"not",
"in",
"any",
"particular",
"order",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/xhtmlim/XHTMLText.java#L310-L315 |
26,812 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/xhtmlim/XHTMLText.java | XHTMLText.appendOpenParagraphTag | public XHTMLText appendOpenParagraphTag(String style) {
text.halfOpenElement(P);
text.optAttribute(STYLE, style);
text.rightAngleBracket();
return this;
} | java | public XHTMLText appendOpenParagraphTag(String style) {
text.halfOpenElement(P);
text.optAttribute(STYLE, style);
text.rightAngleBracket();
return this;
} | [
"public",
"XHTMLText",
"appendOpenParagraphTag",
"(",
"String",
"style",
")",
"{",
"text",
".",
"halfOpenElement",
"(",
"P",
")",
";",
"text",
".",
"optAttribute",
"(",
"STYLE",
",",
"style",
")",
";",
"text",
".",
"rightAngleBracket",
"(",
")",
";",
"return",
"this",
";",
"}"
] | Appends a tag that indicates the start of a new paragraph. This is usually rendered
with two carriage returns, producing a single blank line in between the two paragraphs.
@param style the style of the paragraph
@return this. | [
"Appends",
"a",
"tag",
"that",
"indicates",
"the",
"start",
"of",
"a",
"new",
"paragraph",
".",
"This",
"is",
"usually",
"rendered",
"with",
"two",
"carriage",
"returns",
"producing",
"a",
"single",
"blank",
"line",
"in",
"between",
"the",
"two",
"paragraphs",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/xhtmlim/XHTMLText.java#L337-L342 |
26,813 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/xhtmlim/XHTMLText.java | XHTMLText.appendOpenInlinedQuoteTag | public XHTMLText appendOpenInlinedQuoteTag(String style) {
text.halfOpenElement(Q);
text.optAttribute(STYLE, style);
text.rightAngleBracket();
return this;
} | java | public XHTMLText appendOpenInlinedQuoteTag(String style) {
text.halfOpenElement(Q);
text.optAttribute(STYLE, style);
text.rightAngleBracket();
return this;
} | [
"public",
"XHTMLText",
"appendOpenInlinedQuoteTag",
"(",
"String",
"style",
")",
"{",
"text",
".",
"halfOpenElement",
"(",
"Q",
")",
";",
"text",
".",
"optAttribute",
"(",
"STYLE",
",",
"style",
")",
";",
"text",
".",
"rightAngleBracket",
"(",
")",
";",
"return",
"this",
";",
"}"
] | Appends a tag that indicates that an inlined quote section begins.
@param style the style of the inlined quote
@return this. | [
"Appends",
"a",
"tag",
"that",
"indicates",
"that",
"an",
"inlined",
"quote",
"section",
"begins",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/xhtmlim/XHTMLText.java#L364-L369 |
26,814 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/xhtmlim/XHTMLText.java | XHTMLText.appendOpenSpanTag | public XHTMLText appendOpenSpanTag(String style) {
text.halfOpenElement(SPAN);
text.optAttribute(STYLE, style);
text.rightAngleBracket();
return this;
} | java | public XHTMLText appendOpenSpanTag(String style) {
text.halfOpenElement(SPAN);
text.optAttribute(STYLE, style);
text.rightAngleBracket();
return this;
} | [
"public",
"XHTMLText",
"appendOpenSpanTag",
"(",
"String",
"style",
")",
"{",
"text",
".",
"halfOpenElement",
"(",
"SPAN",
")",
";",
"text",
".",
"optAttribute",
"(",
"STYLE",
",",
"style",
")",
";",
"text",
".",
"rightAngleBracket",
"(",
")",
";",
"return",
"this",
";",
"}"
] | Appends a tag that allows to set the fonts for a span of text.
@param style the style for a span of text
@return this. | [
"Appends",
"a",
"tag",
"that",
"allows",
"to",
"set",
"the",
"fonts",
"for",
"a",
"span",
"of",
"text",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/xhtmlim/XHTMLText.java#L390-L395 |
26,815 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Node.java | Node.getSubscriptions | public List<Subscription> getSubscriptions() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
return getSubscriptions(null, null);
} | java | public List<Subscription> getSubscriptions() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
return getSubscriptions(null, null);
} | [
"public",
"List",
"<",
"Subscription",
">",
"getSubscriptions",
"(",
")",
"throws",
"NoResponseException",
",",
"XMPPErrorException",
",",
"NotConnectedException",
",",
"InterruptedException",
"{",
"return",
"getSubscriptions",
"(",
"null",
",",
"null",
")",
";",
"}"
] | Get the subscriptions currently associated with this node.
@return List of {@link Subscription}
@throws XMPPErrorException
@throws NoResponseException
@throws NotConnectedException
@throws InterruptedException | [
"Get",
"the",
"subscriptions",
"currently",
"associated",
"with",
"this",
"node",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Node.java#L135-L137 |
26,816 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Node.java | Node.getSubscriptionsAsOwner | public List<Subscription> getSubscriptionsAsOwner() throws NoResponseException, XMPPErrorException,
NotConnectedException, InterruptedException {
return getSubscriptionsAsOwner(null, null);
} | java | public List<Subscription> getSubscriptionsAsOwner() throws NoResponseException, XMPPErrorException,
NotConnectedException, InterruptedException {
return getSubscriptionsAsOwner(null, null);
} | [
"public",
"List",
"<",
"Subscription",
">",
"getSubscriptionsAsOwner",
"(",
")",
"throws",
"NoResponseException",
",",
"XMPPErrorException",
",",
"NotConnectedException",
",",
"InterruptedException",
"{",
"return",
"getSubscriptionsAsOwner",
"(",
"null",
",",
"null",
")",
";",
"}"
] | Get the subscriptions currently associated with this node as owner.
@return List of {@link Subscription}
@throws XMPPErrorException
@throws NoResponseException
@throws NotConnectedException
@throws InterruptedException
@see #getSubscriptionsAsOwner(List, Collection)
@since 4.1 | [
"Get",
"the",
"subscriptions",
"currently",
"associated",
"with",
"this",
"node",
"as",
"owner",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Node.java#L171-L174 |
26,817 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Node.java | Node.getAffiliations | public List<Affiliation> getAffiliations() throws NoResponseException, XMPPErrorException,
NotConnectedException, InterruptedException {
return getAffiliations(null, null);
} | java | public List<Affiliation> getAffiliations() throws NoResponseException, XMPPErrorException,
NotConnectedException, InterruptedException {
return getAffiliations(null, null);
} | [
"public",
"List",
"<",
"Affiliation",
">",
"getAffiliations",
"(",
")",
"throws",
"NoResponseException",
",",
"XMPPErrorException",
",",
"NotConnectedException",
",",
"InterruptedException",
"{",
"return",
"getAffiliations",
"(",
"null",
",",
"null",
")",
";",
"}"
] | Get the affiliations of this node.
@return List of {@link Affiliation}
@throws NoResponseException
@throws XMPPErrorException
@throws NotConnectedException
@throws InterruptedException | [
"Get",
"the",
"affiliations",
"of",
"this",
"node",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Node.java#L257-L260 |
26,818 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Node.java | Node.getAffiliationsAsOwner | public List<Affiliation> getAffiliationsAsOwner()
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
return getAffiliationsAsOwner(null, null);
} | java | public List<Affiliation> getAffiliationsAsOwner()
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
return getAffiliationsAsOwner(null, null);
} | [
"public",
"List",
"<",
"Affiliation",
">",
"getAffiliationsAsOwner",
"(",
")",
"throws",
"NoResponseException",
",",
"XMPPErrorException",
",",
"NotConnectedException",
",",
"InterruptedException",
"{",
"return",
"getAffiliationsAsOwner",
"(",
"null",
",",
"null",
")",
";",
"}"
] | Retrieve the affiliation list for this node as owner.
@return list of entities whose affiliation is not 'none'.
@throws NoResponseException
@throws XMPPErrorException
@throws NotConnectedException
@throws InterruptedException
@see #getAffiliations(List, Collection)
@since 4.2 | [
"Retrieve",
"the",
"affiliation",
"list",
"for",
"this",
"node",
"as",
"owner",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Node.java#L295-L299 |
26,819 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Node.java | Node.subscribe | public Subscription subscribe(String jid) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
PubSub pubSub = createPubsubPacket(Type.set, new SubscribeExtension(jid, getId()));
PubSub reply = sendPubsubPacket(pubSub);
return reply.getExtension(PubSubElementType.SUBSCRIPTION);
} | java | public Subscription subscribe(String jid) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
PubSub pubSub = createPubsubPacket(Type.set, new SubscribeExtension(jid, getId()));
PubSub reply = sendPubsubPacket(pubSub);
return reply.getExtension(PubSubElementType.SUBSCRIPTION);
} | [
"public",
"Subscription",
"subscribe",
"(",
"String",
"jid",
")",
"throws",
"NoResponseException",
",",
"XMPPErrorException",
",",
"NotConnectedException",
",",
"InterruptedException",
"{",
"PubSub",
"pubSub",
"=",
"createPubsubPacket",
"(",
"Type",
".",
"set",
",",
"new",
"SubscribeExtension",
"(",
"jid",
",",
"getId",
"(",
")",
")",
")",
";",
"PubSub",
"reply",
"=",
"sendPubsubPacket",
"(",
"pubSub",
")",
";",
"return",
"reply",
".",
"getExtension",
"(",
"PubSubElementType",
".",
"SUBSCRIPTION",
")",
";",
"}"
] | The user subscribes to the node using the supplied jid. The
bare jid portion of this one must match the jid for the connection.
Please note that the {@link Subscription.State} should be checked
on return since more actions may be required by the caller.
{@link Subscription.State#pending} - The owner must approve the subscription
request before messages will be received.
{@link Subscription.State#unconfigured} - If the {@link Subscription#isConfigRequired()} is true,
the caller must configure the subscription before messages will be received. If it is false
the caller can configure it but is not required to do so.
@param jid The jid to subscribe as.
@return The subscription
@throws XMPPErrorException
@throws NoResponseException
@throws NotConnectedException
@throws InterruptedException | [
"The",
"user",
"subscribes",
"to",
"the",
"node",
"using",
"the",
"supplied",
"jid",
".",
"The",
"bare",
"jid",
"portion",
"of",
"this",
"one",
"must",
"match",
"the",
"jid",
"for",
"the",
"connection",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Node.java#L389-L393 |
26,820 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Node.java | Node.subscribe | public Subscription subscribe(String jid, SubscribeForm subForm) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
PubSub request = createPubsubPacket(Type.set, new SubscribeExtension(jid, getId()));
request.addExtension(new FormNode(FormNodeType.OPTIONS, subForm));
PubSub reply = sendPubsubPacket(request);
return reply.getExtension(PubSubElementType.SUBSCRIPTION);
} | java | public Subscription subscribe(String jid, SubscribeForm subForm) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
PubSub request = createPubsubPacket(Type.set, new SubscribeExtension(jid, getId()));
request.addExtension(new FormNode(FormNodeType.OPTIONS, subForm));
PubSub reply = sendPubsubPacket(request);
return reply.getExtension(PubSubElementType.SUBSCRIPTION);
} | [
"public",
"Subscription",
"subscribe",
"(",
"String",
"jid",
",",
"SubscribeForm",
"subForm",
")",
"throws",
"NoResponseException",
",",
"XMPPErrorException",
",",
"NotConnectedException",
",",
"InterruptedException",
"{",
"PubSub",
"request",
"=",
"createPubsubPacket",
"(",
"Type",
".",
"set",
",",
"new",
"SubscribeExtension",
"(",
"jid",
",",
"getId",
"(",
")",
")",
")",
";",
"request",
".",
"addExtension",
"(",
"new",
"FormNode",
"(",
"FormNodeType",
".",
"OPTIONS",
",",
"subForm",
")",
")",
";",
"PubSub",
"reply",
"=",
"sendPubsubPacket",
"(",
"request",
")",
";",
"return",
"reply",
".",
"getExtension",
"(",
"PubSubElementType",
".",
"SUBSCRIPTION",
")",
";",
"}"
] | The user subscribes to the node using the supplied jid and subscription
options. The bare jid portion of this one must match the jid for the
connection.
Please note that the {@link Subscription.State} should be checked
on return since more actions may be required by the caller.
{@link Subscription.State#pending} - The owner must approve the subscription
request before messages will be received.
{@link Subscription.State#unconfigured} - If the {@link Subscription#isConfigRequired()} is true,
the caller must configure the subscription before messages will be received. If it is false
the caller can configure it but is not required to do so.
@param jid The jid to subscribe as.
@param subForm
@return The subscription
@throws XMPPErrorException
@throws NoResponseException
@throws NotConnectedException
@throws InterruptedException | [
"The",
"user",
"subscribes",
"to",
"the",
"node",
"using",
"the",
"supplied",
"jid",
"and",
"subscription",
"options",
".",
"The",
"bare",
"jid",
"portion",
"of",
"this",
"one",
"must",
"match",
"the",
"jid",
"for",
"the",
"connection",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Node.java#L417-L422 |
26,821 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Node.java | Node.unsubscribe | public void unsubscribe(String jid, String subscriptionId) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
sendPubsubPacket(createPubsubPacket(Type.set, new UnsubscribeExtension(jid, getId(), subscriptionId)));
} | java | public void unsubscribe(String jid, String subscriptionId) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
sendPubsubPacket(createPubsubPacket(Type.set, new UnsubscribeExtension(jid, getId(), subscriptionId)));
} | [
"public",
"void",
"unsubscribe",
"(",
"String",
"jid",
",",
"String",
"subscriptionId",
")",
"throws",
"NoResponseException",
",",
"XMPPErrorException",
",",
"NotConnectedException",
",",
"InterruptedException",
"{",
"sendPubsubPacket",
"(",
"createPubsubPacket",
"(",
"Type",
".",
"set",
",",
"new",
"UnsubscribeExtension",
"(",
"jid",
",",
"getId",
"(",
")",
",",
"subscriptionId",
")",
")",
")",
";",
"}"
] | Remove the specific subscription related to the specified JID.
@param jid The JID used to subscribe to the node
@param subscriptionId The id of the subscription being removed
@throws XMPPErrorException
@throws NoResponseException
@throws NotConnectedException
@throws InterruptedException | [
"Remove",
"the",
"specific",
"subscription",
"related",
"to",
"the",
"specified",
"JID",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Node.java#L450-L452 |
26,822 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Node.java | Node.getSubscriptionOptions | public SubscribeForm getSubscriptionOptions(String jid, String subscriptionId) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
PubSub packet = sendPubsubPacket(createPubsubPacket(Type.get, new OptionsExtension(jid, getId(), subscriptionId)));
FormNode ext = packet.getExtension(PubSubElementType.OPTIONS);
return new SubscribeForm(ext.getForm());
} | java | public SubscribeForm getSubscriptionOptions(String jid, String subscriptionId) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
PubSub packet = sendPubsubPacket(createPubsubPacket(Type.get, new OptionsExtension(jid, getId(), subscriptionId)));
FormNode ext = packet.getExtension(PubSubElementType.OPTIONS);
return new SubscribeForm(ext.getForm());
} | [
"public",
"SubscribeForm",
"getSubscriptionOptions",
"(",
"String",
"jid",
",",
"String",
"subscriptionId",
")",
"throws",
"NoResponseException",
",",
"XMPPErrorException",
",",
"NotConnectedException",
",",
"InterruptedException",
"{",
"PubSub",
"packet",
"=",
"sendPubsubPacket",
"(",
"createPubsubPacket",
"(",
"Type",
".",
"get",
",",
"new",
"OptionsExtension",
"(",
"jid",
",",
"getId",
"(",
")",
",",
"subscriptionId",
")",
")",
")",
";",
"FormNode",
"ext",
"=",
"packet",
".",
"getExtension",
"(",
"PubSubElementType",
".",
"OPTIONS",
")",
";",
"return",
"new",
"SubscribeForm",
"(",
"ext",
".",
"getForm",
"(",
")",
")",
";",
"}"
] | Get the options for configuring the specified subscription.
@param jid JID the subscription is registered under
@param subscriptionId The subscription id
@return The subscription option form
@throws XMPPErrorException
@throws NoResponseException
@throws NotConnectedException
@throws InterruptedException | [
"Get",
"the",
"options",
"for",
"configuring",
"the",
"specified",
"subscription",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Node.java#L484-L488 |
26,823 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Node.java | Node.addItemEventListener | @SuppressWarnings("unchecked")
public void addItemEventListener(@SuppressWarnings("rawtypes") ItemEventListener listener) {
StanzaListener conListener = new ItemEventTranslator(listener);
itemEventToListenerMap.put(listener, conListener);
pubSubManager.getConnection().addSyncStanzaListener(conListener, new EventContentFilter(EventElementType.items.toString(), "item"));
} | java | @SuppressWarnings("unchecked")
public void addItemEventListener(@SuppressWarnings("rawtypes") ItemEventListener listener) {
StanzaListener conListener = new ItemEventTranslator(listener);
itemEventToListenerMap.put(listener, conListener);
pubSubManager.getConnection().addSyncStanzaListener(conListener, new EventContentFilter(EventElementType.items.toString(), "item"));
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"void",
"addItemEventListener",
"(",
"@",
"SuppressWarnings",
"(",
"\"rawtypes\"",
")",
"ItemEventListener",
"listener",
")",
"{",
"StanzaListener",
"conListener",
"=",
"new",
"ItemEventTranslator",
"(",
"listener",
")",
";",
"itemEventToListenerMap",
".",
"put",
"(",
"listener",
",",
"conListener",
")",
";",
"pubSubManager",
".",
"getConnection",
"(",
")",
".",
"addSyncStanzaListener",
"(",
"conListener",
",",
"new",
"EventContentFilter",
"(",
"EventElementType",
".",
"items",
".",
"toString",
"(",
")",
",",
"\"item\"",
")",
")",
";",
"}"
] | Register a listener for item publication events. This
listener will get called whenever an item is published to
this node.
@param listener The handler for the event | [
"Register",
"a",
"listener",
"for",
"item",
"publication",
"events",
".",
"This",
"listener",
"will",
"get",
"called",
"whenever",
"an",
"item",
"is",
"published",
"to",
"this",
"node",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Node.java#L497-L502 |
26,824 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Node.java | Node.removeItemEventListener | public void removeItemEventListener(@SuppressWarnings("rawtypes") ItemEventListener listener) {
StanzaListener conListener = itemEventToListenerMap.remove(listener);
if (conListener != null)
pubSubManager.getConnection().removeSyncStanzaListener(conListener);
} | java | public void removeItemEventListener(@SuppressWarnings("rawtypes") ItemEventListener listener) {
StanzaListener conListener = itemEventToListenerMap.remove(listener);
if (conListener != null)
pubSubManager.getConnection().removeSyncStanzaListener(conListener);
} | [
"public",
"void",
"removeItemEventListener",
"(",
"@",
"SuppressWarnings",
"(",
"\"rawtypes\"",
")",
"ItemEventListener",
"listener",
")",
"{",
"StanzaListener",
"conListener",
"=",
"itemEventToListenerMap",
".",
"remove",
"(",
"listener",
")",
";",
"if",
"(",
"conListener",
"!=",
"null",
")",
"pubSubManager",
".",
"getConnection",
"(",
")",
".",
"removeSyncStanzaListener",
"(",
"conListener",
")",
";",
"}"
] | Unregister a listener for publication events.
@param listener The handler to unregister | [
"Unregister",
"a",
"listener",
"for",
"publication",
"events",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Node.java#L509-L514 |
26,825 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Node.java | Node.addConfigurationListener | public void addConfigurationListener(NodeConfigListener listener) {
StanzaListener conListener = new NodeConfigTranslator(listener);
configEventToListenerMap.put(listener, conListener);
pubSubManager.getConnection().addSyncStanzaListener(conListener, new EventContentFilter(EventElementType.configuration.toString()));
} | java | public void addConfigurationListener(NodeConfigListener listener) {
StanzaListener conListener = new NodeConfigTranslator(listener);
configEventToListenerMap.put(listener, conListener);
pubSubManager.getConnection().addSyncStanzaListener(conListener, new EventContentFilter(EventElementType.configuration.toString()));
} | [
"public",
"void",
"addConfigurationListener",
"(",
"NodeConfigListener",
"listener",
")",
"{",
"StanzaListener",
"conListener",
"=",
"new",
"NodeConfigTranslator",
"(",
"listener",
")",
";",
"configEventToListenerMap",
".",
"put",
"(",
"listener",
",",
"conListener",
")",
";",
"pubSubManager",
".",
"getConnection",
"(",
")",
".",
"addSyncStanzaListener",
"(",
"conListener",
",",
"new",
"EventContentFilter",
"(",
"EventElementType",
".",
"configuration",
".",
"toString",
"(",
")",
")",
")",
";",
"}"
] | Register a listener for configuration events. This listener
will get called whenever the node's configuration changes.
@param listener The handler for the event | [
"Register",
"a",
"listener",
"for",
"configuration",
"events",
".",
"This",
"listener",
"will",
"get",
"called",
"whenever",
"the",
"node",
"s",
"configuration",
"changes",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Node.java#L522-L526 |
26,826 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Node.java | Node.removeConfigurationListener | public void removeConfigurationListener(NodeConfigListener listener) {
StanzaListener conListener = configEventToListenerMap .remove(listener);
if (conListener != null)
pubSubManager.getConnection().removeSyncStanzaListener(conListener);
} | java | public void removeConfigurationListener(NodeConfigListener listener) {
StanzaListener conListener = configEventToListenerMap .remove(listener);
if (conListener != null)
pubSubManager.getConnection().removeSyncStanzaListener(conListener);
} | [
"public",
"void",
"removeConfigurationListener",
"(",
"NodeConfigListener",
"listener",
")",
"{",
"StanzaListener",
"conListener",
"=",
"configEventToListenerMap",
".",
"remove",
"(",
"listener",
")",
";",
"if",
"(",
"conListener",
"!=",
"null",
")",
"pubSubManager",
".",
"getConnection",
"(",
")",
".",
"removeSyncStanzaListener",
"(",
"conListener",
")",
";",
"}"
] | Unregister a listener for configuration events.
@param listener The handler to unregister | [
"Unregister",
"a",
"listener",
"for",
"configuration",
"events",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Node.java#L533-L538 |
26,827 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Node.java | Node.addItemDeleteListener | public void addItemDeleteListener(ItemDeleteListener listener) {
StanzaListener delListener = new ItemDeleteTranslator(listener);
itemDeleteToListenerMap.put(listener, delListener);
EventContentFilter deleteItem = new EventContentFilter(EventElementType.items.toString(), "retract");
EventContentFilter purge = new EventContentFilter(EventElementType.purge.toString());
// TODO: Use AsyncButOrdered (with Node as Key?)
pubSubManager.getConnection().addSyncStanzaListener(delListener, new OrFilter(deleteItem, purge));
} | java | public void addItemDeleteListener(ItemDeleteListener listener) {
StanzaListener delListener = new ItemDeleteTranslator(listener);
itemDeleteToListenerMap.put(listener, delListener);
EventContentFilter deleteItem = new EventContentFilter(EventElementType.items.toString(), "retract");
EventContentFilter purge = new EventContentFilter(EventElementType.purge.toString());
// TODO: Use AsyncButOrdered (with Node as Key?)
pubSubManager.getConnection().addSyncStanzaListener(delListener, new OrFilter(deleteItem, purge));
} | [
"public",
"void",
"addItemDeleteListener",
"(",
"ItemDeleteListener",
"listener",
")",
"{",
"StanzaListener",
"delListener",
"=",
"new",
"ItemDeleteTranslator",
"(",
"listener",
")",
";",
"itemDeleteToListenerMap",
".",
"put",
"(",
"listener",
",",
"delListener",
")",
";",
"EventContentFilter",
"deleteItem",
"=",
"new",
"EventContentFilter",
"(",
"EventElementType",
".",
"items",
".",
"toString",
"(",
")",
",",
"\"retract\"",
")",
";",
"EventContentFilter",
"purge",
"=",
"new",
"EventContentFilter",
"(",
"EventElementType",
".",
"purge",
".",
"toString",
"(",
")",
")",
";",
"// TODO: Use AsyncButOrdered (with Node as Key?)",
"pubSubManager",
".",
"getConnection",
"(",
")",
".",
"addSyncStanzaListener",
"(",
"delListener",
",",
"new",
"OrFilter",
"(",
"deleteItem",
",",
"purge",
")",
")",
";",
"}"
] | Register an listener for item delete events. This listener
gets called whenever an item is deleted from the node.
@param listener The handler for the event | [
"Register",
"an",
"listener",
"for",
"item",
"delete",
"events",
".",
"This",
"listener",
"gets",
"called",
"whenever",
"an",
"item",
"is",
"deleted",
"from",
"the",
"node",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Node.java#L546-L554 |
26,828 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Node.java | Node.removeItemDeleteListener | public void removeItemDeleteListener(ItemDeleteListener listener) {
StanzaListener conListener = itemDeleteToListenerMap .remove(listener);
if (conListener != null)
pubSubManager.getConnection().removeSyncStanzaListener(conListener);
} | java | public void removeItemDeleteListener(ItemDeleteListener listener) {
StanzaListener conListener = itemDeleteToListenerMap .remove(listener);
if (conListener != null)
pubSubManager.getConnection().removeSyncStanzaListener(conListener);
} | [
"public",
"void",
"removeItemDeleteListener",
"(",
"ItemDeleteListener",
"listener",
")",
"{",
"StanzaListener",
"conListener",
"=",
"itemDeleteToListenerMap",
".",
"remove",
"(",
"listener",
")",
";",
"if",
"(",
"conListener",
"!=",
"null",
")",
"pubSubManager",
".",
"getConnection",
"(",
")",
".",
"removeSyncStanzaListener",
"(",
"conListener",
")",
";",
"}"
] | Unregister a listener for item delete events.
@param listener The handler to unregister | [
"Unregister",
"a",
"listener",
"for",
"item",
"delete",
"events",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Node.java#L561-L566 |
26,829 | igniterealtime/Smack | smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/TransportNegotiator.java | TransportNegotiator.setAcceptedLocalCandidate | private void setAcceptedLocalCandidate(TransportCandidate bestLocalCandidate) {
for (int i = 0; i < resolver.getCandidateCount(); i++) {
// TODO FIX The EQUAL Sentence
if (resolver.getCandidate(i).getIp().equals(bestLocalCandidate.getIp())
&& resolver.getCandidate(i).getPort() == bestLocalCandidate.getPort()) {
acceptedLocalCandidate = resolver.getCandidate(i);
return;
}
}
LOGGER.fine("BEST: ip=" + bestLocalCandidate.getIp() + " port=" + bestLocalCandidate.getPort() + " has not been offered.");
// throw new XMPPException("Local transport candidate has not be offered.");
} | java | private void setAcceptedLocalCandidate(TransportCandidate bestLocalCandidate) {
for (int i = 0; i < resolver.getCandidateCount(); i++) {
// TODO FIX The EQUAL Sentence
if (resolver.getCandidate(i).getIp().equals(bestLocalCandidate.getIp())
&& resolver.getCandidate(i).getPort() == bestLocalCandidate.getPort()) {
acceptedLocalCandidate = resolver.getCandidate(i);
return;
}
}
LOGGER.fine("BEST: ip=" + bestLocalCandidate.getIp() + " port=" + bestLocalCandidate.getPort() + " has not been offered.");
// throw new XMPPException("Local transport candidate has not be offered.");
} | [
"private",
"void",
"setAcceptedLocalCandidate",
"(",
"TransportCandidate",
"bestLocalCandidate",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"resolver",
".",
"getCandidateCount",
"(",
")",
";",
"i",
"++",
")",
"{",
"// TODO FIX The EQUAL Sentence",
"if",
"(",
"resolver",
".",
"getCandidate",
"(",
"i",
")",
".",
"getIp",
"(",
")",
".",
"equals",
"(",
"bestLocalCandidate",
".",
"getIp",
"(",
")",
")",
"&&",
"resolver",
".",
"getCandidate",
"(",
"i",
")",
".",
"getPort",
"(",
")",
"==",
"bestLocalCandidate",
".",
"getPort",
"(",
")",
")",
"{",
"acceptedLocalCandidate",
"=",
"resolver",
".",
"getCandidate",
"(",
"i",
")",
";",
"return",
";",
"}",
"}",
"LOGGER",
".",
"fine",
"(",
"\"BEST: ip=\"",
"+",
"bestLocalCandidate",
".",
"getIp",
"(",
")",
"+",
"\" port=\"",
"+",
"bestLocalCandidate",
".",
"getPort",
"(",
")",
"+",
"\" has not been offered.\"",
")",
";",
"// throw new XMPPException(\"Local transport candidate has not be offered.\");",
"}"
] | Set the best local transport candidate we have offered and accepted by
the other endpoint.
@param bestLocalCandidate the acceptedLocalCandidate to set | [
"Set",
"the",
"best",
"local",
"transport",
"candidate",
"we",
"have",
"offered",
"and",
"accepted",
"by",
"the",
"other",
"endpoint",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/TransportNegotiator.java#L137-L148 |
26,830 | igniterealtime/Smack | smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/TransportNegotiator.java | TransportNegotiator.doStart | @Override
protected void doStart() {
try {
sendTransportCandidatesOffer();
setNegotiatorState(JingleNegotiatorState.PENDING);
} catch (Exception e) {
// TODO Auto-generated catch block
LOGGER.log(Level.WARNING, "exception", e);
}
} | java | @Override
protected void doStart() {
try {
sendTransportCandidatesOffer();
setNegotiatorState(JingleNegotiatorState.PENDING);
} catch (Exception e) {
// TODO Auto-generated catch block
LOGGER.log(Level.WARNING, "exception", e);
}
} | [
"@",
"Override",
"protected",
"void",
"doStart",
"(",
")",
"{",
"try",
"{",
"sendTransportCandidatesOffer",
"(",
")",
";",
"setNegotiatorState",
"(",
"JingleNegotiatorState",
".",
"PENDING",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"// TODO Auto-generated catch block",
"LOGGER",
".",
"log",
"(",
"Level",
".",
"WARNING",
",",
"\"exception\"",
",",
"e",
")",
";",
"}",
"}"
] | Called from above to start the negotiator during a session-initiate. | [
"Called",
"from",
"above",
"to",
"start",
"the",
"negotiator",
"during",
"a",
"session",
"-",
"initiate",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/TransportNegotiator.java#L162-L173 |
26,831 | igniterealtime/Smack | smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/TransportNegotiator.java | TransportNegotiator.addRemoteCandidate | private void addRemoteCandidate(TransportCandidate rc) {
// Add the candidate to the list
if (rc != null) {
if (acceptableTransportCandidate(rc, offeredCandidates)) {
synchronized (remoteCandidates) {
remoteCandidates.add(rc);
}
// Check if the new candidate can be used.
checkRemoteCandidate(rc);
}
}
} | java | private void addRemoteCandidate(TransportCandidate rc) {
// Add the candidate to the list
if (rc != null) {
if (acceptableTransportCandidate(rc, offeredCandidates)) {
synchronized (remoteCandidates) {
remoteCandidates.add(rc);
}
// Check if the new candidate can be used.
checkRemoteCandidate(rc);
}
}
} | [
"private",
"void",
"addRemoteCandidate",
"(",
"TransportCandidate",
"rc",
")",
"{",
"// Add the candidate to the list",
"if",
"(",
"rc",
"!=",
"null",
")",
"{",
"if",
"(",
"acceptableTransportCandidate",
"(",
"rc",
",",
"offeredCandidates",
")",
")",
"{",
"synchronized",
"(",
"remoteCandidates",
")",
"{",
"remoteCandidates",
".",
"add",
"(",
"rc",
")",
";",
"}",
"// Check if the new candidate can be used.",
"checkRemoteCandidate",
"(",
"rc",
")",
";",
"}",
"}",
"}"
] | Add a remote candidate to the list. The candidate will be checked in
order to verify if it is usable.
@param rc a remote candidate to add and check. | [
"Add",
"a",
"remote",
"candidate",
"to",
"the",
"list",
".",
"The",
"candidate",
"will",
"be",
"checked",
"in",
"order",
"to",
"verify",
"if",
"it",
"is",
"usable",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/TransportNegotiator.java#L217-L229 |
26,832 | igniterealtime/Smack | smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/TransportNegotiator.java | TransportNegotiator.checkRemoteCandidate | private void checkRemoteCandidate(final TransportCandidate offeredCandidate) {
offeredCandidate.addListener(new TransportResolverListener.Checker() {
@Override
public void candidateChecked(TransportCandidate cand, final boolean validCandidate) {
if (validCandidate) {
if (getNegotiatorState() == JingleNegotiatorState.PENDING)
addValidRemoteCandidate(offeredCandidate);
}
}
@Override
public void candidateChecking(TransportCandidate cand) {
}
});
offeredCandidate.check(resolver.getCandidatesList());
} | java | private void checkRemoteCandidate(final TransportCandidate offeredCandidate) {
offeredCandidate.addListener(new TransportResolverListener.Checker() {
@Override
public void candidateChecked(TransportCandidate cand, final boolean validCandidate) {
if (validCandidate) {
if (getNegotiatorState() == JingleNegotiatorState.PENDING)
addValidRemoteCandidate(offeredCandidate);
}
}
@Override
public void candidateChecking(TransportCandidate cand) {
}
});
offeredCandidate.check(resolver.getCandidatesList());
} | [
"private",
"void",
"checkRemoteCandidate",
"(",
"final",
"TransportCandidate",
"offeredCandidate",
")",
"{",
"offeredCandidate",
".",
"addListener",
"(",
"new",
"TransportResolverListener",
".",
"Checker",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"candidateChecked",
"(",
"TransportCandidate",
"cand",
",",
"final",
"boolean",
"validCandidate",
")",
"{",
"if",
"(",
"validCandidate",
")",
"{",
"if",
"(",
"getNegotiatorState",
"(",
")",
"==",
"JingleNegotiatorState",
".",
"PENDING",
")",
"addValidRemoteCandidate",
"(",
"offeredCandidate",
")",
";",
"}",
"}",
"@",
"Override",
"public",
"void",
"candidateChecking",
"(",
"TransportCandidate",
"cand",
")",
"{",
"}",
"}",
")",
";",
"offeredCandidate",
".",
"check",
"(",
"resolver",
".",
"getCandidatesList",
"(",
")",
")",
";",
"}"
] | Check asynchronously the new transport candidate.
@param offeredCandidate a transport candidates to check | [
"Check",
"asynchronously",
"the",
"new",
"transport",
"candidate",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/TransportNegotiator.java#L250-L266 |
26,833 | igniterealtime/Smack | smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/TransportNegotiator.java | TransportNegotiator.addValidRemoteCandidate | private void addValidRemoteCandidate(TransportCandidate remoteCandidate) {
// Add the candidate to the list
if (remoteCandidate != null) {
synchronized (validRemoteCandidates) {
LOGGER.fine("Added valid candidate: " + remoteCandidate.getIp() + ":" + remoteCandidate.getPort());
validRemoteCandidates.add(remoteCandidate);
}
}
} | java | private void addValidRemoteCandidate(TransportCandidate remoteCandidate) {
// Add the candidate to the list
if (remoteCandidate != null) {
synchronized (validRemoteCandidates) {
LOGGER.fine("Added valid candidate: " + remoteCandidate.getIp() + ":" + remoteCandidate.getPort());
validRemoteCandidates.add(remoteCandidate);
}
}
} | [
"private",
"void",
"addValidRemoteCandidate",
"(",
"TransportCandidate",
"remoteCandidate",
")",
"{",
"// Add the candidate to the list",
"if",
"(",
"remoteCandidate",
"!=",
"null",
")",
"{",
"synchronized",
"(",
"validRemoteCandidates",
")",
"{",
"LOGGER",
".",
"fine",
"(",
"\"Added valid candidate: \"",
"+",
"remoteCandidate",
".",
"getIp",
"(",
")",
"+",
"\":\"",
"+",
"remoteCandidate",
".",
"getPort",
"(",
")",
")",
";",
"validRemoteCandidates",
".",
"add",
"(",
"remoteCandidate",
")",
";",
"}",
"}",
"}"
] | Add a valid remote candidate to the list. The remote candidate has been
checked, and the remote
@param remoteCandidate a remote candidate to add | [
"Add",
"a",
"valid",
"remote",
"candidate",
"to",
"the",
"list",
".",
"The",
"remote",
"candidate",
"has",
"been",
"checked",
"and",
"the",
"remote"
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/TransportNegotiator.java#L458-L466 |
26,834 | igniterealtime/Smack | smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/TransportNegotiator.java | TransportNegotiator.obtainCandidatesList | private List<TransportCandidate> obtainCandidatesList(Jingle jingle) {
List<TransportCandidate> result = new ArrayList<>();
if (jingle != null) {
// Get the list of candidates from the packet
for (JingleContent jingleContent : jingle.getContentsList()) {
if (jingleContent.getName().equals(parentNegotiator.getName())) {
for (JingleTransport jingleTransport : jingleContent.getJingleTransportsList()) {
for (JingleTransportCandidate jingleTransportCandidate : jingleTransport.getCandidatesList()) {
TransportCandidate transCand = jingleTransportCandidate.getMediaTransport();
result.add(transCand);
}
}
}
}
}
return result;
} | java | private List<TransportCandidate> obtainCandidatesList(Jingle jingle) {
List<TransportCandidate> result = new ArrayList<>();
if (jingle != null) {
// Get the list of candidates from the packet
for (JingleContent jingleContent : jingle.getContentsList()) {
if (jingleContent.getName().equals(parentNegotiator.getName())) {
for (JingleTransport jingleTransport : jingleContent.getJingleTransportsList()) {
for (JingleTransportCandidate jingleTransportCandidate : jingleTransport.getCandidatesList()) {
TransportCandidate transCand = jingleTransportCandidate.getMediaTransport();
result.add(transCand);
}
}
}
}
}
return result;
} | [
"private",
"List",
"<",
"TransportCandidate",
">",
"obtainCandidatesList",
"(",
"Jingle",
"jingle",
")",
"{",
"List",
"<",
"TransportCandidate",
">",
"result",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"if",
"(",
"jingle",
"!=",
"null",
")",
"{",
"// Get the list of candidates from the packet",
"for",
"(",
"JingleContent",
"jingleContent",
":",
"jingle",
".",
"getContentsList",
"(",
")",
")",
"{",
"if",
"(",
"jingleContent",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"parentNegotiator",
".",
"getName",
"(",
")",
")",
")",
"{",
"for",
"(",
"JingleTransport",
"jingleTransport",
":",
"jingleContent",
".",
"getJingleTransportsList",
"(",
")",
")",
"{",
"for",
"(",
"JingleTransportCandidate",
"jingleTransportCandidate",
":",
"jingleTransport",
".",
"getCandidatesList",
"(",
")",
")",
"{",
"TransportCandidate",
"transCand",
"=",
"jingleTransportCandidate",
".",
"getMediaTransport",
"(",
")",
";",
"result",
".",
"add",
"(",
"transCand",
")",
";",
"}",
"}",
"}",
"}",
"}",
"return",
"result",
";",
"}"
] | Parse the list of transport candidates from a Jingle packet.
@param jin The input jingle packet | [
"Parse",
"the",
"list",
"of",
"transport",
"candidates",
"from",
"a",
"Jingle",
"packet",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/TransportNegotiator.java#L510-L528 |
26,835 | igniterealtime/Smack | smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/TransportNegotiator.java | TransportNegotiator.sendTransportCandidateOffer | private synchronized void sendTransportCandidateOffer(TransportCandidate cand) throws NotConnectedException, InterruptedException {
if (!cand.isNull()) {
// Offer our new candidate...
addOfferedCandidate(cand);
JingleContent content = parentNegotiator.getJingleContent();
content.addJingleTransport(getJingleTransport(cand));
Jingle jingle = new Jingle(JingleActionEnum.TRANSPORT_INFO);
jingle.addContent(content);
// We SHOULD NOT be sending packets directly.
// This circumvents the state machinery.
// TODO - work this into the state machinery.
session.sendFormattedJingle(jingle);
}
} | java | private synchronized void sendTransportCandidateOffer(TransportCandidate cand) throws NotConnectedException, InterruptedException {
if (!cand.isNull()) {
// Offer our new candidate...
addOfferedCandidate(cand);
JingleContent content = parentNegotiator.getJingleContent();
content.addJingleTransport(getJingleTransport(cand));
Jingle jingle = new Jingle(JingleActionEnum.TRANSPORT_INFO);
jingle.addContent(content);
// We SHOULD NOT be sending packets directly.
// This circumvents the state machinery.
// TODO - work this into the state machinery.
session.sendFormattedJingle(jingle);
}
} | [
"private",
"synchronized",
"void",
"sendTransportCandidateOffer",
"(",
"TransportCandidate",
"cand",
")",
"throws",
"NotConnectedException",
",",
"InterruptedException",
"{",
"if",
"(",
"!",
"cand",
".",
"isNull",
"(",
")",
")",
"{",
"// Offer our new candidate...",
"addOfferedCandidate",
"(",
"cand",
")",
";",
"JingleContent",
"content",
"=",
"parentNegotiator",
".",
"getJingleContent",
"(",
")",
";",
"content",
".",
"addJingleTransport",
"(",
"getJingleTransport",
"(",
"cand",
")",
")",
";",
"Jingle",
"jingle",
"=",
"new",
"Jingle",
"(",
"JingleActionEnum",
".",
"TRANSPORT_INFO",
")",
";",
"jingle",
".",
"addContent",
"(",
"content",
")",
";",
"// We SHOULD NOT be sending packets directly.",
"// This circumvents the state machinery.",
"// TODO - work this into the state machinery.",
"session",
".",
"sendFormattedJingle",
"(",
"jingle",
")",
";",
"}",
"}"
] | Send an offer for a transport candidate
@param cand
@throws NotConnectedException
@throws InterruptedException | [
"Send",
"an",
"offer",
"for",
"a",
"transport",
"candidate"
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/TransportNegotiator.java#L537-L551 |
26,836 | igniterealtime/Smack | smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/TransportNegotiator.java | TransportNegotiator.sendTransportCandidatesOffer | private void sendTransportCandidatesOffer() throws XMPPException, SmackException, InterruptedException {
List<TransportCandidate> notOffered = resolver.getCandidatesList();
notOffered.removeAll(offeredCandidates);
// Send any unset candidate
for (Object aNotOffered : notOffered) {
sendTransportCandidateOffer((TransportCandidate) aNotOffered);
}
// .. and start a listener that will send any future candidate
if (resolverListener == null) {
// Add a listener that sends the offer when the resolver finishes...
resolverListener = new TransportResolverListener.Resolver() {
@Override
public void candidateAdded(TransportCandidate cand) throws NotConnectedException, InterruptedException {
sendTransportCandidateOffer(cand);
}
@Override
public void end() {
}
@Override
public void init() {
}
};
resolver.addListener(resolverListener);
}
if (!(resolver.isResolving() || resolver.isResolved())) {
// Resolve our IP and port
LOGGER.fine("RESOLVER CALLED");
resolver.resolve(session);
}
} | java | private void sendTransportCandidatesOffer() throws XMPPException, SmackException, InterruptedException {
List<TransportCandidate> notOffered = resolver.getCandidatesList();
notOffered.removeAll(offeredCandidates);
// Send any unset candidate
for (Object aNotOffered : notOffered) {
sendTransportCandidateOffer((TransportCandidate) aNotOffered);
}
// .. and start a listener that will send any future candidate
if (resolverListener == null) {
// Add a listener that sends the offer when the resolver finishes...
resolverListener = new TransportResolverListener.Resolver() {
@Override
public void candidateAdded(TransportCandidate cand) throws NotConnectedException, InterruptedException {
sendTransportCandidateOffer(cand);
}
@Override
public void end() {
}
@Override
public void init() {
}
};
resolver.addListener(resolverListener);
}
if (!(resolver.isResolving() || resolver.isResolved())) {
// Resolve our IP and port
LOGGER.fine("RESOLVER CALLED");
resolver.resolve(session);
}
} | [
"private",
"void",
"sendTransportCandidatesOffer",
"(",
")",
"throws",
"XMPPException",
",",
"SmackException",
",",
"InterruptedException",
"{",
"List",
"<",
"TransportCandidate",
">",
"notOffered",
"=",
"resolver",
".",
"getCandidatesList",
"(",
")",
";",
"notOffered",
".",
"removeAll",
"(",
"offeredCandidates",
")",
";",
"// Send any unset candidate",
"for",
"(",
"Object",
"aNotOffered",
":",
"notOffered",
")",
"{",
"sendTransportCandidateOffer",
"(",
"(",
"TransportCandidate",
")",
"aNotOffered",
")",
";",
"}",
"// .. and start a listener that will send any future candidate",
"if",
"(",
"resolverListener",
"==",
"null",
")",
"{",
"// Add a listener that sends the offer when the resolver finishes...",
"resolverListener",
"=",
"new",
"TransportResolverListener",
".",
"Resolver",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"candidateAdded",
"(",
"TransportCandidate",
"cand",
")",
"throws",
"NotConnectedException",
",",
"InterruptedException",
"{",
"sendTransportCandidateOffer",
"(",
"cand",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"end",
"(",
")",
"{",
"}",
"@",
"Override",
"public",
"void",
"init",
"(",
")",
"{",
"}",
"}",
";",
"resolver",
".",
"addListener",
"(",
"resolverListener",
")",
";",
"}",
"if",
"(",
"!",
"(",
"resolver",
".",
"isResolving",
"(",
")",
"||",
"resolver",
".",
"isResolved",
"(",
")",
")",
")",
"{",
"// Resolve our IP and port",
"LOGGER",
".",
"fine",
"(",
"\"RESOLVER CALLED\"",
")",
";",
"resolver",
".",
"resolve",
"(",
"session",
")",
";",
"}",
"}"
] | Create a Jingle stanza where we announce our transport candidates.
@throws XMPPException
@throws SmackException
@throws InterruptedException | [
"Create",
"a",
"Jingle",
"stanza",
"where",
"we",
"announce",
"our",
"transport",
"candidates",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/TransportNegotiator.java#L560-L596 |
26,837 | igniterealtime/Smack | smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/TransportNegotiator.java | TransportNegotiator.receiveContentAcceptAction | private IQ receiveContentAcceptAction(Jingle jingle) throws XMPPException {
IQ response = null;
// Parse the Jingle and get the accepted candidate
List<TransportCandidate> accepted = obtainCandidatesList(jingle);
if (!accepted.isEmpty()) {
for (TransportCandidate cand : accepted) {
LOGGER.fine("Remote accepted candidate addr: " + cand.getIp());
}
TransportCandidate cand = accepted.get(0);
setAcceptedLocalCandidate(cand);
if (isEstablished()) {
LOGGER.fine(cand.getIp() + " is set active");
// setNegotiatorState(JingleNegotiatorState.SUCCEEDED);
}
}
return response;
} | java | private IQ receiveContentAcceptAction(Jingle jingle) throws XMPPException {
IQ response = null;
// Parse the Jingle and get the accepted candidate
List<TransportCandidate> accepted = obtainCandidatesList(jingle);
if (!accepted.isEmpty()) {
for (TransportCandidate cand : accepted) {
LOGGER.fine("Remote accepted candidate addr: " + cand.getIp());
}
TransportCandidate cand = accepted.get(0);
setAcceptedLocalCandidate(cand);
if (isEstablished()) {
LOGGER.fine(cand.getIp() + " is set active");
// setNegotiatorState(JingleNegotiatorState.SUCCEEDED);
}
}
return response;
} | [
"private",
"IQ",
"receiveContentAcceptAction",
"(",
"Jingle",
"jingle",
")",
"throws",
"XMPPException",
"{",
"IQ",
"response",
"=",
"null",
";",
"// Parse the Jingle and get the accepted candidate",
"List",
"<",
"TransportCandidate",
">",
"accepted",
"=",
"obtainCandidatesList",
"(",
"jingle",
")",
";",
"if",
"(",
"!",
"accepted",
".",
"isEmpty",
"(",
")",
")",
"{",
"for",
"(",
"TransportCandidate",
"cand",
":",
"accepted",
")",
"{",
"LOGGER",
".",
"fine",
"(",
"\"Remote accepted candidate addr: \"",
"+",
"cand",
".",
"getIp",
"(",
")",
")",
";",
"}",
"TransportCandidate",
"cand",
"=",
"accepted",
".",
"get",
"(",
"0",
")",
";",
"setAcceptedLocalCandidate",
"(",
"cand",
")",
";",
"if",
"(",
"isEstablished",
"(",
")",
")",
"{",
"LOGGER",
".",
"fine",
"(",
"cand",
".",
"getIp",
"(",
")",
"+",
"\" is set active\"",
")",
";",
"// setNegotiatorState(JingleNegotiatorState.SUCCEEDED);",
"}",
"}",
"return",
"response",
";",
"}"
] | One of our transport candidates has been accepted.
@return a Jingle packet
@throws XMPPException an exception
@see org.jivesoftware.smackx.jingleold.JingleNegotiator.State#eventAccept(org.jivesoftware.smackx.jingleold.packet.Jingle) | [
"One",
"of",
"our",
"transport",
"candidates",
"has",
"been",
"accepted",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/TransportNegotiator.java#L754-L774 |
26,838 | igniterealtime/Smack | smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/TransportNegotiator.java | TransportNegotiator.triggerTransportEstablished | private void triggerTransportEstablished(TransportCandidate local, TransportCandidate remote) throws NotConnectedException, InterruptedException {
List<JingleListener> listeners = getListenersList();
for (JingleListener li : listeners) {
if (li instanceof JingleTransportListener) {
JingleTransportListener mli = (JingleTransportListener) li;
LOGGER.fine("triggerTransportEstablished " + local.getLocalIp() + ":" + local.getPort() + " <-> "
+ remote.getIp() + ":" + remote.getPort());
mli.transportEstablished(local, remote);
}
}
} | java | private void triggerTransportEstablished(TransportCandidate local, TransportCandidate remote) throws NotConnectedException, InterruptedException {
List<JingleListener> listeners = getListenersList();
for (JingleListener li : listeners) {
if (li instanceof JingleTransportListener) {
JingleTransportListener mli = (JingleTransportListener) li;
LOGGER.fine("triggerTransportEstablished " + local.getLocalIp() + ":" + local.getPort() + " <-> "
+ remote.getIp() + ":" + remote.getPort());
mli.transportEstablished(local, remote);
}
}
} | [
"private",
"void",
"triggerTransportEstablished",
"(",
"TransportCandidate",
"local",
",",
"TransportCandidate",
"remote",
")",
"throws",
"NotConnectedException",
",",
"InterruptedException",
"{",
"List",
"<",
"JingleListener",
">",
"listeners",
"=",
"getListenersList",
"(",
")",
";",
"for",
"(",
"JingleListener",
"li",
":",
"listeners",
")",
"{",
"if",
"(",
"li",
"instanceof",
"JingleTransportListener",
")",
"{",
"JingleTransportListener",
"mli",
"=",
"(",
"JingleTransportListener",
")",
"li",
";",
"LOGGER",
".",
"fine",
"(",
"\"triggerTransportEstablished \"",
"+",
"local",
".",
"getLocalIp",
"(",
")",
"+",
"\":\"",
"+",
"local",
".",
"getPort",
"(",
")",
"+",
"\" <-> \"",
"+",
"remote",
".",
"getIp",
"(",
")",
"+",
"\":\"",
"+",
"remote",
".",
"getPort",
"(",
")",
")",
";",
"mli",
".",
"transportEstablished",
"(",
"local",
",",
"remote",
")",
";",
"}",
"}",
"}"
] | Trigger a Transport session established event.
@param local TransportCandidate that has been agreed.
@param remote TransportCandidate that has been agreed.
@throws NotConnectedException
@throws InterruptedException | [
"Trigger",
"a",
"Transport",
"session",
"established",
"event",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/TransportNegotiator.java#L799-L809 |
26,839 | igniterealtime/Smack | smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/TransportNegotiator.java | TransportNegotiator.triggerTransportClosed | private void triggerTransportClosed(TransportCandidate cand) {
List<JingleListener> listeners = getListenersList();
for (JingleListener li : listeners) {
if (li instanceof JingleTransportListener) {
JingleTransportListener mli = (JingleTransportListener) li;
mli.transportClosed(cand);
}
}
} | java | private void triggerTransportClosed(TransportCandidate cand) {
List<JingleListener> listeners = getListenersList();
for (JingleListener li : listeners) {
if (li instanceof JingleTransportListener) {
JingleTransportListener mli = (JingleTransportListener) li;
mli.transportClosed(cand);
}
}
} | [
"private",
"void",
"triggerTransportClosed",
"(",
"TransportCandidate",
"cand",
")",
"{",
"List",
"<",
"JingleListener",
">",
"listeners",
"=",
"getListenersList",
"(",
")",
";",
"for",
"(",
"JingleListener",
"li",
":",
"listeners",
")",
"{",
"if",
"(",
"li",
"instanceof",
"JingleTransportListener",
")",
"{",
"JingleTransportListener",
"mli",
"=",
"(",
"JingleTransportListener",
")",
"li",
";",
"mli",
".",
"transportClosed",
"(",
"cand",
")",
";",
"}",
"}",
"}"
] | Trigger a Transport closed event.
@param cand current TransportCandidate that is cancelled. | [
"Trigger",
"a",
"Transport",
"closed",
"event",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/TransportNegotiator.java#L816-L824 |
26,840 | igniterealtime/Smack | smack-core/src/main/java/org/jivesoftware/smack/StanzaCollector.java | StanzaCollector.cancel | public synchronized void cancel() {
// If the packet collector has already been cancelled, do nothing.
if (cancelled) {
return;
}
cancelled = true;
connection.removeStanzaCollector(this);
notifyAll();
if (collectorToReset != null) {
collectorToReset.cancel();
}
} | java | public synchronized void cancel() {
// If the packet collector has already been cancelled, do nothing.
if (cancelled) {
return;
}
cancelled = true;
connection.removeStanzaCollector(this);
notifyAll();
if (collectorToReset != null) {
collectorToReset.cancel();
}
} | [
"public",
"synchronized",
"void",
"cancel",
"(",
")",
"{",
"// If the packet collector has already been cancelled, do nothing.",
"if",
"(",
"cancelled",
")",
"{",
"return",
";",
"}",
"cancelled",
"=",
"true",
";",
"connection",
".",
"removeStanzaCollector",
"(",
"this",
")",
";",
"notifyAll",
"(",
")",
";",
"if",
"(",
"collectorToReset",
"!=",
"null",
")",
"{",
"collectorToReset",
".",
"cancel",
"(",
")",
";",
"}",
"}"
] | Explicitly cancels the stanza collector so that no more results are
queued up. Once a stanza collector has been cancelled, it cannot be
re-enabled. Instead, a new stanza collector must be created. | [
"Explicitly",
"cancels",
"the",
"stanza",
"collector",
"so",
"that",
"no",
"more",
"results",
"are",
"queued",
"up",
".",
"Once",
"a",
"stanza",
"collector",
"has",
"been",
"cancelled",
"it",
"cannot",
"be",
"re",
"-",
"enabled",
".",
"Instead",
"a",
"new",
"stanza",
"collector",
"must",
"be",
"created",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-core/src/main/java/org/jivesoftware/smack/StanzaCollector.java#L86-L99 |
26,841 | igniterealtime/Smack | smack-core/src/main/java/org/jivesoftware/smack/StanzaCollector.java | StanzaCollector.getCollectedStanzasAfterCancelled | public List<Stanza> getCollectedStanzasAfterCancelled() {
if (!cancelled) {
throw new IllegalStateException("Stanza collector was not yet cancelled");
}
if (collectedCache == null) {
collectedCache = new ArrayList<>(getCollectedCount());
collectedCache.addAll(resultQueue);
}
return collectedCache;
} | java | public List<Stanza> getCollectedStanzasAfterCancelled() {
if (!cancelled) {
throw new IllegalStateException("Stanza collector was not yet cancelled");
}
if (collectedCache == null) {
collectedCache = new ArrayList<>(getCollectedCount());
collectedCache.addAll(resultQueue);
}
return collectedCache;
} | [
"public",
"List",
"<",
"Stanza",
">",
"getCollectedStanzasAfterCancelled",
"(",
")",
"{",
"if",
"(",
"!",
"cancelled",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Stanza collector was not yet cancelled\"",
")",
";",
"}",
"if",
"(",
"collectedCache",
"==",
"null",
")",
"{",
"collectedCache",
"=",
"new",
"ArrayList",
"<>",
"(",
"getCollectedCount",
"(",
")",
")",
";",
"collectedCache",
".",
"addAll",
"(",
"resultQueue",
")",
";",
"}",
"return",
"collectedCache",
";",
"}"
] | Return a list of all collected stanzas. This method must be invoked after the collector has been cancelled.
@return a list of collected stanzas.
@since 4.3.0 | [
"Return",
"a",
"list",
"of",
"all",
"collected",
"stanzas",
".",
"This",
"method",
"must",
"be",
"invoked",
"after",
"the",
"collector",
"has",
"been",
"cancelled",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-core/src/main/java/org/jivesoftware/smack/StanzaCollector.java#L309-L320 |
26,842 | igniterealtime/Smack | smack-core/src/main/java/org/jivesoftware/smack/StanzaCollector.java | StanzaCollector.processStanza | protected void processStanza(Stanza packet) {
if (packetFilter == null || packetFilter.accept(packet)) {
synchronized (this) {
if (resultQueue.size() == maxQueueSize) {
Stanza rolledOverStanza = resultQueue.poll();
assert rolledOverStanza != null;
}
resultQueue.add(packet);
notifyAll();
}
if (collectorToReset != null) {
collectorToReset.waitStart = System.currentTimeMillis();
}
}
} | java | protected void processStanza(Stanza packet) {
if (packetFilter == null || packetFilter.accept(packet)) {
synchronized (this) {
if (resultQueue.size() == maxQueueSize) {
Stanza rolledOverStanza = resultQueue.poll();
assert rolledOverStanza != null;
}
resultQueue.add(packet);
notifyAll();
}
if (collectorToReset != null) {
collectorToReset.waitStart = System.currentTimeMillis();
}
}
} | [
"protected",
"void",
"processStanza",
"(",
"Stanza",
"packet",
")",
"{",
"if",
"(",
"packetFilter",
"==",
"null",
"||",
"packetFilter",
".",
"accept",
"(",
"packet",
")",
")",
"{",
"synchronized",
"(",
"this",
")",
"{",
"if",
"(",
"resultQueue",
".",
"size",
"(",
")",
"==",
"maxQueueSize",
")",
"{",
"Stanza",
"rolledOverStanza",
"=",
"resultQueue",
".",
"poll",
"(",
")",
";",
"assert",
"rolledOverStanza",
"!=",
"null",
";",
"}",
"resultQueue",
".",
"add",
"(",
"packet",
")",
";",
"notifyAll",
"(",
")",
";",
"}",
"if",
"(",
"collectorToReset",
"!=",
"null",
")",
"{",
"collectorToReset",
".",
"waitStart",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"}",
"}",
"}"
] | Processes a stanza to see if it meets the criteria for this stanza collector.
If so, the stanza is added to the result queue.
@param packet the stanza to process. | [
"Processes",
"a",
"stanza",
"to",
"see",
"if",
"it",
"meets",
"the",
"criteria",
"for",
"this",
"stanza",
"collector",
".",
"If",
"so",
"the",
"stanza",
"is",
"added",
"to",
"the",
"result",
"queue",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-core/src/main/java/org/jivesoftware/smack/StanzaCollector.java#L343-L357 |
26,843 | igniterealtime/Smack | smack-android-extensions/src/main/java/org/jivesoftware/smackx/ping/android/ServerPingWithAlarmManager.java | ServerPingWithAlarmManager.onCreate | public static void onCreate(Context context) {
sContext = context;
context.registerReceiver(ALARM_BROADCAST_RECEIVER, new IntentFilter(PING_ALARM_ACTION));
sAlarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
sPendingIntent = PendingIntent.getBroadcast(context, 0, new Intent(PING_ALARM_ACTION), 0);
sAlarmManager.setInexactRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP,
SystemClock.elapsedRealtime() + AlarmManager.INTERVAL_HALF_HOUR,
AlarmManager.INTERVAL_HALF_HOUR, sPendingIntent);
} | java | public static void onCreate(Context context) {
sContext = context;
context.registerReceiver(ALARM_BROADCAST_RECEIVER, new IntentFilter(PING_ALARM_ACTION));
sAlarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
sPendingIntent = PendingIntent.getBroadcast(context, 0, new Intent(PING_ALARM_ACTION), 0);
sAlarmManager.setInexactRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP,
SystemClock.elapsedRealtime() + AlarmManager.INTERVAL_HALF_HOUR,
AlarmManager.INTERVAL_HALF_HOUR, sPendingIntent);
} | [
"public",
"static",
"void",
"onCreate",
"(",
"Context",
"context",
")",
"{",
"sContext",
"=",
"context",
";",
"context",
".",
"registerReceiver",
"(",
"ALARM_BROADCAST_RECEIVER",
",",
"new",
"IntentFilter",
"(",
"PING_ALARM_ACTION",
")",
")",
";",
"sAlarmManager",
"=",
"(",
"AlarmManager",
")",
"context",
".",
"getSystemService",
"(",
"Context",
".",
"ALARM_SERVICE",
")",
";",
"sPendingIntent",
"=",
"PendingIntent",
".",
"getBroadcast",
"(",
"context",
",",
"0",
",",
"new",
"Intent",
"(",
"PING_ALARM_ACTION",
")",
",",
"0",
")",
";",
"sAlarmManager",
".",
"setInexactRepeating",
"(",
"AlarmManager",
".",
"ELAPSED_REALTIME_WAKEUP",
",",
"SystemClock",
".",
"elapsedRealtime",
"(",
")",
"+",
"AlarmManager",
".",
"INTERVAL_HALF_HOUR",
",",
"AlarmManager",
".",
"INTERVAL_HALF_HOUR",
",",
"sPendingIntent",
")",
";",
"}"
] | Register a pending intent with the AlarmManager to be broadcasted every half hour and
register the alarm broadcast receiver to receive this intent. The receiver will check all
known questions if a ping is Necessary when invoked by the alarm intent.
@param context an Android context. | [
"Register",
"a",
"pending",
"intent",
"with",
"the",
"AlarmManager",
"to",
"be",
"broadcasted",
"every",
"half",
"hour",
"and",
"register",
"the",
"alarm",
"broadcast",
"receiver",
"to",
"receive",
"this",
"intent",
".",
"The",
"receiver",
"will",
"check",
"all",
"known",
"questions",
"if",
"a",
"ping",
"is",
"Necessary",
"when",
"invoked",
"by",
"the",
"alarm",
"intent",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-android-extensions/src/main/java/org/jivesoftware/smackx/ping/android/ServerPingWithAlarmManager.java#L162-L170 |
26,844 | igniterealtime/Smack | smack-core/src/main/java/org/jivesoftware/smack/packet/DefaultExtensionElement.java | DefaultExtensionElement.getNames | public synchronized Collection<String> getNames() {
if (map == null) {
return Collections.emptySet();
}
return Collections.unmodifiableSet(new HashMap<String,String>(map).keySet());
} | java | public synchronized Collection<String> getNames() {
if (map == null) {
return Collections.emptySet();
}
return Collections.unmodifiableSet(new HashMap<String,String>(map).keySet());
} | [
"public",
"synchronized",
"Collection",
"<",
"String",
">",
"getNames",
"(",
")",
"{",
"if",
"(",
"map",
"==",
"null",
")",
"{",
"return",
"Collections",
".",
"emptySet",
"(",
")",
";",
"}",
"return",
"Collections",
".",
"unmodifiableSet",
"(",
"new",
"HashMap",
"<",
"String",
",",
"String",
">",
"(",
"map",
")",
".",
"keySet",
"(",
")",
")",
";",
"}"
] | Returns an unmodifiable collection of the names that can be used to get
values of the stanza extension.
@return the names. | [
"Returns",
"an",
"unmodifiable",
"collection",
"of",
"the",
"names",
"that",
"can",
"be",
"used",
"to",
"get",
"values",
"of",
"the",
"stanza",
"extension",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-core/src/main/java/org/jivesoftware/smack/packet/DefaultExtensionElement.java#L106-L111 |
26,845 | igniterealtime/Smack | smack-core/src/main/java/org/jivesoftware/smack/packet/DefaultExtensionElement.java | DefaultExtensionElement.getValue | public synchronized String getValue(String name) {
if (map == null) {
return null;
}
return map.get(name);
} | java | public synchronized String getValue(String name) {
if (map == null) {
return null;
}
return map.get(name);
} | [
"public",
"synchronized",
"String",
"getValue",
"(",
"String",
"name",
")",
"{",
"if",
"(",
"map",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"map",
".",
"get",
"(",
"name",
")",
";",
"}"
] | Returns a stanza extension value given a name.
@param name the name.
@return the value. | [
"Returns",
"a",
"stanza",
"extension",
"value",
"given",
"a",
"name",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-core/src/main/java/org/jivesoftware/smack/packet/DefaultExtensionElement.java#L119-L124 |
26,846 | igniterealtime/Smack | smack-core/src/main/java/org/jivesoftware/smack/packet/DefaultExtensionElement.java | DefaultExtensionElement.setValue | public synchronized void setValue(String name, String value) {
if (map == null) {
map = new HashMap<String,String>();
}
map.put(name, value);
} | java | public synchronized void setValue(String name, String value) {
if (map == null) {
map = new HashMap<String,String>();
}
map.put(name, value);
} | [
"public",
"synchronized",
"void",
"setValue",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"if",
"(",
"map",
"==",
"null",
")",
"{",
"map",
"=",
"new",
"HashMap",
"<",
"String",
",",
"String",
">",
"(",
")",
";",
"}",
"map",
".",
"put",
"(",
"name",
",",
"value",
")",
";",
"}"
] | Sets a stanza extension value using the given name.
@param name the name.
@param value the value. | [
"Sets",
"a",
"stanza",
"extension",
"value",
"using",
"the",
"given",
"name",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-core/src/main/java/org/jivesoftware/smack/packet/DefaultExtensionElement.java#L132-L137 |
26,847 | igniterealtime/Smack | smack-debug/src/main/java/org/jivesoftware/smackx/debugger/LiteDebugger.java | LiteDebugger.rootWindowClosing | public void rootWindowClosing(WindowEvent evt) {
// TODO: Remove debugger from connection.
((ObservableReader) reader).removeReaderListener(readerListener);
((ObservableWriter) writer).removeWriterListener(writerListener);
} | java | public void rootWindowClosing(WindowEvent evt) {
// TODO: Remove debugger from connection.
((ObservableReader) reader).removeReaderListener(readerListener);
((ObservableWriter) writer).removeWriterListener(writerListener);
} | [
"public",
"void",
"rootWindowClosing",
"(",
"WindowEvent",
"evt",
")",
"{",
"// TODO: Remove debugger from connection.",
"(",
"(",
"ObservableReader",
")",
"reader",
")",
".",
"removeReaderListener",
"(",
"readerListener",
")",
";",
"(",
"(",
"ObservableWriter",
")",
"writer",
")",
".",
"removeWriterListener",
"(",
"writerListener",
")",
";",
"}"
] | Notification that the root window is closing. Stop listening for received and
transmitted packets.
@param evt the event that indicates that the root window is closing | [
"Notification",
"that",
"the",
"root",
"window",
"is",
"closing",
".",
"Stop",
"listening",
"for",
"received",
"and",
"transmitted",
"packets",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-debug/src/main/java/org/jivesoftware/smackx/debugger/LiteDebugger.java#L273-L277 |
26,848 | igniterealtime/Smack | smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSession.java | JingleSession.generateSessionId | protected static String generateSessionId() {
return String.valueOf(randomGenerator.nextInt(Integer.MAX_VALUE) + randomGenerator.nextInt(Integer.MAX_VALUE));
} | java | protected static String generateSessionId() {
return String.valueOf(randomGenerator.nextInt(Integer.MAX_VALUE) + randomGenerator.nextInt(Integer.MAX_VALUE));
} | [
"protected",
"static",
"String",
"generateSessionId",
"(",
")",
"{",
"return",
"String",
".",
"valueOf",
"(",
"randomGenerator",
".",
"nextInt",
"(",
"Integer",
".",
"MAX_VALUE",
")",
"+",
"randomGenerator",
".",
"nextInt",
"(",
"Integer",
".",
"MAX_VALUE",
")",
")",
";",
"}"
] | Generate a unique session ID. | [
"Generate",
"a",
"unique",
"session",
"ID",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSession.java#L237-L239 |
26,849 | igniterealtime/Smack | smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSession.java | JingleSession.setSessionState | public void setSessionState(JingleSessionState stateIs) {
LOGGER.fine("Session state change: " + sessionState + "->" + stateIs);
stateIs.enter();
sessionState = stateIs;
} | java | public void setSessionState(JingleSessionState stateIs) {
LOGGER.fine("Session state change: " + sessionState + "->" + stateIs);
stateIs.enter();
sessionState = stateIs;
} | [
"public",
"void",
"setSessionState",
"(",
"JingleSessionState",
"stateIs",
")",
"{",
"LOGGER",
".",
"fine",
"(",
"\"Session state change: \"",
"+",
"sessionState",
"+",
"\"->\"",
"+",
"stateIs",
")",
";",
"stateIs",
".",
"enter",
"(",
")",
";",
"sessionState",
"=",
"stateIs",
";",
"}"
] | Validate the state changes. | [
"Validate",
"the",
"state",
"changes",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSession.java#L245-L250 |
26,850 | igniterealtime/Smack | smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSession.java | JingleSession.isFullyEstablished | public boolean isFullyEstablished() {
boolean result = true;
for (ContentNegotiator contentNegotiator : contentNegotiators) {
if (!contentNegotiator.isFullyEstablished())
result = false;
}
return result;
} | java | public boolean isFullyEstablished() {
boolean result = true;
for (ContentNegotiator contentNegotiator : contentNegotiators) {
if (!contentNegotiator.isFullyEstablished())
result = false;
}
return result;
} | [
"public",
"boolean",
"isFullyEstablished",
"(",
")",
"{",
"boolean",
"result",
"=",
"true",
";",
"for",
"(",
"ContentNegotiator",
"contentNegotiator",
":",
"contentNegotiators",
")",
"{",
"if",
"(",
"!",
"contentNegotiator",
".",
"isFullyEstablished",
"(",
")",
")",
"result",
"=",
"false",
";",
"}",
"return",
"result",
";",
"}"
] | Return true if all of the media managers have finished. | [
"Return",
"true",
"if",
"all",
"of",
"the",
"media",
"managers",
"have",
"finished",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSession.java#L259-L266 |
26,851 | igniterealtime/Smack | smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSession.java | JingleSession.receivePacketAndRespond | public synchronized void receivePacketAndRespond(IQ iq) throws XMPPException, SmackException, InterruptedException {
List<IQ> responses = new ArrayList<>();
String responseId;
LOGGER.fine("Packet: " + iq.toXML());
try {
// Dispatch the packet to the JingleNegotiators and get back a list of the results.
responses.addAll(dispatchIncomingPacket(iq, null));
if (iq != null) {
responseId = iq.getStanzaId();
// Send the IQ to each of the content negotiators for further processing.
// Each content negotiator may pass back a list of JingleContent for addition to the response packet.
// CHECKSTYLE:OFF
for (ContentNegotiator contentNegotiator : contentNegotiators) {
// If at this point the content negotiator isn't started, it's because we sent a session-init jingle
// packet from startOutgoing() and we're waiting for the other side to let us know they're ready
// to take jingle packets. (This packet might be a session-terminate, but that will get handled
// later.
if (!contentNegotiator.isStarted()) {
contentNegotiator.start();
}
responses.addAll(contentNegotiator.dispatchIncomingPacket(iq, responseId));
}
// CHECKSTYLE:ON
}
// Acknowledge the IQ reception
// Not anymore. The state machine generates an appropriate response IQ that
// gets sent back at the end of this routine.
// sendAck(iq);
} catch (JingleException e) {
// Send an error message, if present
JingleError error = e.getError();
if (error != null) {
responses.add(createJingleError(iq, error));
}
// Notify the session end and close everything...
triggerSessionClosedOnError(e);
}
// // If the response is anything other than a RESULT then send it now.
// if ((response != null) && (!response.getType().equals(IQ.Type.result))) {
// getConnection().sendStanza(response);
// }
// Loop through all of the responses and send them.
for (IQ response : responses) {
sendStanza(response);
}
} | java | public synchronized void receivePacketAndRespond(IQ iq) throws XMPPException, SmackException, InterruptedException {
List<IQ> responses = new ArrayList<>();
String responseId;
LOGGER.fine("Packet: " + iq.toXML());
try {
// Dispatch the packet to the JingleNegotiators and get back a list of the results.
responses.addAll(dispatchIncomingPacket(iq, null));
if (iq != null) {
responseId = iq.getStanzaId();
// Send the IQ to each of the content negotiators for further processing.
// Each content negotiator may pass back a list of JingleContent for addition to the response packet.
// CHECKSTYLE:OFF
for (ContentNegotiator contentNegotiator : contentNegotiators) {
// If at this point the content negotiator isn't started, it's because we sent a session-init jingle
// packet from startOutgoing() and we're waiting for the other side to let us know they're ready
// to take jingle packets. (This packet might be a session-terminate, but that will get handled
// later.
if (!contentNegotiator.isStarted()) {
contentNegotiator.start();
}
responses.addAll(contentNegotiator.dispatchIncomingPacket(iq, responseId));
}
// CHECKSTYLE:ON
}
// Acknowledge the IQ reception
// Not anymore. The state machine generates an appropriate response IQ that
// gets sent back at the end of this routine.
// sendAck(iq);
} catch (JingleException e) {
// Send an error message, if present
JingleError error = e.getError();
if (error != null) {
responses.add(createJingleError(iq, error));
}
// Notify the session end and close everything...
triggerSessionClosedOnError(e);
}
// // If the response is anything other than a RESULT then send it now.
// if ((response != null) && (!response.getType().equals(IQ.Type.result))) {
// getConnection().sendStanza(response);
// }
// Loop through all of the responses and send them.
for (IQ response : responses) {
sendStanza(response);
}
} | [
"public",
"synchronized",
"void",
"receivePacketAndRespond",
"(",
"IQ",
"iq",
")",
"throws",
"XMPPException",
",",
"SmackException",
",",
"InterruptedException",
"{",
"List",
"<",
"IQ",
">",
"responses",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"String",
"responseId",
";",
"LOGGER",
".",
"fine",
"(",
"\"Packet: \"",
"+",
"iq",
".",
"toXML",
"(",
")",
")",
";",
"try",
"{",
"// Dispatch the packet to the JingleNegotiators and get back a list of the results.",
"responses",
".",
"addAll",
"(",
"dispatchIncomingPacket",
"(",
"iq",
",",
"null",
")",
")",
";",
"if",
"(",
"iq",
"!=",
"null",
")",
"{",
"responseId",
"=",
"iq",
".",
"getStanzaId",
"(",
")",
";",
"// Send the IQ to each of the content negotiators for further processing.",
"// Each content negotiator may pass back a list of JingleContent for addition to the response packet.",
"// CHECKSTYLE:OFF",
"for",
"(",
"ContentNegotiator",
"contentNegotiator",
":",
"contentNegotiators",
")",
"{",
"// If at this point the content negotiator isn't started, it's because we sent a session-init jingle",
"// packet from startOutgoing() and we're waiting for the other side to let us know they're ready",
"// to take jingle packets. (This packet might be a session-terminate, but that will get handled",
"// later.",
"if",
"(",
"!",
"contentNegotiator",
".",
"isStarted",
"(",
")",
")",
"{",
"contentNegotiator",
".",
"start",
"(",
")",
";",
"}",
"responses",
".",
"addAll",
"(",
"contentNegotiator",
".",
"dispatchIncomingPacket",
"(",
"iq",
",",
"responseId",
")",
")",
";",
"}",
"// CHECKSTYLE:ON",
"}",
"// Acknowledge the IQ reception",
"// Not anymore. The state machine generates an appropriate response IQ that",
"// gets sent back at the end of this routine.",
"// sendAck(iq);",
"}",
"catch",
"(",
"JingleException",
"e",
")",
"{",
"// Send an error message, if present",
"JingleError",
"error",
"=",
"e",
".",
"getError",
"(",
")",
";",
"if",
"(",
"error",
"!=",
"null",
")",
"{",
"responses",
".",
"add",
"(",
"createJingleError",
"(",
"iq",
",",
"error",
")",
")",
";",
"}",
"// Notify the session end and close everything...",
"triggerSessionClosedOnError",
"(",
"e",
")",
";",
"}",
"// // If the response is anything other than a RESULT then send it now.",
"// if ((response != null) && (!response.getType().equals(IQ.Type.result))) {",
"// getConnection().sendStanza(response);",
"// }",
"// Loop through all of the responses and send them.",
"for",
"(",
"IQ",
"response",
":",
"responses",
")",
"{",
"sendStanza",
"(",
"response",
")",
";",
"}",
"}"
] | Process and respond to an incoming packet. This method is called
from the stanza listener dispatcher when a new stanza has arrived. The
method is responsible for recognizing the stanza type and, depending on
the current state, delivering it to the right event handler and wait for
a response. The response will be another Jingle stanza that will be sent
to the other end point.
@param iq
the stanza received
@throws XMPPException
@throws SmackException
@throws InterruptedException | [
"Process",
"and",
"respond",
"to",
"an",
"incoming",
"packet",
".",
"This",
"method",
"is",
"called",
"from",
"the",
"stanza",
"listener",
"dispatcher",
"when",
"a",
"new",
"stanza",
"has",
"arrived",
".",
"The",
"method",
"is",
"responsible",
"for",
"recognizing",
"the",
"stanza",
"type",
"and",
"depending",
"on",
"the",
"current",
"state",
"delivering",
"it",
"to",
"the",
"right",
"event",
"handler",
"and",
"wait",
"for",
"a",
"response",
".",
"The",
"response",
"will",
"be",
"another",
"Jingle",
"stanza",
"that",
"will",
"be",
"sent",
"to",
"the",
"other",
"end",
"point",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSession.java#L286-L342 |
26,852 | igniterealtime/Smack | smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSession.java | JingleSession.sendFormattedJingle | public Jingle sendFormattedJingle(IQ iq, Jingle jout) throws NotConnectedException, InterruptedException {
if (jout != null) {
if (jout.getInitiator() == null) {
jout.setInitiator(getInitiator());
}
if (jout.getResponder() == null) {
jout.setResponder(getResponder());
}
if (jout.getSid() == null) {
jout.setSid(getSid());
}
Jid me = getConnection().getUser();
Jid other = getResponder().equals(me) ? getInitiator() : getResponder();
if (jout.getTo() == null) {
if (iq != null) {
jout.setTo(iq.getFrom());
} else {
jout.setTo(other);
}
}
if (jout.getFrom() == null) {
if (iq != null) {
jout.setFrom(iq.getTo());
} else {
jout.setFrom(me);
}
}
// The the packet.
// CHECKSTYLE:OFF
if ((getConnection() != null) && getConnection().isConnected())
getConnection().sendStanza(jout);
// CHECKSTYLE:ON
}
return jout;
} | java | public Jingle sendFormattedJingle(IQ iq, Jingle jout) throws NotConnectedException, InterruptedException {
if (jout != null) {
if (jout.getInitiator() == null) {
jout.setInitiator(getInitiator());
}
if (jout.getResponder() == null) {
jout.setResponder(getResponder());
}
if (jout.getSid() == null) {
jout.setSid(getSid());
}
Jid me = getConnection().getUser();
Jid other = getResponder().equals(me) ? getInitiator() : getResponder();
if (jout.getTo() == null) {
if (iq != null) {
jout.setTo(iq.getFrom());
} else {
jout.setTo(other);
}
}
if (jout.getFrom() == null) {
if (iq != null) {
jout.setFrom(iq.getTo());
} else {
jout.setFrom(me);
}
}
// The the packet.
// CHECKSTYLE:OFF
if ((getConnection() != null) && getConnection().isConnected())
getConnection().sendStanza(jout);
// CHECKSTYLE:ON
}
return jout;
} | [
"public",
"Jingle",
"sendFormattedJingle",
"(",
"IQ",
"iq",
",",
"Jingle",
"jout",
")",
"throws",
"NotConnectedException",
",",
"InterruptedException",
"{",
"if",
"(",
"jout",
"!=",
"null",
")",
"{",
"if",
"(",
"jout",
".",
"getInitiator",
"(",
")",
"==",
"null",
")",
"{",
"jout",
".",
"setInitiator",
"(",
"getInitiator",
"(",
")",
")",
";",
"}",
"if",
"(",
"jout",
".",
"getResponder",
"(",
")",
"==",
"null",
")",
"{",
"jout",
".",
"setResponder",
"(",
"getResponder",
"(",
")",
")",
";",
"}",
"if",
"(",
"jout",
".",
"getSid",
"(",
")",
"==",
"null",
")",
"{",
"jout",
".",
"setSid",
"(",
"getSid",
"(",
")",
")",
";",
"}",
"Jid",
"me",
"=",
"getConnection",
"(",
")",
".",
"getUser",
"(",
")",
";",
"Jid",
"other",
"=",
"getResponder",
"(",
")",
".",
"equals",
"(",
"me",
")",
"?",
"getInitiator",
"(",
")",
":",
"getResponder",
"(",
")",
";",
"if",
"(",
"jout",
".",
"getTo",
"(",
")",
"==",
"null",
")",
"{",
"if",
"(",
"iq",
"!=",
"null",
")",
"{",
"jout",
".",
"setTo",
"(",
"iq",
".",
"getFrom",
"(",
")",
")",
";",
"}",
"else",
"{",
"jout",
".",
"setTo",
"(",
"other",
")",
";",
"}",
"}",
"if",
"(",
"jout",
".",
"getFrom",
"(",
")",
"==",
"null",
")",
"{",
"if",
"(",
"iq",
"!=",
"null",
")",
"{",
"jout",
".",
"setFrom",
"(",
"iq",
".",
"getTo",
"(",
")",
")",
";",
"}",
"else",
"{",
"jout",
".",
"setFrom",
"(",
"me",
")",
";",
"}",
"}",
"// The the packet.",
"// CHECKSTYLE:OFF",
"if",
"(",
"(",
"getConnection",
"(",
")",
"!=",
"null",
")",
"&&",
"getConnection",
"(",
")",
".",
"isConnected",
"(",
")",
")",
"getConnection",
"(",
")",
".",
"sendStanza",
"(",
"jout",
")",
";",
"// CHECKSTYLE:ON",
"}",
"return",
"jout",
";",
"}"
] | Complete and send a packet. Complete all the null fields in a Jingle
reponse, using the session information we have or some info from the
incoming packet.
@param iq
The Jingle stanza we are responding to
@param jout
the Jingle stanza we want to complete and send
@throws NotConnectedException
@throws InterruptedException | [
"Complete",
"and",
"send",
"a",
"packet",
".",
"Complete",
"all",
"the",
"null",
"fields",
"in",
"a",
"Jingle",
"reponse",
"using",
"the",
"session",
"information",
"we",
"have",
"or",
"some",
"info",
"from",
"the",
"incoming",
"packet",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSession.java#L446-L486 |
26,853 | igniterealtime/Smack | smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSession.java | JingleSession.createAck | public IQ createAck(IQ iq) {
IQ result = null;
if (iq != null) {
// Don't acknowledge ACKs, errors...
if (iq.getType().equals(IQ.Type.set)) {
IQ ack = IQ.createResultIQ(iq);
// No! Don't send it. Let it flow to the normal way IQ results get processed and sent.
// getConnection().sendStanza(ack);
result = ack;
}
}
return result;
} | java | public IQ createAck(IQ iq) {
IQ result = null;
if (iq != null) {
// Don't acknowledge ACKs, errors...
if (iq.getType().equals(IQ.Type.set)) {
IQ ack = IQ.createResultIQ(iq);
// No! Don't send it. Let it flow to the normal way IQ results get processed and sent.
// getConnection().sendStanza(ack);
result = ack;
}
}
return result;
} | [
"public",
"IQ",
"createAck",
"(",
"IQ",
"iq",
")",
"{",
"IQ",
"result",
"=",
"null",
";",
"if",
"(",
"iq",
"!=",
"null",
")",
"{",
"// Don't acknowledge ACKs, errors...",
"if",
"(",
"iq",
".",
"getType",
"(",
")",
".",
"equals",
"(",
"IQ",
".",
"Type",
".",
"set",
")",
")",
"{",
"IQ",
"ack",
"=",
"IQ",
".",
"createResultIQ",
"(",
"iq",
")",
";",
"// No! Don't send it. Let it flow to the normal way IQ results get processed and sent.",
"// getConnection().sendStanza(ack);",
"result",
"=",
"ack",
";",
"}",
"}",
"return",
"result",
";",
"}"
] | Acknowledge a IQ packet.
@param iq
The IQ to acknowledge | [
"Acknowledge",
"a",
"IQ",
"packet",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSession.java#L514-L528 |
26,854 | igniterealtime/Smack | smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSession.java | JingleSession.getInstanceFor | public static synchronized JingleSession getInstanceFor(XMPPConnection con) {
if (con == null) {
throw new IllegalArgumentException("XMPPConnection cannot be null");
}
JingleSession result = null;
synchronized (sessions) {
if (sessions.containsKey(con)) {
result = sessions.get(con);
}
}
return result;
} | java | public static synchronized JingleSession getInstanceFor(XMPPConnection con) {
if (con == null) {
throw new IllegalArgumentException("XMPPConnection cannot be null");
}
JingleSession result = null;
synchronized (sessions) {
if (sessions.containsKey(con)) {
result = sessions.get(con);
}
}
return result;
} | [
"public",
"static",
"synchronized",
"JingleSession",
"getInstanceFor",
"(",
"XMPPConnection",
"con",
")",
"{",
"if",
"(",
"con",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"XMPPConnection cannot be null\"",
")",
";",
"}",
"JingleSession",
"result",
"=",
"null",
";",
"synchronized",
"(",
"sessions",
")",
"{",
"if",
"(",
"sessions",
".",
"containsKey",
"(",
"con",
")",
")",
"{",
"result",
"=",
"sessions",
".",
"get",
"(",
"con",
")",
";",
"}",
"}",
"return",
"result",
";",
"}"
] | Returns the JingleSession related to a particular connection.
@param con
A XMPP connection
@return a Jingle session | [
"Returns",
"the",
"JingleSession",
"related",
"to",
"a",
"particular",
"connection",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSession.java#L623-L636 |
26,855 | igniterealtime/Smack | smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSession.java | JingleSession.installConnectionListeners | private void installConnectionListeners(final XMPPConnection connection) {
if (connection != null) {
connectionListener = new AbstractConnectionClosedListener() {
@Override
public void connectionTerminated() {
unregisterInstanceFor(connection);
}
};
connection.addConnectionListener(connectionListener);
}
} | java | private void installConnectionListeners(final XMPPConnection connection) {
if (connection != null) {
connectionListener = new AbstractConnectionClosedListener() {
@Override
public void connectionTerminated() {
unregisterInstanceFor(connection);
}
};
connection.addConnectionListener(connectionListener);
}
} | [
"private",
"void",
"installConnectionListeners",
"(",
"final",
"XMPPConnection",
"connection",
")",
"{",
"if",
"(",
"connection",
"!=",
"null",
")",
"{",
"connectionListener",
"=",
"new",
"AbstractConnectionClosedListener",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"connectionTerminated",
"(",
")",
"{",
"unregisterInstanceFor",
"(",
"connection",
")",
";",
"}",
"}",
";",
"connection",
".",
"addConnectionListener",
"(",
"connectionListener",
")",
";",
"}",
"}"
] | Configure a session, setting some action listeners...
@param connection
The connection to set up | [
"Configure",
"a",
"session",
"setting",
"some",
"action",
"listeners",
"..."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSession.java#L644-L654 |
26,856 | igniterealtime/Smack | smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSession.java | JingleSession.updatePacketListener | protected void updatePacketListener() {
removeAsyncPacketListener();
LOGGER.fine("UpdatePacketListener");
packetListener = new StanzaListener() {
@Override
public void processStanza(Stanza packet) {
try {
receivePacketAndRespond((IQ) packet);
} catch (Exception e) {
LOGGER.log(Level.WARNING, "exception", e);
}
}
};
packetFilter = new StanzaFilter() {
@Override
public boolean accept(Stanza packet) {
if (packet instanceof IQ) {
IQ iq = (IQ) packet;
Jid me = getConnection().getUser();
if (!iq.getTo().equals(me)) {
return false;
}
Jid other = getResponder().equals(me) ? getInitiator() : getResponder();
if (iq.getFrom() == null || !iq.getFrom().equals(other == null ? "" : other)) {
return false;
}
if (iq instanceof Jingle) {
Jingle jin = (Jingle) iq;
String sid = jin.getSid();
if (sid == null || !sid.equals(getSid())) {
LOGGER.fine("Ignored Jingle(SID) " + sid + "|" + getSid() + " :" + iq.toXML());
return false;
}
Jid ini = jin.getInitiator();
if (!ini.equals(getInitiator())) {
LOGGER.fine("Ignored Jingle(INI): " + iq.toXML());
return false;
}
} else {
// We accept some non-Jingle IQ packets: ERRORs and ACKs
if (iq.getType().equals(IQ.Type.set)) {
LOGGER.fine("Ignored Jingle(TYPE): " + iq.toXML());
return false;
} else if (iq.getType().equals(IQ.Type.get)) {
LOGGER.fine("Ignored Jingle(TYPE): " + iq.toXML());
return false;
}
}
return true;
}
return false;
}
};
getConnection().addAsyncStanzaListener(packetListener, packetFilter);
} | java | protected void updatePacketListener() {
removeAsyncPacketListener();
LOGGER.fine("UpdatePacketListener");
packetListener = new StanzaListener() {
@Override
public void processStanza(Stanza packet) {
try {
receivePacketAndRespond((IQ) packet);
} catch (Exception e) {
LOGGER.log(Level.WARNING, "exception", e);
}
}
};
packetFilter = new StanzaFilter() {
@Override
public boolean accept(Stanza packet) {
if (packet instanceof IQ) {
IQ iq = (IQ) packet;
Jid me = getConnection().getUser();
if (!iq.getTo().equals(me)) {
return false;
}
Jid other = getResponder().equals(me) ? getInitiator() : getResponder();
if (iq.getFrom() == null || !iq.getFrom().equals(other == null ? "" : other)) {
return false;
}
if (iq instanceof Jingle) {
Jingle jin = (Jingle) iq;
String sid = jin.getSid();
if (sid == null || !sid.equals(getSid())) {
LOGGER.fine("Ignored Jingle(SID) " + sid + "|" + getSid() + " :" + iq.toXML());
return false;
}
Jid ini = jin.getInitiator();
if (!ini.equals(getInitiator())) {
LOGGER.fine("Ignored Jingle(INI): " + iq.toXML());
return false;
}
} else {
// We accept some non-Jingle IQ packets: ERRORs and ACKs
if (iq.getType().equals(IQ.Type.set)) {
LOGGER.fine("Ignored Jingle(TYPE): " + iq.toXML());
return false;
} else if (iq.getType().equals(IQ.Type.get)) {
LOGGER.fine("Ignored Jingle(TYPE): " + iq.toXML());
return false;
}
}
return true;
}
return false;
}
};
getConnection().addAsyncStanzaListener(packetListener, packetFilter);
} | [
"protected",
"void",
"updatePacketListener",
"(",
")",
"{",
"removeAsyncPacketListener",
"(",
")",
";",
"LOGGER",
".",
"fine",
"(",
"\"UpdatePacketListener\"",
")",
";",
"packetListener",
"=",
"new",
"StanzaListener",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"processStanza",
"(",
"Stanza",
"packet",
")",
"{",
"try",
"{",
"receivePacketAndRespond",
"(",
"(",
"IQ",
")",
"packet",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"LOGGER",
".",
"log",
"(",
"Level",
".",
"WARNING",
",",
"\"exception\"",
",",
"e",
")",
";",
"}",
"}",
"}",
";",
"packetFilter",
"=",
"new",
"StanzaFilter",
"(",
")",
"{",
"@",
"Override",
"public",
"boolean",
"accept",
"(",
"Stanza",
"packet",
")",
"{",
"if",
"(",
"packet",
"instanceof",
"IQ",
")",
"{",
"IQ",
"iq",
"=",
"(",
"IQ",
")",
"packet",
";",
"Jid",
"me",
"=",
"getConnection",
"(",
")",
".",
"getUser",
"(",
")",
";",
"if",
"(",
"!",
"iq",
".",
"getTo",
"(",
")",
".",
"equals",
"(",
"me",
")",
")",
"{",
"return",
"false",
";",
"}",
"Jid",
"other",
"=",
"getResponder",
"(",
")",
".",
"equals",
"(",
"me",
")",
"?",
"getInitiator",
"(",
")",
":",
"getResponder",
"(",
")",
";",
"if",
"(",
"iq",
".",
"getFrom",
"(",
")",
"==",
"null",
"||",
"!",
"iq",
".",
"getFrom",
"(",
")",
".",
"equals",
"(",
"other",
"==",
"null",
"?",
"\"\"",
":",
"other",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"iq",
"instanceof",
"Jingle",
")",
"{",
"Jingle",
"jin",
"=",
"(",
"Jingle",
")",
"iq",
";",
"String",
"sid",
"=",
"jin",
".",
"getSid",
"(",
")",
";",
"if",
"(",
"sid",
"==",
"null",
"||",
"!",
"sid",
".",
"equals",
"(",
"getSid",
"(",
")",
")",
")",
"{",
"LOGGER",
".",
"fine",
"(",
"\"Ignored Jingle(SID) \"",
"+",
"sid",
"+",
"\"|\"",
"+",
"getSid",
"(",
")",
"+",
"\" :\"",
"+",
"iq",
".",
"toXML",
"(",
")",
")",
";",
"return",
"false",
";",
"}",
"Jid",
"ini",
"=",
"jin",
".",
"getInitiator",
"(",
")",
";",
"if",
"(",
"!",
"ini",
".",
"equals",
"(",
"getInitiator",
"(",
")",
")",
")",
"{",
"LOGGER",
".",
"fine",
"(",
"\"Ignored Jingle(INI): \"",
"+",
"iq",
".",
"toXML",
"(",
")",
")",
";",
"return",
"false",
";",
"}",
"}",
"else",
"{",
"// We accept some non-Jingle IQ packets: ERRORs and ACKs",
"if",
"(",
"iq",
".",
"getType",
"(",
")",
".",
"equals",
"(",
"IQ",
".",
"Type",
".",
"set",
")",
")",
"{",
"LOGGER",
".",
"fine",
"(",
"\"Ignored Jingle(TYPE): \"",
"+",
"iq",
".",
"toXML",
"(",
")",
")",
";",
"return",
"false",
";",
"}",
"else",
"if",
"(",
"iq",
".",
"getType",
"(",
")",
".",
"equals",
"(",
"IQ",
".",
"Type",
".",
"get",
")",
")",
"{",
"LOGGER",
".",
"fine",
"(",
"\"Ignored Jingle(TYPE): \"",
"+",
"iq",
".",
"toXML",
"(",
")",
")",
";",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}",
"}",
";",
"getConnection",
"(",
")",
".",
"addAsyncStanzaListener",
"(",
"packetListener",
",",
"packetFilter",
")",
";",
"}"
] | Install the stanza listener. The listener is responsible for responding
to any stanza that we receive... | [
"Install",
"the",
"stanza",
"listener",
".",
"The",
"listener",
"is",
"responsible",
"for",
"responding",
"to",
"any",
"stanza",
"that",
"we",
"receive",
"..."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSession.java#L681-L746 |
26,857 | igniterealtime/Smack | smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSession.java | JingleSession.addMediaListener | public void addMediaListener(JingleMediaListener li) {
for (ContentNegotiator contentNegotiator : contentNegotiators) {
if (contentNegotiator.getMediaNegotiator() != null) {
contentNegotiator.getMediaNegotiator().addListener(li);
}
}
} | java | public void addMediaListener(JingleMediaListener li) {
for (ContentNegotiator contentNegotiator : contentNegotiators) {
if (contentNegotiator.getMediaNegotiator() != null) {
contentNegotiator.getMediaNegotiator().addListener(li);
}
}
} | [
"public",
"void",
"addMediaListener",
"(",
"JingleMediaListener",
"li",
")",
"{",
"for",
"(",
"ContentNegotiator",
"contentNegotiator",
":",
"contentNegotiators",
")",
"{",
"if",
"(",
"contentNegotiator",
".",
"getMediaNegotiator",
"(",
")",
"!=",
"null",
")",
"{",
"contentNegotiator",
".",
"getMediaNegotiator",
"(",
")",
".",
"addListener",
"(",
"li",
")",
";",
"}",
"}",
"}"
] | Add a listener for jmf negotiation events.
@param li
The listener | [
"Add",
"a",
"listener",
"for",
"jmf",
"negotiation",
"events",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSession.java#L756-L763 |
26,858 | igniterealtime/Smack | smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSession.java | JingleSession.removeMediaListener | public void removeMediaListener(JingleMediaListener li) {
for (ContentNegotiator contentNegotiator : contentNegotiators) {
if (contentNegotiator.getMediaNegotiator() != null) {
contentNegotiator.getMediaNegotiator().removeListener(li);
}
}
} | java | public void removeMediaListener(JingleMediaListener li) {
for (ContentNegotiator contentNegotiator : contentNegotiators) {
if (contentNegotiator.getMediaNegotiator() != null) {
contentNegotiator.getMediaNegotiator().removeListener(li);
}
}
} | [
"public",
"void",
"removeMediaListener",
"(",
"JingleMediaListener",
"li",
")",
"{",
"for",
"(",
"ContentNegotiator",
"contentNegotiator",
":",
"contentNegotiators",
")",
"{",
"if",
"(",
"contentNegotiator",
".",
"getMediaNegotiator",
"(",
")",
"!=",
"null",
")",
"{",
"contentNegotiator",
".",
"getMediaNegotiator",
"(",
")",
".",
"removeListener",
"(",
"li",
")",
";",
"}",
"}",
"}"
] | Remove a listener for jmf negotiation events.
@param li
The listener | [
"Remove",
"a",
"listener",
"for",
"jmf",
"negotiation",
"events",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSession.java#L771-L777 |
26,859 | igniterealtime/Smack | smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSession.java | JingleSession.addTransportListener | public void addTransportListener(JingleTransportListener li) {
for (ContentNegotiator contentNegotiator : contentNegotiators) {
if (contentNegotiator.getTransportNegotiator() != null) {
contentNegotiator.getTransportNegotiator().addListener(li);
}
}
} | java | public void addTransportListener(JingleTransportListener li) {
for (ContentNegotiator contentNegotiator : contentNegotiators) {
if (contentNegotiator.getTransportNegotiator() != null) {
contentNegotiator.getTransportNegotiator().addListener(li);
}
}
} | [
"public",
"void",
"addTransportListener",
"(",
"JingleTransportListener",
"li",
")",
"{",
"for",
"(",
"ContentNegotiator",
"contentNegotiator",
":",
"contentNegotiators",
")",
"{",
"if",
"(",
"contentNegotiator",
".",
"getTransportNegotiator",
"(",
")",
"!=",
"null",
")",
"{",
"contentNegotiator",
".",
"getTransportNegotiator",
"(",
")",
".",
"addListener",
"(",
"li",
")",
";",
"}",
"}",
"}"
] | Add a listener for transport negotiation events.
@param li
The listener | [
"Add",
"a",
"listener",
"for",
"transport",
"negotiation",
"events",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSession.java#L785-L791 |
26,860 | igniterealtime/Smack | smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSession.java | JingleSession.removeTransportListener | public void removeTransportListener(JingleTransportListener li) {
for (ContentNegotiator contentNegotiator : contentNegotiators) {
if (contentNegotiator.getTransportNegotiator() != null) {
contentNegotiator.getTransportNegotiator().removeListener(li);
}
}
} | java | public void removeTransportListener(JingleTransportListener li) {
for (ContentNegotiator contentNegotiator : contentNegotiators) {
if (contentNegotiator.getTransportNegotiator() != null) {
contentNegotiator.getTransportNegotiator().removeListener(li);
}
}
} | [
"public",
"void",
"removeTransportListener",
"(",
"JingleTransportListener",
"li",
")",
"{",
"for",
"(",
"ContentNegotiator",
"contentNegotiator",
":",
"contentNegotiators",
")",
"{",
"if",
"(",
"contentNegotiator",
".",
"getTransportNegotiator",
"(",
")",
"!=",
"null",
")",
"{",
"contentNegotiator",
".",
"getTransportNegotiator",
"(",
")",
".",
"removeListener",
"(",
"li",
")",
";",
"}",
"}",
"}"
] | Remove a listener for transport negotiation events.
@param li
The listener | [
"Remove",
"a",
"listener",
"for",
"transport",
"negotiation",
"events",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSession.java#L799-L805 |
26,861 | igniterealtime/Smack | smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSession.java | JingleSession.setupListeners | public void setupListeners() {
JingleMediaListener jingleMediaListener = new JingleMediaListener() {
@Override
public void mediaClosed(PayloadType cand) {
}
@Override
public void mediaEstablished(PayloadType pt) throws NotConnectedException, InterruptedException {
if (isFullyEstablished()) {
Jingle jout = new Jingle(JingleActionEnum.SESSION_ACCEPT);
// Build up a response packet from each media manager.
for (ContentNegotiator contentNegotiator : contentNegotiators) {
if (contentNegotiator.getNegotiatorState() == JingleNegotiatorState.SUCCEEDED)
jout.addContent(contentNegotiator.getJingleContent());
}
// Send the "accept" and wait for the ACK
addExpectedId(jout.getStanzaId());
sendStanza(jout);
// triggerSessionEstablished();
}
}
};
JingleTransportListener jingleTransportListener = new JingleTransportListener() {
@Override
public void transportEstablished(TransportCandidate local, TransportCandidate remote) throws NotConnectedException, InterruptedException {
if (isFullyEstablished()) {
// CHECKSTYLE:OFF
// Indicate that this session is active.
setSessionState(JingleSessionStateActive.getInstance());
for (ContentNegotiator contentNegotiator : contentNegotiators) {
// CHECKSTYLE:ON
if (contentNegotiator.getNegotiatorState() == JingleNegotiatorState.SUCCEEDED)
contentNegotiator.triggerContentEstablished();
}
if (getSessionState().equals(JingleSessionStatePending.getInstance())) {
Jingle jout = new Jingle(JingleActionEnum.SESSION_ACCEPT);
// Build up a response packet from each media manager.
for (ContentNegotiator contentNegotiator : contentNegotiators) {
if (contentNegotiator.getNegotiatorState() == JingleNegotiatorState.SUCCEEDED)
jout.addContent(contentNegotiator.getJingleContent());
}
// Send the "accept" and wait for the ACK
addExpectedId(jout.getStanzaId());
sendStanza(jout);
}
}
}
@Override
public void transportClosed(TransportCandidate cand) {
}
@Override
public void transportClosedOnError(XMPPException e) {
}
};
addMediaListener(jingleMediaListener);
addTransportListener(jingleTransportListener);
} | java | public void setupListeners() {
JingleMediaListener jingleMediaListener = new JingleMediaListener() {
@Override
public void mediaClosed(PayloadType cand) {
}
@Override
public void mediaEstablished(PayloadType pt) throws NotConnectedException, InterruptedException {
if (isFullyEstablished()) {
Jingle jout = new Jingle(JingleActionEnum.SESSION_ACCEPT);
// Build up a response packet from each media manager.
for (ContentNegotiator contentNegotiator : contentNegotiators) {
if (contentNegotiator.getNegotiatorState() == JingleNegotiatorState.SUCCEEDED)
jout.addContent(contentNegotiator.getJingleContent());
}
// Send the "accept" and wait for the ACK
addExpectedId(jout.getStanzaId());
sendStanza(jout);
// triggerSessionEstablished();
}
}
};
JingleTransportListener jingleTransportListener = new JingleTransportListener() {
@Override
public void transportEstablished(TransportCandidate local, TransportCandidate remote) throws NotConnectedException, InterruptedException {
if (isFullyEstablished()) {
// CHECKSTYLE:OFF
// Indicate that this session is active.
setSessionState(JingleSessionStateActive.getInstance());
for (ContentNegotiator contentNegotiator : contentNegotiators) {
// CHECKSTYLE:ON
if (contentNegotiator.getNegotiatorState() == JingleNegotiatorState.SUCCEEDED)
contentNegotiator.triggerContentEstablished();
}
if (getSessionState().equals(JingleSessionStatePending.getInstance())) {
Jingle jout = new Jingle(JingleActionEnum.SESSION_ACCEPT);
// Build up a response packet from each media manager.
for (ContentNegotiator contentNegotiator : contentNegotiators) {
if (contentNegotiator.getNegotiatorState() == JingleNegotiatorState.SUCCEEDED)
jout.addContent(contentNegotiator.getJingleContent());
}
// Send the "accept" and wait for the ACK
addExpectedId(jout.getStanzaId());
sendStanza(jout);
}
}
}
@Override
public void transportClosed(TransportCandidate cand) {
}
@Override
public void transportClosedOnError(XMPPException e) {
}
};
addMediaListener(jingleMediaListener);
addTransportListener(jingleTransportListener);
} | [
"public",
"void",
"setupListeners",
"(",
")",
"{",
"JingleMediaListener",
"jingleMediaListener",
"=",
"new",
"JingleMediaListener",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"mediaClosed",
"(",
"PayloadType",
"cand",
")",
"{",
"}",
"@",
"Override",
"public",
"void",
"mediaEstablished",
"(",
"PayloadType",
"pt",
")",
"throws",
"NotConnectedException",
",",
"InterruptedException",
"{",
"if",
"(",
"isFullyEstablished",
"(",
")",
")",
"{",
"Jingle",
"jout",
"=",
"new",
"Jingle",
"(",
"JingleActionEnum",
".",
"SESSION_ACCEPT",
")",
";",
"// Build up a response packet from each media manager.",
"for",
"(",
"ContentNegotiator",
"contentNegotiator",
":",
"contentNegotiators",
")",
"{",
"if",
"(",
"contentNegotiator",
".",
"getNegotiatorState",
"(",
")",
"==",
"JingleNegotiatorState",
".",
"SUCCEEDED",
")",
"jout",
".",
"addContent",
"(",
"contentNegotiator",
".",
"getJingleContent",
"(",
")",
")",
";",
"}",
"// Send the \"accept\" and wait for the ACK",
"addExpectedId",
"(",
"jout",
".",
"getStanzaId",
"(",
")",
")",
";",
"sendStanza",
"(",
"jout",
")",
";",
"// triggerSessionEstablished();",
"}",
"}",
"}",
";",
"JingleTransportListener",
"jingleTransportListener",
"=",
"new",
"JingleTransportListener",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"transportEstablished",
"(",
"TransportCandidate",
"local",
",",
"TransportCandidate",
"remote",
")",
"throws",
"NotConnectedException",
",",
"InterruptedException",
"{",
"if",
"(",
"isFullyEstablished",
"(",
")",
")",
"{",
"// CHECKSTYLE:OFF",
"// Indicate that this session is active.",
"setSessionState",
"(",
"JingleSessionStateActive",
".",
"getInstance",
"(",
")",
")",
";",
"for",
"(",
"ContentNegotiator",
"contentNegotiator",
":",
"contentNegotiators",
")",
"{",
"// CHECKSTYLE:ON",
"if",
"(",
"contentNegotiator",
".",
"getNegotiatorState",
"(",
")",
"==",
"JingleNegotiatorState",
".",
"SUCCEEDED",
")",
"contentNegotiator",
".",
"triggerContentEstablished",
"(",
")",
";",
"}",
"if",
"(",
"getSessionState",
"(",
")",
".",
"equals",
"(",
"JingleSessionStatePending",
".",
"getInstance",
"(",
")",
")",
")",
"{",
"Jingle",
"jout",
"=",
"new",
"Jingle",
"(",
"JingleActionEnum",
".",
"SESSION_ACCEPT",
")",
";",
"// Build up a response packet from each media manager.",
"for",
"(",
"ContentNegotiator",
"contentNegotiator",
":",
"contentNegotiators",
")",
"{",
"if",
"(",
"contentNegotiator",
".",
"getNegotiatorState",
"(",
")",
"==",
"JingleNegotiatorState",
".",
"SUCCEEDED",
")",
"jout",
".",
"addContent",
"(",
"contentNegotiator",
".",
"getJingleContent",
"(",
")",
")",
";",
"}",
"// Send the \"accept\" and wait for the ACK",
"addExpectedId",
"(",
"jout",
".",
"getStanzaId",
"(",
")",
")",
";",
"sendStanza",
"(",
"jout",
")",
";",
"}",
"}",
"}",
"@",
"Override",
"public",
"void",
"transportClosed",
"(",
"TransportCandidate",
"cand",
")",
"{",
"}",
"@",
"Override",
"public",
"void",
"transportClosedOnError",
"(",
"XMPPException",
"e",
")",
"{",
"}",
"}",
";",
"addMediaListener",
"(",
"jingleMediaListener",
")",
";",
"addTransportListener",
"(",
"jingleTransportListener",
")",
";",
"}"
] | Setup the listeners that act on events coming from the lower level negotiators. | [
"Setup",
"the",
"listeners",
"that",
"act",
"on",
"events",
"coming",
"from",
"the",
"lower",
"level",
"negotiators",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSession.java#L811-L880 |
26,862 | igniterealtime/Smack | smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSession.java | JingleSession.triggerSessionClosed | protected void triggerSessionClosed(String reason) {
// for (ContentNegotiator contentNegotiator : contentNegotiators) {
//
// contentNegotiator.stopJingleMediaSession();
//
// for (TransportCandidate candidate : contentNegotiator.getTransportNegotiator().getOfferedCandidates())
// candidate.removeCandidateEcho();
// }
List<JingleListener> listeners = getListenersList();
for (JingleListener li : listeners) {
if (li instanceof JingleSessionListener) {
JingleSessionListener sli = (JingleSessionListener) li;
sli.sessionClosed(reason, this);
}
}
close();
} | java | protected void triggerSessionClosed(String reason) {
// for (ContentNegotiator contentNegotiator : contentNegotiators) {
//
// contentNegotiator.stopJingleMediaSession();
//
// for (TransportCandidate candidate : contentNegotiator.getTransportNegotiator().getOfferedCandidates())
// candidate.removeCandidateEcho();
// }
List<JingleListener> listeners = getListenersList();
for (JingleListener li : listeners) {
if (li instanceof JingleSessionListener) {
JingleSessionListener sli = (JingleSessionListener) li;
sli.sessionClosed(reason, this);
}
}
close();
} | [
"protected",
"void",
"triggerSessionClosed",
"(",
"String",
"reason",
")",
"{",
"// for (ContentNegotiator contentNegotiator : contentNegotiators) {",
"//",
"// contentNegotiator.stopJingleMediaSession();",
"//",
"// for (TransportCandidate candidate : contentNegotiator.getTransportNegotiator().getOfferedCandidates())",
"// candidate.removeCandidateEcho();",
"// }",
"List",
"<",
"JingleListener",
">",
"listeners",
"=",
"getListenersList",
"(",
")",
";",
"for",
"(",
"JingleListener",
"li",
":",
"listeners",
")",
"{",
"if",
"(",
"li",
"instanceof",
"JingleSessionListener",
")",
"{",
"JingleSessionListener",
"sli",
"=",
"(",
"JingleSessionListener",
")",
"li",
";",
"sli",
".",
"sessionClosed",
"(",
"reason",
",",
"this",
")",
";",
"}",
"}",
"close",
"(",
")",
";",
"}"
] | Trigger a session closed event. | [
"Trigger",
"a",
"session",
"closed",
"event",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSession.java#L887-L904 |
26,863 | igniterealtime/Smack | smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSession.java | JingleSession.triggerSessionClosedOnError | protected void triggerSessionClosedOnError(XMPPException exc) {
for (ContentNegotiator contentNegotiator : contentNegotiators) {
contentNegotiator.stopJingleMediaSession();
for (TransportCandidate candidate : contentNegotiator.getTransportNegotiator().getOfferedCandidates())
candidate.removeCandidateEcho();
}
List<JingleListener> listeners = getListenersList();
for (JingleListener li : listeners) {
if (li instanceof JingleSessionListener) {
JingleSessionListener sli = (JingleSessionListener) li;
sli.sessionClosedOnError(exc, this);
}
}
close();
} | java | protected void triggerSessionClosedOnError(XMPPException exc) {
for (ContentNegotiator contentNegotiator : contentNegotiators) {
contentNegotiator.stopJingleMediaSession();
for (TransportCandidate candidate : contentNegotiator.getTransportNegotiator().getOfferedCandidates())
candidate.removeCandidateEcho();
}
List<JingleListener> listeners = getListenersList();
for (JingleListener li : listeners) {
if (li instanceof JingleSessionListener) {
JingleSessionListener sli = (JingleSessionListener) li;
sli.sessionClosedOnError(exc, this);
}
}
close();
} | [
"protected",
"void",
"triggerSessionClosedOnError",
"(",
"XMPPException",
"exc",
")",
"{",
"for",
"(",
"ContentNegotiator",
"contentNegotiator",
":",
"contentNegotiators",
")",
"{",
"contentNegotiator",
".",
"stopJingleMediaSession",
"(",
")",
";",
"for",
"(",
"TransportCandidate",
"candidate",
":",
"contentNegotiator",
".",
"getTransportNegotiator",
"(",
")",
".",
"getOfferedCandidates",
"(",
")",
")",
"candidate",
".",
"removeCandidateEcho",
"(",
")",
";",
"}",
"List",
"<",
"JingleListener",
">",
"listeners",
"=",
"getListenersList",
"(",
")",
";",
"for",
"(",
"JingleListener",
"li",
":",
"listeners",
")",
"{",
"if",
"(",
"li",
"instanceof",
"JingleSessionListener",
")",
"{",
"JingleSessionListener",
"sli",
"=",
"(",
"JingleSessionListener",
")",
"li",
";",
"sli",
".",
"sessionClosedOnError",
"(",
"exc",
",",
"this",
")",
";",
"}",
"}",
"close",
"(",
")",
";",
"}"
] | Trigger a session closed event due to an error. | [
"Trigger",
"a",
"session",
"closed",
"event",
"due",
"to",
"an",
"error",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSession.java#L909-L925 |
26,864 | igniterealtime/Smack | smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSession.java | JingleSession.triggerMediaReceived | protected void triggerMediaReceived(String participant) {
List<JingleListener> listeners = getListenersList();
for (JingleListener li : listeners) {
if (li instanceof JingleSessionListener) {
JingleSessionListener sli = (JingleSessionListener) li;
sli.sessionMediaReceived(this, participant);
}
}
} | java | protected void triggerMediaReceived(String participant) {
List<JingleListener> listeners = getListenersList();
for (JingleListener li : listeners) {
if (li instanceof JingleSessionListener) {
JingleSessionListener sli = (JingleSessionListener) li;
sli.sessionMediaReceived(this, participant);
}
}
} | [
"protected",
"void",
"triggerMediaReceived",
"(",
"String",
"participant",
")",
"{",
"List",
"<",
"JingleListener",
">",
"listeners",
"=",
"getListenersList",
"(",
")",
";",
"for",
"(",
"JingleListener",
"li",
":",
"listeners",
")",
"{",
"if",
"(",
"li",
"instanceof",
"JingleSessionListener",
")",
"{",
"JingleSessionListener",
"sli",
"=",
"(",
"JingleSessionListener",
")",
"li",
";",
"sli",
".",
"sessionMediaReceived",
"(",
"this",
",",
"participant",
")",
";",
"}",
"}",
"}"
] | Trigger a media received event. | [
"Trigger",
"a",
"media",
"received",
"event",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSession.java#L942-L950 |
26,865 | igniterealtime/Smack | smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSession.java | JingleSession.terminate | public void terminate(String reason) throws XMPPException, NotConnectedException, InterruptedException {
if (isClosed())
return;
LOGGER.fine("Terminate " + reason);
Jingle jout = new Jingle(JingleActionEnum.SESSION_TERMINATE);
jout.setType(IQ.Type.set);
sendStanza(jout);
triggerSessionClosed(reason);
} | java | public void terminate(String reason) throws XMPPException, NotConnectedException, InterruptedException {
if (isClosed())
return;
LOGGER.fine("Terminate " + reason);
Jingle jout = new Jingle(JingleActionEnum.SESSION_TERMINATE);
jout.setType(IQ.Type.set);
sendStanza(jout);
triggerSessionClosed(reason);
} | [
"public",
"void",
"terminate",
"(",
"String",
"reason",
")",
"throws",
"XMPPException",
",",
"NotConnectedException",
",",
"InterruptedException",
"{",
"if",
"(",
"isClosed",
"(",
")",
")",
"return",
";",
"LOGGER",
".",
"fine",
"(",
"\"Terminate \"",
"+",
"reason",
")",
";",
"Jingle",
"jout",
"=",
"new",
"Jingle",
"(",
"JingleActionEnum",
".",
"SESSION_TERMINATE",
")",
";",
"jout",
".",
"setType",
"(",
"IQ",
".",
"Type",
".",
"set",
")",
";",
"sendStanza",
"(",
"jout",
")",
";",
"triggerSessionClosed",
"(",
"reason",
")",
";",
"}"
] | Terminates the session with a custom reason.
@throws XMPPException
@throws NotConnectedException
@throws InterruptedException | [
"Terminates",
"the",
"session",
"with",
"a",
"custom",
"reason",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSession.java#L998-L1006 |
26,866 | igniterealtime/Smack | smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSession.java | JingleSession.close | @Override
public void close() {
if (isClosed())
return;
// Set the session state to ENDED.
setSessionState(JingleSessionStateEnded.getInstance());
for (ContentNegotiator contentNegotiator : contentNegotiators) {
contentNegotiator.stopJingleMediaSession();
for (TransportCandidate candidate : contentNegotiator.getTransportNegotiator().getOfferedCandidates())
candidate.removeCandidateEcho();
contentNegotiator.close();
}
removeAsyncPacketListener();
removeConnectionListener();
getConnection().removeConnectionListener(connectionListener);
LOGGER.fine("Negotiation Closed: " + getConnection().getUser() + " " + sid);
super.close();
} | java | @Override
public void close() {
if (isClosed())
return;
// Set the session state to ENDED.
setSessionState(JingleSessionStateEnded.getInstance());
for (ContentNegotiator contentNegotiator : contentNegotiators) {
contentNegotiator.stopJingleMediaSession();
for (TransportCandidate candidate : contentNegotiator.getTransportNegotiator().getOfferedCandidates())
candidate.removeCandidateEcho();
contentNegotiator.close();
}
removeAsyncPacketListener();
removeConnectionListener();
getConnection().removeConnectionListener(connectionListener);
LOGGER.fine("Negotiation Closed: " + getConnection().getUser() + " " + sid);
super.close();
} | [
"@",
"Override",
"public",
"void",
"close",
"(",
")",
"{",
"if",
"(",
"isClosed",
"(",
")",
")",
"return",
";",
"// Set the session state to ENDED.",
"setSessionState",
"(",
"JingleSessionStateEnded",
".",
"getInstance",
"(",
")",
")",
";",
"for",
"(",
"ContentNegotiator",
"contentNegotiator",
":",
"contentNegotiators",
")",
"{",
"contentNegotiator",
".",
"stopJingleMediaSession",
"(",
")",
";",
"for",
"(",
"TransportCandidate",
"candidate",
":",
"contentNegotiator",
".",
"getTransportNegotiator",
"(",
")",
".",
"getOfferedCandidates",
"(",
")",
")",
"candidate",
".",
"removeCandidateEcho",
"(",
")",
";",
"contentNegotiator",
".",
"close",
"(",
")",
";",
"}",
"removeAsyncPacketListener",
"(",
")",
";",
"removeConnectionListener",
"(",
")",
";",
"getConnection",
"(",
")",
".",
"removeConnectionListener",
"(",
"connectionListener",
")",
";",
"LOGGER",
".",
"fine",
"(",
"\"Negotiation Closed: \"",
"+",
"getConnection",
"(",
")",
".",
"getUser",
"(",
")",
"+",
"\" \"",
"+",
"sid",
")",
";",
"super",
".",
"close",
"(",
")",
";",
"}"
] | Terminate negotiations. | [
"Terminate",
"negotiations",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSession.java#L1011-L1034 |
26,867 | igniterealtime/Smack | smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSession.java | JingleSession.createJingleError | public IQ createJingleError(IQ iq, JingleError jingleError) {
IQ errorPacket = null;
if (jingleError != null) {
// TODO This is wrong according to XEP-166 § 10, but this jingle implementation is deprecated anyways
StanzaError.Builder builder = StanzaError.getBuilder(StanzaError.Condition.undefined_condition);
builder.addExtension(jingleError);
errorPacket = IQ.createErrorResponse(iq, builder);
// errorPacket.addExtension(jingleError);
// NO! Let the normal state machinery do all of the sending.
// getConnection().sendStanza(perror);
LOGGER.severe("Error sent: " + errorPacket.toXML());
}
return errorPacket;
} | java | public IQ createJingleError(IQ iq, JingleError jingleError) {
IQ errorPacket = null;
if (jingleError != null) {
// TODO This is wrong according to XEP-166 § 10, but this jingle implementation is deprecated anyways
StanzaError.Builder builder = StanzaError.getBuilder(StanzaError.Condition.undefined_condition);
builder.addExtension(jingleError);
errorPacket = IQ.createErrorResponse(iq, builder);
// errorPacket.addExtension(jingleError);
// NO! Let the normal state machinery do all of the sending.
// getConnection().sendStanza(perror);
LOGGER.severe("Error sent: " + errorPacket.toXML());
}
return errorPacket;
} | [
"public",
"IQ",
"createJingleError",
"(",
"IQ",
"iq",
",",
"JingleError",
"jingleError",
")",
"{",
"IQ",
"errorPacket",
"=",
"null",
";",
"if",
"(",
"jingleError",
"!=",
"null",
")",
"{",
"// TODO This is wrong according to XEP-166 § 10, but this jingle implementation is deprecated anyways",
"StanzaError",
".",
"Builder",
"builder",
"=",
"StanzaError",
".",
"getBuilder",
"(",
"StanzaError",
".",
"Condition",
".",
"undefined_condition",
")",
";",
"builder",
".",
"addExtension",
"(",
"jingleError",
")",
";",
"errorPacket",
"=",
"IQ",
".",
"createErrorResponse",
"(",
"iq",
",",
"builder",
")",
";",
"// errorPacket.addExtension(jingleError);",
"// NO! Let the normal state machinery do all of the sending.",
"// getConnection().sendStanza(perror);",
"LOGGER",
".",
"severe",
"(",
"\"Error sent: \"",
"+",
"errorPacket",
".",
"toXML",
"(",
")",
")",
";",
"}",
"return",
"errorPacket",
";",
"}"
] | Complete and send an error. Complete all the null fields in an IQ error
response, using the session information we have or some info from the
incoming packet.
@param iq
The Jingle stanza we are responding to
@param jingleError
the IQ stanza we want to complete and send | [
"Complete",
"and",
"send",
"an",
"error",
".",
"Complete",
"all",
"the",
"null",
"fields",
"in",
"an",
"IQ",
"error",
"response",
"using",
"the",
"session",
"information",
"we",
"have",
"or",
"some",
"info",
"from",
"the",
"incoming",
"packet",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSession.java#L1052-L1068 |
26,868 | igniterealtime/Smack | smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSession.java | JingleSession.startOutgoing | public void startOutgoing() throws IllegalStateException, SmackException, InterruptedException {
updatePacketListener();
setSessionState(JingleSessionStatePending.getInstance());
Jingle jingle = new Jingle(JingleActionEnum.SESSION_INITIATE);
// Create a content negotiator for each media manager on the session.
for (JingleMediaManager mediaManager : getMediaManagers()) {
ContentNegotiator contentNeg = new ContentNegotiator(this, ContentNegotiator.INITIATOR, mediaManager.getName());
// Create the media negotiator for this content description.
contentNeg.setMediaNegotiator(new MediaNegotiator(this, mediaManager, mediaManager.getPayloads(), contentNeg));
JingleTransportManager transportManager = mediaManager.getTransportManager();
TransportResolver resolver = null;
try {
resolver = transportManager.getResolver(this);
} catch (XMPPException e) {
LOGGER.log(Level.WARNING, "exception", e);
}
if (resolver.getType().equals(TransportResolver.Type.rawupd)) {
contentNeg.setTransportNegotiator(new TransportNegotiator.RawUdp(this, resolver, contentNeg));
}
if (resolver.getType().equals(TransportResolver.Type.ice)) {
contentNeg.setTransportNegotiator(new TransportNegotiator.Ice(this, resolver, contentNeg));
}
addContentNegotiator(contentNeg);
}
// Give each of the content negotiators a chance to return a portion of the structure to make the Jingle packet.
for (ContentNegotiator contentNegotiator : contentNegotiators) {
jingle.addContent(contentNegotiator.getJingleContent());
}
// Save the session-initiate packet ID, so that we can respond to it.
sessionInitPacketID = jingle.getStanzaId();
sendStanza(jingle);
// Now setup to track the media negotiators, so that we know when (if) to send a session-accept.
setupListeners();
// Give each of the content negotiators a chance to start
// and return a portion of the structure to make the Jingle packet.
// Don't do this anymore. The problem is that the other side might not be ready.
// Later when we receive our first jingle packet from the other side we'll fire-up the negotiators
// before processing it. (See receivePacketAndRespond() above.
// for (ContentNegotiator contentNegotiator : contentNegotiators) {
// contentNegotiator.start();
// }
} | java | public void startOutgoing() throws IllegalStateException, SmackException, InterruptedException {
updatePacketListener();
setSessionState(JingleSessionStatePending.getInstance());
Jingle jingle = new Jingle(JingleActionEnum.SESSION_INITIATE);
// Create a content negotiator for each media manager on the session.
for (JingleMediaManager mediaManager : getMediaManagers()) {
ContentNegotiator contentNeg = new ContentNegotiator(this, ContentNegotiator.INITIATOR, mediaManager.getName());
// Create the media negotiator for this content description.
contentNeg.setMediaNegotiator(new MediaNegotiator(this, mediaManager, mediaManager.getPayloads(), contentNeg));
JingleTransportManager transportManager = mediaManager.getTransportManager();
TransportResolver resolver = null;
try {
resolver = transportManager.getResolver(this);
} catch (XMPPException e) {
LOGGER.log(Level.WARNING, "exception", e);
}
if (resolver.getType().equals(TransportResolver.Type.rawupd)) {
contentNeg.setTransportNegotiator(new TransportNegotiator.RawUdp(this, resolver, contentNeg));
}
if (resolver.getType().equals(TransportResolver.Type.ice)) {
contentNeg.setTransportNegotiator(new TransportNegotiator.Ice(this, resolver, contentNeg));
}
addContentNegotiator(contentNeg);
}
// Give each of the content negotiators a chance to return a portion of the structure to make the Jingle packet.
for (ContentNegotiator contentNegotiator : contentNegotiators) {
jingle.addContent(contentNegotiator.getJingleContent());
}
// Save the session-initiate packet ID, so that we can respond to it.
sessionInitPacketID = jingle.getStanzaId();
sendStanza(jingle);
// Now setup to track the media negotiators, so that we know when (if) to send a session-accept.
setupListeners();
// Give each of the content negotiators a chance to start
// and return a portion of the structure to make the Jingle packet.
// Don't do this anymore. The problem is that the other side might not be ready.
// Later when we receive our first jingle packet from the other side we'll fire-up the negotiators
// before processing it. (See receivePacketAndRespond() above.
// for (ContentNegotiator contentNegotiator : contentNegotiators) {
// contentNegotiator.start();
// }
} | [
"public",
"void",
"startOutgoing",
"(",
")",
"throws",
"IllegalStateException",
",",
"SmackException",
",",
"InterruptedException",
"{",
"updatePacketListener",
"(",
")",
";",
"setSessionState",
"(",
"JingleSessionStatePending",
".",
"getInstance",
"(",
")",
")",
";",
"Jingle",
"jingle",
"=",
"new",
"Jingle",
"(",
"JingleActionEnum",
".",
"SESSION_INITIATE",
")",
";",
"// Create a content negotiator for each media manager on the session.",
"for",
"(",
"JingleMediaManager",
"mediaManager",
":",
"getMediaManagers",
"(",
")",
")",
"{",
"ContentNegotiator",
"contentNeg",
"=",
"new",
"ContentNegotiator",
"(",
"this",
",",
"ContentNegotiator",
".",
"INITIATOR",
",",
"mediaManager",
".",
"getName",
"(",
")",
")",
";",
"// Create the media negotiator for this content description.",
"contentNeg",
".",
"setMediaNegotiator",
"(",
"new",
"MediaNegotiator",
"(",
"this",
",",
"mediaManager",
",",
"mediaManager",
".",
"getPayloads",
"(",
")",
",",
"contentNeg",
")",
")",
";",
"JingleTransportManager",
"transportManager",
"=",
"mediaManager",
".",
"getTransportManager",
"(",
")",
";",
"TransportResolver",
"resolver",
"=",
"null",
";",
"try",
"{",
"resolver",
"=",
"transportManager",
".",
"getResolver",
"(",
"this",
")",
";",
"}",
"catch",
"(",
"XMPPException",
"e",
")",
"{",
"LOGGER",
".",
"log",
"(",
"Level",
".",
"WARNING",
",",
"\"exception\"",
",",
"e",
")",
";",
"}",
"if",
"(",
"resolver",
".",
"getType",
"(",
")",
".",
"equals",
"(",
"TransportResolver",
".",
"Type",
".",
"rawupd",
")",
")",
"{",
"contentNeg",
".",
"setTransportNegotiator",
"(",
"new",
"TransportNegotiator",
".",
"RawUdp",
"(",
"this",
",",
"resolver",
",",
"contentNeg",
")",
")",
";",
"}",
"if",
"(",
"resolver",
".",
"getType",
"(",
")",
".",
"equals",
"(",
"TransportResolver",
".",
"Type",
".",
"ice",
")",
")",
"{",
"contentNeg",
".",
"setTransportNegotiator",
"(",
"new",
"TransportNegotiator",
".",
"Ice",
"(",
"this",
",",
"resolver",
",",
"contentNeg",
")",
")",
";",
"}",
"addContentNegotiator",
"(",
"contentNeg",
")",
";",
"}",
"// Give each of the content negotiators a chance to return a portion of the structure to make the Jingle packet.",
"for",
"(",
"ContentNegotiator",
"contentNegotiator",
":",
"contentNegotiators",
")",
"{",
"jingle",
".",
"addContent",
"(",
"contentNegotiator",
".",
"getJingleContent",
"(",
")",
")",
";",
"}",
"// Save the session-initiate packet ID, so that we can respond to it.",
"sessionInitPacketID",
"=",
"jingle",
".",
"getStanzaId",
"(",
")",
";",
"sendStanza",
"(",
"jingle",
")",
";",
"// Now setup to track the media negotiators, so that we know when (if) to send a session-accept.",
"setupListeners",
"(",
")",
";",
"// Give each of the content negotiators a chance to start",
"// and return a portion of the structure to make the Jingle packet.",
"// Don't do this anymore. The problem is that the other side might not be ready.",
"// Later when we receive our first jingle packet from the other side we'll fire-up the negotiators",
"// before processing it. (See receivePacketAndRespond() above.",
"// for (ContentNegotiator contentNegotiator : contentNegotiators) {",
"// contentNegotiator.start();",
"// }",
"}"
] | This is the starting point for intitiating a new session.
@throws IllegalStateException
@throws SmackException
@throws InterruptedException | [
"This",
"is",
"the",
"starting",
"point",
"for",
"intitiating",
"a",
"new",
"session",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSession.java#L1085-L1139 |
26,869 | igniterealtime/Smack | smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSession.java | JingleSession.startNegotiators | private void startNegotiators() {
for (ContentNegotiator contentNegotiator : contentNegotiators) {
TransportNegotiator transNeg = contentNegotiator.getTransportNegotiator();
transNeg.start();
}
} | java | private void startNegotiators() {
for (ContentNegotiator contentNegotiator : contentNegotiators) {
TransportNegotiator transNeg = contentNegotiator.getTransportNegotiator();
transNeg.start();
}
} | [
"private",
"void",
"startNegotiators",
"(",
")",
"{",
"for",
"(",
"ContentNegotiator",
"contentNegotiator",
":",
"contentNegotiators",
")",
"{",
"TransportNegotiator",
"transNeg",
"=",
"contentNegotiator",
".",
"getTransportNegotiator",
"(",
")",
";",
"transNeg",
".",
"start",
"(",
")",
";",
"}",
"}"
] | When we initiate a session we need to start a bunch of negotiators right after we receive the result
stanza for our session-initiate. This is where we start them. | [
"When",
"we",
"initiate",
"a",
"session",
"we",
"need",
"to",
"start",
"a",
"bunch",
"of",
"negotiators",
"right",
"after",
"we",
"receive",
"the",
"result",
"stanza",
"for",
"our",
"session",
"-",
"initiate",
".",
"This",
"is",
"where",
"we",
"start",
"them",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSession.java#L1159-L1165 |
26,870 | igniterealtime/Smack | smack-core/src/main/java/org/jivesoftware/smack/packet/Presence.java | Presence.cloneWithNewId | public Presence cloneWithNewId() {
Presence clone = clone();
clone.setStanzaId(StanzaIdUtil.newStanzaId());
return clone;
} | java | public Presence cloneWithNewId() {
Presence clone = clone();
clone.setStanzaId(StanzaIdUtil.newStanzaId());
return clone;
} | [
"public",
"Presence",
"cloneWithNewId",
"(",
")",
"{",
"Presence",
"clone",
"=",
"clone",
"(",
")",
";",
"clone",
".",
"setStanzaId",
"(",
"StanzaIdUtil",
".",
"newStanzaId",
"(",
")",
")",
";",
"return",
"clone",
";",
"}"
] | Clone this presence and set a newly generated stanza ID as the clone's ID.
@return a "clone" of this presence with a different stanza ID.
@since 4.1.2 | [
"Clone",
"this",
"presence",
"and",
"set",
"a",
"newly",
"generated",
"stanza",
"ID",
"as",
"the",
"clone",
"s",
"ID",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-core/src/main/java/org/jivesoftware/smack/packet/Presence.java#L321-L325 |
26,871 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/OutgoingFileTransfer.java | OutgoingFileTransfer.sendFile | public synchronized OutputStream sendFile(String fileName, long fileSize,
String description) throws XMPPException, SmackException, InterruptedException {
if (isDone() || outputStream != null) {
throw new IllegalStateException(
"The negotiation process has already"
+ " been attempted on this file transfer");
}
try {
setFileInfo(fileName, fileSize);
this.outputStream = negotiateStream(fileName, fileSize, description);
} catch (XMPPErrorException e) {
handleXMPPException(e);
throw e;
}
return outputStream;
} | java | public synchronized OutputStream sendFile(String fileName, long fileSize,
String description) throws XMPPException, SmackException, InterruptedException {
if (isDone() || outputStream != null) {
throw new IllegalStateException(
"The negotiation process has already"
+ " been attempted on this file transfer");
}
try {
setFileInfo(fileName, fileSize);
this.outputStream = negotiateStream(fileName, fileSize, description);
} catch (XMPPErrorException e) {
handleXMPPException(e);
throw e;
}
return outputStream;
} | [
"public",
"synchronized",
"OutputStream",
"sendFile",
"(",
"String",
"fileName",
",",
"long",
"fileSize",
",",
"String",
"description",
")",
"throws",
"XMPPException",
",",
"SmackException",
",",
"InterruptedException",
"{",
"if",
"(",
"isDone",
"(",
")",
"||",
"outputStream",
"!=",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"The negotiation process has already\"",
"+",
"\" been attempted on this file transfer\"",
")",
";",
"}",
"try",
"{",
"setFileInfo",
"(",
"fileName",
",",
"fileSize",
")",
";",
"this",
".",
"outputStream",
"=",
"negotiateStream",
"(",
"fileName",
",",
"fileSize",
",",
"description",
")",
";",
"}",
"catch",
"(",
"XMPPErrorException",
"e",
")",
"{",
"handleXMPPException",
"(",
"e",
")",
";",
"throw",
"e",
";",
"}",
"return",
"outputStream",
";",
"}"
] | This method handles the negotiation of the file transfer and the stream,
it only returns the created stream after the negotiation has been completed.
@param fileName
The name of the file that will be transmitted. It is
preferable for this name to have an extension as it will be
used to determine the type of file it is.
@param fileSize
The size in bytes of the file that will be transmitted.
@param description
A description of the file that will be transmitted.
@return The OutputStream that is connected to the peer to transmit the
file.
@throws XMPPException
Thrown if an error occurs during the file transfer
negotiation process.
@throws SmackException if there was no response from the server.
@throws InterruptedException | [
"This",
"method",
"handles",
"the",
"negotiation",
"of",
"the",
"file",
"transfer",
"and",
"the",
"stream",
"it",
"only",
"returns",
"the",
"created",
"stream",
"after",
"the",
"negotiation",
"has",
"been",
"completed",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/OutgoingFileTransfer.java#L127-L142 |
26,872 | igniterealtime/Smack | smack-core/src/main/java/org/jivesoftware/smack/SASLAuthentication.java | SASLAuthentication.registerSASLMechanism | public static void registerSASLMechanism(SASLMechanism mechanism) {
synchronized (REGISTERED_MECHANISMS) {
REGISTERED_MECHANISMS.add(mechanism);
Collections.sort(REGISTERED_MECHANISMS);
}
} | java | public static void registerSASLMechanism(SASLMechanism mechanism) {
synchronized (REGISTERED_MECHANISMS) {
REGISTERED_MECHANISMS.add(mechanism);
Collections.sort(REGISTERED_MECHANISMS);
}
} | [
"public",
"static",
"void",
"registerSASLMechanism",
"(",
"SASLMechanism",
"mechanism",
")",
"{",
"synchronized",
"(",
"REGISTERED_MECHANISMS",
")",
"{",
"REGISTERED_MECHANISMS",
".",
"add",
"(",
"mechanism",
")",
";",
"Collections",
".",
"sort",
"(",
"REGISTERED_MECHANISMS",
")",
";",
"}",
"}"
] | Registers a new SASL mechanism.
@param mechanism a SASLMechanism subclass. | [
"Registers",
"a",
"new",
"SASL",
"mechanism",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-core/src/main/java/org/jivesoftware/smack/SASLAuthentication.java#L83-L88 |
26,873 | igniterealtime/Smack | smack-core/src/main/java/org/jivesoftware/smack/SASLAuthentication.java | SASLAuthentication.getRegisterdSASLMechanisms | public static Map<String, String> getRegisterdSASLMechanisms() {
Map<String, String> answer = new LinkedHashMap<>();
synchronized (REGISTERED_MECHANISMS) {
for (SASLMechanism mechanism : REGISTERED_MECHANISMS) {
answer.put(mechanism.getClass().getName(), mechanism.toString());
}
}
return answer;
} | java | public static Map<String, String> getRegisterdSASLMechanisms() {
Map<String, String> answer = new LinkedHashMap<>();
synchronized (REGISTERED_MECHANISMS) {
for (SASLMechanism mechanism : REGISTERED_MECHANISMS) {
answer.put(mechanism.getClass().getName(), mechanism.toString());
}
}
return answer;
} | [
"public",
"static",
"Map",
"<",
"String",
",",
"String",
">",
"getRegisterdSASLMechanisms",
"(",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"answer",
"=",
"new",
"LinkedHashMap",
"<>",
"(",
")",
";",
"synchronized",
"(",
"REGISTERED_MECHANISMS",
")",
"{",
"for",
"(",
"SASLMechanism",
"mechanism",
":",
"REGISTERED_MECHANISMS",
")",
"{",
"answer",
".",
"put",
"(",
"mechanism",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
",",
"mechanism",
".",
"toString",
"(",
")",
")",
";",
"}",
"}",
"return",
"answer",
";",
"}"
] | Returns the registered SASLMechanism sorted by the level of preference.
@return the registered SASLMechanism sorted by the level of preference. | [
"Returns",
"the",
"registered",
"SASLMechanism",
"sorted",
"by",
"the",
"level",
"of",
"preference",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-core/src/main/java/org/jivesoftware/smack/SASLAuthentication.java#L95-L103 |
26,874 | igniterealtime/Smack | smack-core/src/main/java/org/jivesoftware/smack/SASLAuthentication.java | SASLAuthentication.unregisterSASLMechanism | public static boolean unregisterSASLMechanism(String clazz) {
synchronized (REGISTERED_MECHANISMS) {
Iterator<SASLMechanism> it = REGISTERED_MECHANISMS.iterator();
while (it.hasNext()) {
SASLMechanism mechanism = it.next();
if (mechanism.getClass().getName().equals(clazz)) {
it.remove();
return true;
}
}
}
return false;
} | java | public static boolean unregisterSASLMechanism(String clazz) {
synchronized (REGISTERED_MECHANISMS) {
Iterator<SASLMechanism> it = REGISTERED_MECHANISMS.iterator();
while (it.hasNext()) {
SASLMechanism mechanism = it.next();
if (mechanism.getClass().getName().equals(clazz)) {
it.remove();
return true;
}
}
}
return false;
} | [
"public",
"static",
"boolean",
"unregisterSASLMechanism",
"(",
"String",
"clazz",
")",
"{",
"synchronized",
"(",
"REGISTERED_MECHANISMS",
")",
"{",
"Iterator",
"<",
"SASLMechanism",
">",
"it",
"=",
"REGISTERED_MECHANISMS",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"it",
".",
"hasNext",
"(",
")",
")",
"{",
"SASLMechanism",
"mechanism",
"=",
"it",
".",
"next",
"(",
")",
";",
"if",
"(",
"mechanism",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"clazz",
")",
")",
"{",
"it",
".",
"remove",
"(",
")",
";",
"return",
"true",
";",
"}",
"}",
"}",
"return",
"false",
";",
"}"
] | Unregister a SASLMechanism by it's full class name. For example
"org.jivesoftware.smack.sasl.javax.SASLCramMD5Mechanism".
@param clazz the SASLMechanism class's name
@return true if the given SASLMechanism was removed, false otherwise | [
"Unregister",
"a",
"SASLMechanism",
"by",
"it",
"s",
"full",
"class",
"name",
".",
"For",
"example",
"org",
".",
"jivesoftware",
".",
"smack",
".",
"sasl",
".",
"javax",
".",
"SASLCramMD5Mechanism",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-core/src/main/java/org/jivesoftware/smack/SASLAuthentication.java#L123-L135 |
26,875 | igniterealtime/Smack | smack-core/src/main/java/org/jivesoftware/smack/SASLAuthentication.java | SASLAuthentication.challengeReceived | public void challengeReceived(String challenge, boolean finalChallenge) throws SmackSaslException, NotConnectedException, InterruptedException {
try {
currentMechanism.challengeReceived(challenge, finalChallenge);
} catch (InterruptedException | SmackSaslException | NotConnectedException e) {
authenticationFailed(e);
throw e;
}
} | java | public void challengeReceived(String challenge, boolean finalChallenge) throws SmackSaslException, NotConnectedException, InterruptedException {
try {
currentMechanism.challengeReceived(challenge, finalChallenge);
} catch (InterruptedException | SmackSaslException | NotConnectedException e) {
authenticationFailed(e);
throw e;
}
} | [
"public",
"void",
"challengeReceived",
"(",
"String",
"challenge",
",",
"boolean",
"finalChallenge",
")",
"throws",
"SmackSaslException",
",",
"NotConnectedException",
",",
"InterruptedException",
"{",
"try",
"{",
"currentMechanism",
".",
"challengeReceived",
"(",
"challenge",
",",
"finalChallenge",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"|",
"SmackSaslException",
"|",
"NotConnectedException",
"e",
")",
"{",
"authenticationFailed",
"(",
"e",
")",
";",
"throw",
"e",
";",
"}",
"}"
] | The server is challenging the SASL authentication we just sent. Forward the challenge
to the current SASLMechanism we are using. The SASLMechanism will eventually send a response to
the server. The length of the challenge-response sequence varies according to the
SASLMechanism in use.
@param challenge a base64 encoded string representing the challenge.
@param finalChallenge true if this is the last challenge send by the server within the success stanza
@throws SmackSaslException
@throws NotConnectedException
@throws InterruptedException | [
"The",
"server",
"is",
"challenging",
"the",
"SASL",
"authentication",
"we",
"just",
"sent",
".",
"Forward",
"the",
"challenge",
"to",
"the",
"current",
"SASLMechanism",
"we",
"are",
"using",
".",
"The",
"SASLMechanism",
"will",
"eventually",
"send",
"a",
"response",
"to",
"the",
"server",
".",
"The",
"length",
"of",
"the",
"challenge",
"-",
"response",
"sequence",
"varies",
"according",
"to",
"the",
"SASLMechanism",
"in",
"use",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-core/src/main/java/org/jivesoftware/smack/SASLAuthentication.java#L261-L268 |
26,876 | igniterealtime/Smack | smack-core/src/main/java/org/jivesoftware/smack/SASLAuthentication.java | SASLAuthentication.authenticated | public void authenticated(Success success) throws SmackException, InterruptedException {
// RFC6120 6.3.10 "At the end of the authentication exchange, the SASL server (the XMPP
// "receiving entity") can include "additional data with success" if appropriate for the
// SASL mechanism in use. In XMPP, this is done by including the additional data as the XML
// character data of the <success/> element." The used SASL mechanism should be able to
// verify the data send by the server in the success stanza, if any.
if (success.getData() != null) {
challengeReceived(success.getData(), true);
}
currentMechanism.checkIfSuccessfulOrThrow();
authenticationSuccessful = true;
// Wake up the thread that is waiting in the #authenticate method
synchronized (this) {
notify();
}
} | java | public void authenticated(Success success) throws SmackException, InterruptedException {
// RFC6120 6.3.10 "At the end of the authentication exchange, the SASL server (the XMPP
// "receiving entity") can include "additional data with success" if appropriate for the
// SASL mechanism in use. In XMPP, this is done by including the additional data as the XML
// character data of the <success/> element." The used SASL mechanism should be able to
// verify the data send by the server in the success stanza, if any.
if (success.getData() != null) {
challengeReceived(success.getData(), true);
}
currentMechanism.checkIfSuccessfulOrThrow();
authenticationSuccessful = true;
// Wake up the thread that is waiting in the #authenticate method
synchronized (this) {
notify();
}
} | [
"public",
"void",
"authenticated",
"(",
"Success",
"success",
")",
"throws",
"SmackException",
",",
"InterruptedException",
"{",
"// RFC6120 6.3.10 \"At the end of the authentication exchange, the SASL server (the XMPP",
"// \"receiving entity\") can include \"additional data with success\" if appropriate for the",
"// SASL mechanism in use. In XMPP, this is done by including the additional data as the XML",
"// character data of the <success/> element.\" The used SASL mechanism should be able to",
"// verify the data send by the server in the success stanza, if any.",
"if",
"(",
"success",
".",
"getData",
"(",
")",
"!=",
"null",
")",
"{",
"challengeReceived",
"(",
"success",
".",
"getData",
"(",
")",
",",
"true",
")",
";",
"}",
"currentMechanism",
".",
"checkIfSuccessfulOrThrow",
"(",
")",
";",
"authenticationSuccessful",
"=",
"true",
";",
"// Wake up the thread that is waiting in the #authenticate method",
"synchronized",
"(",
"this",
")",
"{",
"notify",
"(",
")",
";",
"}",
"}"
] | Notification message saying that SASL authentication was successful. The next step
would be to bind the resource.
@param success result of the authentication.
@throws SmackException
@throws InterruptedException | [
"Notification",
"message",
"saying",
"that",
"SASL",
"authentication",
"was",
"successful",
".",
"The",
"next",
"step",
"would",
"be",
"to",
"bind",
"the",
"resource",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-core/src/main/java/org/jivesoftware/smack/SASLAuthentication.java#L277-L292 |
26,877 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/address/packet/MultipleAddresses.java | MultipleAddresses.addAddress | public void addAddress(Type type, Jid jid, String node, String desc, boolean delivered,
String uri) {
// Create a new address with the specified configuration
Address address = new Address(type);
address.setJid(jid);
address.setNode(node);
address.setDescription(desc);
address.setDelivered(delivered);
address.setUri(uri);
// Add the new address to the list of multiple recipients
addresses.add(address);
} | java | public void addAddress(Type type, Jid jid, String node, String desc, boolean delivered,
String uri) {
// Create a new address with the specified configuration
Address address = new Address(type);
address.setJid(jid);
address.setNode(node);
address.setDescription(desc);
address.setDelivered(delivered);
address.setUri(uri);
// Add the new address to the list of multiple recipients
addresses.add(address);
} | [
"public",
"void",
"addAddress",
"(",
"Type",
"type",
",",
"Jid",
"jid",
",",
"String",
"node",
",",
"String",
"desc",
",",
"boolean",
"delivered",
",",
"String",
"uri",
")",
"{",
"// Create a new address with the specified configuration",
"Address",
"address",
"=",
"new",
"Address",
"(",
"type",
")",
";",
"address",
".",
"setJid",
"(",
"jid",
")",
";",
"address",
".",
"setNode",
"(",
"node",
")",
";",
"address",
".",
"setDescription",
"(",
"desc",
")",
";",
"address",
".",
"setDelivered",
"(",
"delivered",
")",
";",
"address",
".",
"setUri",
"(",
"uri",
")",
";",
"// Add the new address to the list of multiple recipients",
"addresses",
".",
"add",
"(",
"address",
")",
";",
"}"
] | Adds a new address to which the stanza is going to be sent or was sent.
@param type on of the static type (BCC, CC, NO_REPLY, REPLY_ROOM, etc.)
@param jid the JID address of the recipient.
@param node used to specify a sub-addressable unit at a particular JID, corresponding to
a Service Discovery node.
@param desc used to specify human-readable information for this address.
@param delivered true when the stanza was already delivered to this address.
@param uri used to specify an external system address, such as a sip:, sips:, or im: URI. | [
"Adds",
"a",
"new",
"address",
"to",
"which",
"the",
"stanza",
"is",
"going",
"to",
"be",
"sent",
"or",
"was",
"sent",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/address/packet/MultipleAddresses.java#L69-L80 |
26,878 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/pep/PepManager.java | PepManager.publish | public void publish(Item item, String node) throws NotConnectedException, InterruptedException,
NoResponseException, XMPPErrorException, NotAPubSubNodeException, NotALeafNodeException {
LeafNode pubSubNode = pepPubSubManager.getLeafNode(node);
pubSubNode.publish(item);
} | java | public void publish(Item item, String node) throws NotConnectedException, InterruptedException,
NoResponseException, XMPPErrorException, NotAPubSubNodeException, NotALeafNodeException {
LeafNode pubSubNode = pepPubSubManager.getLeafNode(node);
pubSubNode.publish(item);
} | [
"public",
"void",
"publish",
"(",
"Item",
"item",
",",
"String",
"node",
")",
"throws",
"NotConnectedException",
",",
"InterruptedException",
",",
"NoResponseException",
",",
"XMPPErrorException",
",",
"NotAPubSubNodeException",
",",
"NotALeafNodeException",
"{",
"LeafNode",
"pubSubNode",
"=",
"pepPubSubManager",
".",
"getLeafNode",
"(",
"node",
")",
";",
"pubSubNode",
".",
"publish",
"(",
"item",
")",
";",
"}"
] | Publish an event.
@param item the item to publish.
@param node the node to publish on.
@throws NotConnectedException
@throws InterruptedException
@throws XMPPErrorException
@throws NoResponseException
@throws NotAPubSubNodeException
@throws NotALeafNodeException | [
"Publish",
"an",
"event",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/pep/PepManager.java#L163-L167 |
26,879 | igniterealtime/Smack | smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/packet/JingleContent.java | JingleContent.addTransports | public void addTransports(final List<JingleTransport> transports) {
synchronized (transports) {
for (JingleTransport transport : transports) {
addJingleTransport(transport);
}
}
} | java | public void addTransports(final List<JingleTransport> transports) {
synchronized (transports) {
for (JingleTransport transport : transports) {
addJingleTransport(transport);
}
}
} | [
"public",
"void",
"addTransports",
"(",
"final",
"List",
"<",
"JingleTransport",
">",
"transports",
")",
"{",
"synchronized",
"(",
"transports",
")",
"{",
"for",
"(",
"JingleTransport",
"transport",
":",
"transports",
")",
"{",
"addJingleTransport",
"(",
"transport",
")",
";",
"}",
"}",
"}"
] | Adds a list of transports to add to the packet.
@param transports
the transports to add. | [
"Adds",
"a",
"list",
"of",
"transports",
"to",
"add",
"to",
"the",
"packet",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/packet/JingleContent.java#L118-L124 |
26,880 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/commands/AdHocCommandManager.java | AdHocCommandManager.getRemoteCommand | public RemoteCommand getRemoteCommand(Jid jid, String node) {
return new RemoteCommand(connection(), node, jid);
} | java | public RemoteCommand getRemoteCommand(Jid jid, String node) {
return new RemoteCommand(connection(), node, jid);
} | [
"public",
"RemoteCommand",
"getRemoteCommand",
"(",
"Jid",
"jid",
",",
"String",
"node",
")",
"{",
"return",
"new",
"RemoteCommand",
"(",
"connection",
"(",
")",
",",
"node",
",",
"jid",
")",
";",
"}"
] | Returns a command that represents an instance of a command in a remote
host. It is used to execute remote commands. The concept is similar to
RMI. Every invocation on this command is equivalent to an invocation in
the remote command.
@param jid the full JID of the host of the remote command
@param node the identifier of the command
@return a local instance equivalent to the remote command. | [
"Returns",
"a",
"command",
"that",
"represents",
"an",
"instance",
"of",
"a",
"command",
"in",
"a",
"remote",
"host",
".",
"It",
"is",
"used",
"to",
"execute",
"remote",
"commands",
".",
"The",
"concept",
"is",
"similar",
"to",
"RMI",
".",
"Every",
"invocation",
"on",
"this",
"command",
"is",
"equivalent",
"to",
"an",
"invocation",
"in",
"the",
"remote",
"command",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/commands/AdHocCommandManager.java#L277-L279 |
26,881 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/commands/AdHocCommandManager.java | AdHocCommandManager.respondError | private static IQ respondError(AdHocCommandData response, StanzaError.Builder error) {
response.setType(IQ.Type.error);
response.setError(error);
return response;
} | java | private static IQ respondError(AdHocCommandData response, StanzaError.Builder error) {
response.setType(IQ.Type.error);
response.setError(error);
return response;
} | [
"private",
"static",
"IQ",
"respondError",
"(",
"AdHocCommandData",
"response",
",",
"StanzaError",
".",
"Builder",
"error",
")",
"{",
"response",
".",
"setType",
"(",
"IQ",
".",
"Type",
".",
"error",
")",
";",
"response",
".",
"setError",
"(",
"error",
")",
";",
"return",
"response",
";",
"}"
] | Responds an error with an specific error.
@param response the response to send.
@param error the error to send.
@throws NotConnectedException | [
"Responds",
"an",
"error",
"with",
"an",
"specific",
"error",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/commands/AdHocCommandManager.java#L594-L598 |
26,882 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/commands/AdHocCommandManager.java | AdHocCommandManager.newInstanceOfCmd | private LocalCommand newInstanceOfCmd(String commandNode, String sessionID)
throws XMPPErrorException, InstantiationException, IllegalAccessException, IllegalArgumentException,
InvocationTargetException, NoSuchMethodException, SecurityException {
AdHocCommandInfo commandInfo = commands.get(commandNode);
LocalCommand command = commandInfo.getCommandInstance();
command.setSessionID(sessionID);
command.setName(commandInfo.getName());
command.setNode(commandInfo.getNode());
return command;
} | java | private LocalCommand newInstanceOfCmd(String commandNode, String sessionID)
throws XMPPErrorException, InstantiationException, IllegalAccessException, IllegalArgumentException,
InvocationTargetException, NoSuchMethodException, SecurityException {
AdHocCommandInfo commandInfo = commands.get(commandNode);
LocalCommand command = commandInfo.getCommandInstance();
command.setSessionID(sessionID);
command.setName(commandInfo.getName());
command.setNode(commandInfo.getNode());
return command;
} | [
"private",
"LocalCommand",
"newInstanceOfCmd",
"(",
"String",
"commandNode",
",",
"String",
"sessionID",
")",
"throws",
"XMPPErrorException",
",",
"InstantiationException",
",",
"IllegalAccessException",
",",
"IllegalArgumentException",
",",
"InvocationTargetException",
",",
"NoSuchMethodException",
",",
"SecurityException",
"{",
"AdHocCommandInfo",
"commandInfo",
"=",
"commands",
".",
"get",
"(",
"commandNode",
")",
";",
"LocalCommand",
"command",
"=",
"commandInfo",
".",
"getCommandInstance",
"(",
")",
";",
"command",
".",
"setSessionID",
"(",
"sessionID",
")",
";",
"command",
".",
"setName",
"(",
"commandInfo",
".",
"getName",
"(",
")",
")",
";",
"command",
".",
"setNode",
"(",
"commandInfo",
".",
"getNode",
"(",
")",
")",
";",
"return",
"command",
";",
"}"
] | Creates a new instance of a command to be used by a new execution request
@param commandNode the command node that identifies it.
@param sessionID the session id of this execution.
@return the command instance to execute.
@throws XMPPErrorException if there is problem creating the new instance.
@throws SecurityException
@throws NoSuchMethodException
@throws InvocationTargetException
@throws IllegalArgumentException
@throws IllegalAccessException
@throws InstantiationException | [
"Creates",
"a",
"new",
"instance",
"of",
"a",
"command",
"to",
"be",
"used",
"by",
"a",
"new",
"execution",
"request"
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/commands/AdHocCommandManager.java#L614-L624 |
26,883 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/iqprivate/packet/DefaultPrivateData.java | DefaultPrivateData.getNames | public synchronized Set<String> getNames() {
if (map == null) {
return Collections.emptySet();
}
return Collections.unmodifiableSet(map.keySet());
} | java | public synchronized Set<String> getNames() {
if (map == null) {
return Collections.emptySet();
}
return Collections.unmodifiableSet(map.keySet());
} | [
"public",
"synchronized",
"Set",
"<",
"String",
">",
"getNames",
"(",
")",
"{",
"if",
"(",
"map",
"==",
"null",
")",
"{",
"return",
"Collections",
".",
"emptySet",
"(",
")",
";",
"}",
"return",
"Collections",
".",
"unmodifiableSet",
"(",
"map",
".",
"keySet",
"(",
")",
")",
";",
"}"
] | Returns a Set of the names that can be used to get
values of the private data.
@return a Set of the names. | [
"Returns",
"a",
"Set",
"of",
"the",
"names",
"that",
"can",
"be",
"used",
"to",
"get",
"values",
"of",
"the",
"private",
"data",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/iqprivate/packet/DefaultPrivateData.java#L104-L109 |
26,884 | igniterealtime/Smack | smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/ContentNegotiator.java | ContentNegotiator.isFullyEstablished | public boolean isFullyEstablished() {
boolean result = true;
MediaNegotiator mediaNeg = getMediaNegotiator();
if ((mediaNeg == null) || !mediaNeg.isFullyEstablished()) {
result = false;
}
TransportNegotiator transNeg = getTransportNegotiator();
if ((transNeg == null) || !transNeg.isFullyEstablished()) {
result = false;
}
return result;
} | java | public boolean isFullyEstablished() {
boolean result = true;
MediaNegotiator mediaNeg = getMediaNegotiator();
if ((mediaNeg == null) || !mediaNeg.isFullyEstablished()) {
result = false;
}
TransportNegotiator transNeg = getTransportNegotiator();
if ((transNeg == null) || !transNeg.isFullyEstablished()) {
result = false;
}
return result;
} | [
"public",
"boolean",
"isFullyEstablished",
"(",
")",
"{",
"boolean",
"result",
"=",
"true",
";",
"MediaNegotiator",
"mediaNeg",
"=",
"getMediaNegotiator",
"(",
")",
";",
"if",
"(",
"(",
"mediaNeg",
"==",
"null",
")",
"||",
"!",
"mediaNeg",
".",
"isFullyEstablished",
"(",
")",
")",
"{",
"result",
"=",
"false",
";",
"}",
"TransportNegotiator",
"transNeg",
"=",
"getTransportNegotiator",
"(",
")",
";",
"if",
"(",
"(",
"transNeg",
"==",
"null",
")",
"||",
"!",
"transNeg",
".",
"isFullyEstablished",
"(",
")",
")",
"{",
"result",
"=",
"false",
";",
"}",
"return",
"result",
";",
"}"
] | Return true if the transport and content negotiators have finished. | [
"Return",
"true",
"if",
"the",
"transport",
"and",
"content",
"negotiators",
"have",
"finished",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/ContentNegotiator.java#L229-L243 |
26,885 | igniterealtime/Smack | smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/ContentNegotiator.java | ContentNegotiator.getNegotiatorState | @Override
public JingleNegotiatorState getNegotiatorState() {
JingleNegotiatorState result = JingleNegotiatorState.PENDING;
if ((mediaNeg != null) && (transNeg != null)) {
if ((mediaNeg.getNegotiatorState() == JingleNegotiatorState.SUCCEEDED)
|| (transNeg.getNegotiatorState() == JingleNegotiatorState.SUCCEEDED))
result = JingleNegotiatorState.SUCCEEDED;
if ((mediaNeg.getNegotiatorState() == JingleNegotiatorState.FAILED)
|| (transNeg.getNegotiatorState() == JingleNegotiatorState.FAILED))
result = JingleNegotiatorState.FAILED;
}
// Store the state (to make it easier to know when debugging.)
setNegotiatorState(result);
return result;
} | java | @Override
public JingleNegotiatorState getNegotiatorState() {
JingleNegotiatorState result = JingleNegotiatorState.PENDING;
if ((mediaNeg != null) && (transNeg != null)) {
if ((mediaNeg.getNegotiatorState() == JingleNegotiatorState.SUCCEEDED)
|| (transNeg.getNegotiatorState() == JingleNegotiatorState.SUCCEEDED))
result = JingleNegotiatorState.SUCCEEDED;
if ((mediaNeg.getNegotiatorState() == JingleNegotiatorState.FAILED)
|| (transNeg.getNegotiatorState() == JingleNegotiatorState.FAILED))
result = JingleNegotiatorState.FAILED;
}
// Store the state (to make it easier to know when debugging.)
setNegotiatorState(result);
return result;
} | [
"@",
"Override",
"public",
"JingleNegotiatorState",
"getNegotiatorState",
"(",
")",
"{",
"JingleNegotiatorState",
"result",
"=",
"JingleNegotiatorState",
".",
"PENDING",
";",
"if",
"(",
"(",
"mediaNeg",
"!=",
"null",
")",
"&&",
"(",
"transNeg",
"!=",
"null",
")",
")",
"{",
"if",
"(",
"(",
"mediaNeg",
".",
"getNegotiatorState",
"(",
")",
"==",
"JingleNegotiatorState",
".",
"SUCCEEDED",
")",
"||",
"(",
"transNeg",
".",
"getNegotiatorState",
"(",
")",
"==",
"JingleNegotiatorState",
".",
"SUCCEEDED",
")",
")",
"result",
"=",
"JingleNegotiatorState",
".",
"SUCCEEDED",
";",
"if",
"(",
"(",
"mediaNeg",
".",
"getNegotiatorState",
"(",
")",
"==",
"JingleNegotiatorState",
".",
"FAILED",
")",
"||",
"(",
"transNeg",
".",
"getNegotiatorState",
"(",
")",
"==",
"JingleNegotiatorState",
".",
"FAILED",
")",
")",
"result",
"=",
"JingleNegotiatorState",
".",
"FAILED",
";",
"}",
"// Store the state (to make it easier to know when debugging.)",
"setNegotiatorState",
"(",
"result",
")",
";",
"return",
"result",
";",
"}"
] | The negotiator state for the ContentNegotiators is a special case.
It is a roll-up of the sub-negotiator states. | [
"The",
"negotiator",
"state",
"for",
"the",
"ContentNegotiators",
"is",
"a",
"special",
"case",
".",
"It",
"is",
"a",
"roll",
"-",
"up",
"of",
"the",
"sub",
"-",
"negotiator",
"states",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/ContentNegotiator.java#L331-L350 |
26,886 | igniterealtime/Smack | smack-core/src/main/java/org/jivesoftware/smack/util/ParserUtils.java | ParserUtils.getBooleanAttribute | public static Boolean getBooleanAttribute(XmlPullParser parser, String name) {
String valueString = parser.getAttributeValue("", name);
if (valueString == null)
return null;
valueString = valueString.toLowerCase(Locale.US);
return parseXmlBoolean(valueString);
} | java | public static Boolean getBooleanAttribute(XmlPullParser parser, String name) {
String valueString = parser.getAttributeValue("", name);
if (valueString == null)
return null;
valueString = valueString.toLowerCase(Locale.US);
return parseXmlBoolean(valueString);
} | [
"public",
"static",
"Boolean",
"getBooleanAttribute",
"(",
"XmlPullParser",
"parser",
",",
"String",
"name",
")",
"{",
"String",
"valueString",
"=",
"parser",
".",
"getAttributeValue",
"(",
"\"\"",
",",
"name",
")",
";",
"if",
"(",
"valueString",
"==",
"null",
")",
"return",
"null",
";",
"valueString",
"=",
"valueString",
".",
"toLowerCase",
"(",
"Locale",
".",
"US",
")",
";",
"return",
"parseXmlBoolean",
"(",
"valueString",
")",
";",
"}"
] | Get the boolean value of an argument.
@param parser
@param name
@return the boolean value or null of no argument of the given name exists | [
"Get",
"the",
"boolean",
"value",
"of",
"an",
"argument",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-core/src/main/java/org/jivesoftware/smack/util/ParserUtils.java#L162-L168 |
26,887 | igniterealtime/Smack | smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/RTPBridge.java | RTPBridge.getAttributes | public String getAttributes() {
StringBuilder str = new StringBuilder();
if (getSid() != null)
str.append(" sid='").append(getSid()).append('\'');
if (getPass() != null)
str.append(" pass='").append(getPass()).append('\'');
if (getPortA() != -1)
str.append(" porta='").append(getPortA()).append('\'');
if (getPortB() != -1)
str.append(" portb='").append(getPortB()).append('\'');
if (getHostA() != null)
str.append(" hosta='").append(getHostA()).append('\'');
if (getHostB() != null)
str.append(" hostb='").append(getHostB()).append('\'');
return str.toString();
} | java | public String getAttributes() {
StringBuilder str = new StringBuilder();
if (getSid() != null)
str.append(" sid='").append(getSid()).append('\'');
if (getPass() != null)
str.append(" pass='").append(getPass()).append('\'');
if (getPortA() != -1)
str.append(" porta='").append(getPortA()).append('\'');
if (getPortB() != -1)
str.append(" portb='").append(getPortB()).append('\'');
if (getHostA() != null)
str.append(" hosta='").append(getHostA()).append('\'');
if (getHostB() != null)
str.append(" hostb='").append(getHostB()).append('\'');
return str.toString();
} | [
"public",
"String",
"getAttributes",
"(",
")",
"{",
"StringBuilder",
"str",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"if",
"(",
"getSid",
"(",
")",
"!=",
"null",
")",
"str",
".",
"append",
"(",
"\" sid='\"",
")",
".",
"append",
"(",
"getSid",
"(",
")",
")",
".",
"append",
"(",
"'",
"'",
")",
";",
"if",
"(",
"getPass",
"(",
")",
"!=",
"null",
")",
"str",
".",
"append",
"(",
"\" pass='\"",
")",
".",
"append",
"(",
"getPass",
"(",
")",
")",
".",
"append",
"(",
"'",
"'",
")",
";",
"if",
"(",
"getPortA",
"(",
")",
"!=",
"-",
"1",
")",
"str",
".",
"append",
"(",
"\" porta='\"",
")",
".",
"append",
"(",
"getPortA",
"(",
")",
")",
".",
"append",
"(",
"'",
"'",
")",
";",
"if",
"(",
"getPortB",
"(",
")",
"!=",
"-",
"1",
")",
"str",
".",
"append",
"(",
"\" portb='\"",
")",
".",
"append",
"(",
"getPortB",
"(",
")",
")",
".",
"append",
"(",
"'",
"'",
")",
";",
"if",
"(",
"getHostA",
"(",
")",
"!=",
"null",
")",
"str",
".",
"append",
"(",
"\" hosta='\"",
")",
".",
"append",
"(",
"getHostA",
"(",
")",
")",
".",
"append",
"(",
"'",
"'",
")",
";",
"if",
"(",
"getHostB",
"(",
")",
"!=",
"null",
")",
"str",
".",
"append",
"(",
"\" hostb='\"",
")",
".",
"append",
"(",
"getHostB",
"(",
")",
")",
".",
"append",
"(",
"'",
"'",
")",
";",
"return",
"str",
".",
"toString",
"(",
")",
";",
"}"
] | Get the attributes string. | [
"Get",
"the",
"attributes",
"string",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/RTPBridge.java#L135-L157 |
26,888 | igniterealtime/Smack | smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/RTPBridge.java | RTPBridge.getIQChildElementBuilder | @Override
protected IQChildElementXmlStringBuilder getIQChildElementBuilder(IQChildElementXmlStringBuilder str) {
str.attribute("sid", sid);
str.rightAngleBracket();
if (bridgeAction.equals(BridgeAction.create))
str.append("<candidate/>");
else if (bridgeAction.equals(BridgeAction.change))
str.append("<relay ").append(getAttributes()).append(" />");
else
str.append("<publicip ").append(getAttributes()).append(" />");
return str;
} | java | @Override
protected IQChildElementXmlStringBuilder getIQChildElementBuilder(IQChildElementXmlStringBuilder str) {
str.attribute("sid", sid);
str.rightAngleBracket();
if (bridgeAction.equals(BridgeAction.create))
str.append("<candidate/>");
else if (bridgeAction.equals(BridgeAction.change))
str.append("<relay ").append(getAttributes()).append(" />");
else
str.append("<publicip ").append(getAttributes()).append(" />");
return str;
} | [
"@",
"Override",
"protected",
"IQChildElementXmlStringBuilder",
"getIQChildElementBuilder",
"(",
"IQChildElementXmlStringBuilder",
"str",
")",
"{",
"str",
".",
"attribute",
"(",
"\"sid\"",
",",
"sid",
")",
";",
"str",
".",
"rightAngleBracket",
"(",
")",
";",
"if",
"(",
"bridgeAction",
".",
"equals",
"(",
"BridgeAction",
".",
"create",
")",
")",
"str",
".",
"append",
"(",
"\"<candidate/>\"",
")",
";",
"else",
"if",
"(",
"bridgeAction",
".",
"equals",
"(",
"BridgeAction",
".",
"change",
")",
")",
"str",
".",
"append",
"(",
"\"<relay \"",
")",
".",
"append",
"(",
"getAttributes",
"(",
")",
")",
".",
"append",
"(",
"\" />\"",
")",
";",
"else",
"str",
".",
"append",
"(",
"\"<publicip \"",
")",
".",
"append",
"(",
"getAttributes",
"(",
")",
")",
".",
"append",
"(",
"\" />\"",
")",
";",
"return",
"str",
";",
"}"
] | Get the Child Element XML of the Packet
@return the Child Element XML of the Packet | [
"Get",
"the",
"Child",
"Element",
"XML",
"of",
"the",
"Packet"
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/RTPBridge.java#L308-L321 |
26,889 | igniterealtime/Smack | smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/RTPBridge.java | RTPBridge.getRTPBridge | @SuppressWarnings("deprecation")
public static RTPBridge getRTPBridge(XMPPConnection connection, String sessionID) throws NotConnectedException, InterruptedException {
if (!connection.isConnected()) {
return null;
}
RTPBridge rtpPacket = new RTPBridge(sessionID);
rtpPacket.setTo(RTPBridge.NAME + "." + connection.getXMPPServiceDomain());
StanzaCollector collector = connection.createStanzaCollectorAndSend(rtpPacket);
RTPBridge response = collector.nextResult();
// Cancel the collector.
collector.cancel();
return response;
} | java | @SuppressWarnings("deprecation")
public static RTPBridge getRTPBridge(XMPPConnection connection, String sessionID) throws NotConnectedException, InterruptedException {
if (!connection.isConnected()) {
return null;
}
RTPBridge rtpPacket = new RTPBridge(sessionID);
rtpPacket.setTo(RTPBridge.NAME + "." + connection.getXMPPServiceDomain());
StanzaCollector collector = connection.createStanzaCollectorAndSend(rtpPacket);
RTPBridge response = collector.nextResult();
// Cancel the collector.
collector.cancel();
return response;
} | [
"@",
"SuppressWarnings",
"(",
"\"deprecation\"",
")",
"public",
"static",
"RTPBridge",
"getRTPBridge",
"(",
"XMPPConnection",
"connection",
",",
"String",
"sessionID",
")",
"throws",
"NotConnectedException",
",",
"InterruptedException",
"{",
"if",
"(",
"!",
"connection",
".",
"isConnected",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"RTPBridge",
"rtpPacket",
"=",
"new",
"RTPBridge",
"(",
"sessionID",
")",
";",
"rtpPacket",
".",
"setTo",
"(",
"RTPBridge",
".",
"NAME",
"+",
"\".\"",
"+",
"connection",
".",
"getXMPPServiceDomain",
"(",
")",
")",
";",
"StanzaCollector",
"collector",
"=",
"connection",
".",
"createStanzaCollectorAndSend",
"(",
"rtpPacket",
")",
";",
"RTPBridge",
"response",
"=",
"collector",
".",
"nextResult",
"(",
")",
";",
"// Cancel the collector.",
"collector",
".",
"cancel",
"(",
")",
";",
"return",
"response",
";",
"}"
] | Get a new RTPBridge Candidate from the server.
If a error occurs or the server don't support RTPBridge Service, null is returned.
@param connection
@param sessionID
@return the new RTPBridge
@throws NotConnectedException
@throws InterruptedException | [
"Get",
"a",
"new",
"RTPBridge",
"Candidate",
"from",
"the",
"server",
".",
"If",
"a",
"error",
"occurs",
"or",
"the",
"server",
"don",
"t",
"support",
"RTPBridge",
"Service",
"null",
"is",
"returned",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/RTPBridge.java#L399-L417 |
26,890 | igniterealtime/Smack | smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/RTPBridge.java | RTPBridge.getPublicIP | @SuppressWarnings("deprecation")
public static String getPublicIP(XMPPConnection xmppConnection) throws NotConnectedException, InterruptedException {
if (!xmppConnection.isConnected()) {
return null;
}
RTPBridge rtpPacket = new RTPBridge(RTPBridge.BridgeAction.publicip);
rtpPacket.setTo(RTPBridge.NAME + "." + xmppConnection.getXMPPServiceDomain());
rtpPacket.setType(Type.set);
// LOGGER.debug("Relayed to: " + candidate.getIp() + ":" + candidate.getPort());
StanzaCollector collector = xmppConnection.createStanzaCollectorAndSend(rtpPacket);
RTPBridge response = collector.nextResult();
// Cancel the collector.
collector.cancel();
if (response == null) return null;
if (response.getIp() == null || response.getIp().equals("")) return null;
Enumeration<NetworkInterface> ifaces = null;
try {
ifaces = NetworkInterface.getNetworkInterfaces();
}
catch (SocketException e) {
LOGGER.log(Level.WARNING, "exception", e);
}
while (ifaces != null && ifaces.hasMoreElements()) {
NetworkInterface iface = ifaces.nextElement();
Enumeration<InetAddress> iaddresses = iface.getInetAddresses();
while (iaddresses.hasMoreElements()) {
InetAddress iaddress = iaddresses.nextElement();
if (!iaddress.isLoopbackAddress())
if (iaddress.getHostAddress().indexOf(response.getIp()) >= 0)
return null;
}
}
return response.getIp();
} | java | @SuppressWarnings("deprecation")
public static String getPublicIP(XMPPConnection xmppConnection) throws NotConnectedException, InterruptedException {
if (!xmppConnection.isConnected()) {
return null;
}
RTPBridge rtpPacket = new RTPBridge(RTPBridge.BridgeAction.publicip);
rtpPacket.setTo(RTPBridge.NAME + "." + xmppConnection.getXMPPServiceDomain());
rtpPacket.setType(Type.set);
// LOGGER.debug("Relayed to: " + candidate.getIp() + ":" + candidate.getPort());
StanzaCollector collector = xmppConnection.createStanzaCollectorAndSend(rtpPacket);
RTPBridge response = collector.nextResult();
// Cancel the collector.
collector.cancel();
if (response == null) return null;
if (response.getIp() == null || response.getIp().equals("")) return null;
Enumeration<NetworkInterface> ifaces = null;
try {
ifaces = NetworkInterface.getNetworkInterfaces();
}
catch (SocketException e) {
LOGGER.log(Level.WARNING, "exception", e);
}
while (ifaces != null && ifaces.hasMoreElements()) {
NetworkInterface iface = ifaces.nextElement();
Enumeration<InetAddress> iaddresses = iface.getInetAddresses();
while (iaddresses.hasMoreElements()) {
InetAddress iaddress = iaddresses.nextElement();
if (!iaddress.isLoopbackAddress())
if (iaddress.getHostAddress().indexOf(response.getIp()) >= 0)
return null;
}
}
return response.getIp();
} | [
"@",
"SuppressWarnings",
"(",
"\"deprecation\"",
")",
"public",
"static",
"String",
"getPublicIP",
"(",
"XMPPConnection",
"xmppConnection",
")",
"throws",
"NotConnectedException",
",",
"InterruptedException",
"{",
"if",
"(",
"!",
"xmppConnection",
".",
"isConnected",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"RTPBridge",
"rtpPacket",
"=",
"new",
"RTPBridge",
"(",
"RTPBridge",
".",
"BridgeAction",
".",
"publicip",
")",
";",
"rtpPacket",
".",
"setTo",
"(",
"RTPBridge",
".",
"NAME",
"+",
"\".\"",
"+",
"xmppConnection",
".",
"getXMPPServiceDomain",
"(",
")",
")",
";",
"rtpPacket",
".",
"setType",
"(",
"Type",
".",
"set",
")",
";",
"// LOGGER.debug(\"Relayed to: \" + candidate.getIp() + \":\" + candidate.getPort());",
"StanzaCollector",
"collector",
"=",
"xmppConnection",
".",
"createStanzaCollectorAndSend",
"(",
"rtpPacket",
")",
";",
"RTPBridge",
"response",
"=",
"collector",
".",
"nextResult",
"(",
")",
";",
"// Cancel the collector.",
"collector",
".",
"cancel",
"(",
")",
";",
"if",
"(",
"response",
"==",
"null",
")",
"return",
"null",
";",
"if",
"(",
"response",
".",
"getIp",
"(",
")",
"==",
"null",
"||",
"response",
".",
"getIp",
"(",
")",
".",
"equals",
"(",
"\"\"",
")",
")",
"return",
"null",
";",
"Enumeration",
"<",
"NetworkInterface",
">",
"ifaces",
"=",
"null",
";",
"try",
"{",
"ifaces",
"=",
"NetworkInterface",
".",
"getNetworkInterfaces",
"(",
")",
";",
"}",
"catch",
"(",
"SocketException",
"e",
")",
"{",
"LOGGER",
".",
"log",
"(",
"Level",
".",
"WARNING",
",",
"\"exception\"",
",",
"e",
")",
";",
"}",
"while",
"(",
"ifaces",
"!=",
"null",
"&&",
"ifaces",
".",
"hasMoreElements",
"(",
")",
")",
"{",
"NetworkInterface",
"iface",
"=",
"ifaces",
".",
"nextElement",
"(",
")",
";",
"Enumeration",
"<",
"InetAddress",
">",
"iaddresses",
"=",
"iface",
".",
"getInetAddresses",
"(",
")",
";",
"while",
"(",
"iaddresses",
".",
"hasMoreElements",
"(",
")",
")",
"{",
"InetAddress",
"iaddress",
"=",
"iaddresses",
".",
"nextElement",
"(",
")",
";",
"if",
"(",
"!",
"iaddress",
".",
"isLoopbackAddress",
"(",
")",
")",
"if",
"(",
"iaddress",
".",
"getHostAddress",
"(",
")",
".",
"indexOf",
"(",
"response",
".",
"getIp",
"(",
")",
")",
">=",
"0",
")",
"return",
"null",
";",
"}",
"}",
"return",
"response",
".",
"getIp",
"(",
")",
";",
"}"
] | Get Public Address from the Server.
@param xmppConnection
@return public IP String or null if not found
@throws NotConnectedException
@throws InterruptedException | [
"Get",
"Public",
"Address",
"from",
"the",
"Server",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/RTPBridge.java#L504-L550 |
26,891 | igniterealtime/Smack | smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/jmf/AudioChannel.java | AudioChannel.start | public synchronized String start() {
if (started) return null;
// Create a processor for the specified jmf locator
String result = createProcessor();
if (result != null) {
started = false;
}
// Create an RTP session to transmit the output of the
// processor to the specified IP address and port no.
result = createTransmitter();
if (result != null) {
processor.close();
processor = null;
started = false;
}
else {
started = true;
}
// Start the transmission
processor.start();
return null;
} | java | public synchronized String start() {
if (started) return null;
// Create a processor for the specified jmf locator
String result = createProcessor();
if (result != null) {
started = false;
}
// Create an RTP session to transmit the output of the
// processor to the specified IP address and port no.
result = createTransmitter();
if (result != null) {
processor.close();
processor = null;
started = false;
}
else {
started = true;
}
// Start the transmission
processor.start();
return null;
} | [
"public",
"synchronized",
"String",
"start",
"(",
")",
"{",
"if",
"(",
"started",
")",
"return",
"null",
";",
"// Create a processor for the specified jmf locator",
"String",
"result",
"=",
"createProcessor",
"(",
")",
";",
"if",
"(",
"result",
"!=",
"null",
")",
"{",
"started",
"=",
"false",
";",
"}",
"// Create an RTP session to transmit the output of the",
"// processor to the specified IP address and port no.",
"result",
"=",
"createTransmitter",
"(",
")",
";",
"if",
"(",
"result",
"!=",
"null",
")",
"{",
"processor",
".",
"close",
"(",
")",
";",
"processor",
"=",
"null",
";",
"started",
"=",
"false",
";",
"}",
"else",
"{",
"started",
"=",
"true",
";",
"}",
"// Start the transmission",
"processor",
".",
"start",
"(",
")",
";",
"return",
"null",
";",
"}"
] | Starts the transmission. Returns null if transmission started ok.
Otherwise it returns a string with the reason why the setup failed.
Starts receive also.
@return result description | [
"Starts",
"the",
"transmission",
".",
"Returns",
"null",
"if",
"transmission",
"started",
"ok",
".",
"Otherwise",
"it",
"returns",
"a",
"string",
"with",
"the",
"reason",
"why",
"the",
"setup",
"failed",
".",
"Starts",
"receive",
"also",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/jmf/AudioChannel.java#L127-L152 |
26,892 | igniterealtime/Smack | smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/jmf/AudioChannel.java | AudioChannel.stop | public void stop() {
if (!started) return;
synchronized (this) {
try {
started = false;
if (processor != null) {
processor.stop();
processor = null;
for (RTPManager rtpMgr : rtpMgrs) {
rtpMgr.removeReceiveStreamListener(audioReceiver);
rtpMgr.removeSessionListener(audioReceiver);
rtpMgr.removeTargets("Session ended.");
rtpMgr.dispose();
}
sendStreams.clear();
}
}
catch (Exception e) {
LOGGER.log(Level.WARNING, "exception", e);
}
}
} | java | public void stop() {
if (!started) return;
synchronized (this) {
try {
started = false;
if (processor != null) {
processor.stop();
processor = null;
for (RTPManager rtpMgr : rtpMgrs) {
rtpMgr.removeReceiveStreamListener(audioReceiver);
rtpMgr.removeSessionListener(audioReceiver);
rtpMgr.removeTargets("Session ended.");
rtpMgr.dispose();
}
sendStreams.clear();
}
}
catch (Exception e) {
LOGGER.log(Level.WARNING, "exception", e);
}
}
} | [
"public",
"void",
"stop",
"(",
")",
"{",
"if",
"(",
"!",
"started",
")",
"return",
";",
"synchronized",
"(",
"this",
")",
"{",
"try",
"{",
"started",
"=",
"false",
";",
"if",
"(",
"processor",
"!=",
"null",
")",
"{",
"processor",
".",
"stop",
"(",
")",
";",
"processor",
"=",
"null",
";",
"for",
"(",
"RTPManager",
"rtpMgr",
":",
"rtpMgrs",
")",
"{",
"rtpMgr",
".",
"removeReceiveStreamListener",
"(",
"audioReceiver",
")",
";",
"rtpMgr",
".",
"removeSessionListener",
"(",
"audioReceiver",
")",
";",
"rtpMgr",
".",
"removeTargets",
"(",
"\"Session ended.\"",
")",
";",
"rtpMgr",
".",
"dispose",
"(",
")",
";",
"}",
"sendStreams",
".",
"clear",
"(",
")",
";",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"LOGGER",
".",
"log",
"(",
"Level",
".",
"WARNING",
",",
"\"exception\"",
",",
"e",
")",
";",
"}",
"}",
"}"
] | Stops the transmission if already started.
Stops the receiver also. | [
"Stops",
"the",
"transmission",
"if",
"already",
"started",
".",
"Stops",
"the",
"receiver",
"also",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/jmf/AudioChannel.java#L158-L182 |
26,893 | igniterealtime/Smack | smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/jmf/AudioChannel.java | AudioChannel.getPacketSize | private int getPacketSize(Format codecFormat, int milliseconds) throws IllegalArgumentException {
String encoding = codecFormat.getEncoding();
if (encoding.equalsIgnoreCase(AudioFormat.GSM) ||
encoding.equalsIgnoreCase(AudioFormat.GSM_RTP)) {
return milliseconds * 4; // 1 byte per millisec
}
else if (encoding.equalsIgnoreCase(AudioFormat.ULAW) ||
encoding.equalsIgnoreCase(AudioFormat.ULAW_RTP)) {
return milliseconds * 8;
}
else {
throw new IllegalArgumentException("Unknown codec type");
}
} | java | private int getPacketSize(Format codecFormat, int milliseconds) throws IllegalArgumentException {
String encoding = codecFormat.getEncoding();
if (encoding.equalsIgnoreCase(AudioFormat.GSM) ||
encoding.equalsIgnoreCase(AudioFormat.GSM_RTP)) {
return milliseconds * 4; // 1 byte per millisec
}
else if (encoding.equalsIgnoreCase(AudioFormat.ULAW) ||
encoding.equalsIgnoreCase(AudioFormat.ULAW_RTP)) {
return milliseconds * 8;
}
else {
throw new IllegalArgumentException("Unknown codec type");
}
} | [
"private",
"int",
"getPacketSize",
"(",
"Format",
"codecFormat",
",",
"int",
"milliseconds",
")",
"throws",
"IllegalArgumentException",
"{",
"String",
"encoding",
"=",
"codecFormat",
".",
"getEncoding",
"(",
")",
";",
"if",
"(",
"encoding",
".",
"equalsIgnoreCase",
"(",
"AudioFormat",
".",
"GSM",
")",
"||",
"encoding",
".",
"equalsIgnoreCase",
"(",
"AudioFormat",
".",
"GSM_RTP",
")",
")",
"{",
"return",
"milliseconds",
"*",
"4",
";",
"// 1 byte per millisec",
"}",
"else",
"if",
"(",
"encoding",
".",
"equalsIgnoreCase",
"(",
"AudioFormat",
".",
"ULAW",
")",
"||",
"encoding",
".",
"equalsIgnoreCase",
"(",
"AudioFormat",
".",
"ULAW_RTP",
")",
")",
"{",
"return",
"milliseconds",
"*",
"8",
";",
"}",
"else",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Unknown codec type\"",
")",
";",
"}",
"}"
] | Get the best stanza size for a given codec and a codec rate
@param codecFormat
@param milliseconds
@return the best stanza size
@throws IllegalArgumentException | [
"Get",
"the",
"best",
"stanza",
"size",
"for",
"a",
"given",
"codec",
"and",
"a",
"codec",
"rate"
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/jmf/AudioChannel.java#L320-L333 |
26,894 | igniterealtime/Smack | smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/jmf/AudioChannel.java | AudioChannel.createTransmitter | private String createTransmitter() {
// Cheated. Should have checked the type.
PushBufferDataSource pbds = (PushBufferDataSource) dataOutput;
PushBufferStream[] pbss = pbds.getStreams();
rtpMgrs = new RTPManager[pbss.length];
SessionAddress localAddr, destAddr;
InetAddress ipAddr;
SendStream sendStream;
audioReceiver = new AudioReceiver(this, jingleMediaSession);
int port;
for (int i = 0; i < pbss.length; i++) {
try {
rtpMgrs[i] = RTPManager.newInstance();
port = portBase + 2 * i;
ipAddr = InetAddress.getByName(remoteIpAddress);
localAddr = new SessionAddress(InetAddress.getByName(this.localIpAddress),
localPort);
destAddr = new SessionAddress(ipAddr, port);
rtpMgrs[i].addReceiveStreamListener(audioReceiver);
rtpMgrs[i].addSessionListener(audioReceiver);
BufferControl bc = (BufferControl) rtpMgrs[i].getControl("javax.media.control.BufferControl");
if (bc != null) {
int bl = 160;
bc.setBufferLength(bl);
}
try {
rtpMgrs[i].initialize(localAddr);
}
catch (InvalidSessionAddressException e) {
// In case the local address is not allowed to read, we user another local address
SessionAddress sessAddr = new SessionAddress();
localAddr = new SessionAddress(sessAddr.getDataAddress(),
localPort);
rtpMgrs[i].initialize(localAddr);
}
rtpMgrs[i].addTarget(destAddr);
LOGGER.severe("Created RTP session at " + localPort + " to: " + remoteIpAddress + " " + port);
sendStream = rtpMgrs[i].createSendStream(dataOutput, i);
sendStreams.add(sendStream);
sendStream.start();
}
catch (Exception e) {
LOGGER.log(Level.WARNING, "exception", e);
return e.getMessage();
}
}
return null;
} | java | private String createTransmitter() {
// Cheated. Should have checked the type.
PushBufferDataSource pbds = (PushBufferDataSource) dataOutput;
PushBufferStream[] pbss = pbds.getStreams();
rtpMgrs = new RTPManager[pbss.length];
SessionAddress localAddr, destAddr;
InetAddress ipAddr;
SendStream sendStream;
audioReceiver = new AudioReceiver(this, jingleMediaSession);
int port;
for (int i = 0; i < pbss.length; i++) {
try {
rtpMgrs[i] = RTPManager.newInstance();
port = portBase + 2 * i;
ipAddr = InetAddress.getByName(remoteIpAddress);
localAddr = new SessionAddress(InetAddress.getByName(this.localIpAddress),
localPort);
destAddr = new SessionAddress(ipAddr, port);
rtpMgrs[i].addReceiveStreamListener(audioReceiver);
rtpMgrs[i].addSessionListener(audioReceiver);
BufferControl bc = (BufferControl) rtpMgrs[i].getControl("javax.media.control.BufferControl");
if (bc != null) {
int bl = 160;
bc.setBufferLength(bl);
}
try {
rtpMgrs[i].initialize(localAddr);
}
catch (InvalidSessionAddressException e) {
// In case the local address is not allowed to read, we user another local address
SessionAddress sessAddr = new SessionAddress();
localAddr = new SessionAddress(sessAddr.getDataAddress(),
localPort);
rtpMgrs[i].initialize(localAddr);
}
rtpMgrs[i].addTarget(destAddr);
LOGGER.severe("Created RTP session at " + localPort + " to: " + remoteIpAddress + " " + port);
sendStream = rtpMgrs[i].createSendStream(dataOutput, i);
sendStreams.add(sendStream);
sendStream.start();
}
catch (Exception e) {
LOGGER.log(Level.WARNING, "exception", e);
return e.getMessage();
}
}
return null;
} | [
"private",
"String",
"createTransmitter",
"(",
")",
"{",
"// Cheated. Should have checked the type.",
"PushBufferDataSource",
"pbds",
"=",
"(",
"PushBufferDataSource",
")",
"dataOutput",
";",
"PushBufferStream",
"[",
"]",
"pbss",
"=",
"pbds",
".",
"getStreams",
"(",
")",
";",
"rtpMgrs",
"=",
"new",
"RTPManager",
"[",
"pbss",
".",
"length",
"]",
";",
"SessionAddress",
"localAddr",
",",
"destAddr",
";",
"InetAddress",
"ipAddr",
";",
"SendStream",
"sendStream",
";",
"audioReceiver",
"=",
"new",
"AudioReceiver",
"(",
"this",
",",
"jingleMediaSession",
")",
";",
"int",
"port",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"pbss",
".",
"length",
";",
"i",
"++",
")",
"{",
"try",
"{",
"rtpMgrs",
"[",
"i",
"]",
"=",
"RTPManager",
".",
"newInstance",
"(",
")",
";",
"port",
"=",
"portBase",
"+",
"2",
"*",
"i",
";",
"ipAddr",
"=",
"InetAddress",
".",
"getByName",
"(",
"remoteIpAddress",
")",
";",
"localAddr",
"=",
"new",
"SessionAddress",
"(",
"InetAddress",
".",
"getByName",
"(",
"this",
".",
"localIpAddress",
")",
",",
"localPort",
")",
";",
"destAddr",
"=",
"new",
"SessionAddress",
"(",
"ipAddr",
",",
"port",
")",
";",
"rtpMgrs",
"[",
"i",
"]",
".",
"addReceiveStreamListener",
"(",
"audioReceiver",
")",
";",
"rtpMgrs",
"[",
"i",
"]",
".",
"addSessionListener",
"(",
"audioReceiver",
")",
";",
"BufferControl",
"bc",
"=",
"(",
"BufferControl",
")",
"rtpMgrs",
"[",
"i",
"]",
".",
"getControl",
"(",
"\"javax.media.control.BufferControl\"",
")",
";",
"if",
"(",
"bc",
"!=",
"null",
")",
"{",
"int",
"bl",
"=",
"160",
";",
"bc",
".",
"setBufferLength",
"(",
"bl",
")",
";",
"}",
"try",
"{",
"rtpMgrs",
"[",
"i",
"]",
".",
"initialize",
"(",
"localAddr",
")",
";",
"}",
"catch",
"(",
"InvalidSessionAddressException",
"e",
")",
"{",
"// In case the local address is not allowed to read, we user another local address",
"SessionAddress",
"sessAddr",
"=",
"new",
"SessionAddress",
"(",
")",
";",
"localAddr",
"=",
"new",
"SessionAddress",
"(",
"sessAddr",
".",
"getDataAddress",
"(",
")",
",",
"localPort",
")",
";",
"rtpMgrs",
"[",
"i",
"]",
".",
"initialize",
"(",
"localAddr",
")",
";",
"}",
"rtpMgrs",
"[",
"i",
"]",
".",
"addTarget",
"(",
"destAddr",
")",
";",
"LOGGER",
".",
"severe",
"(",
"\"Created RTP session at \"",
"+",
"localPort",
"+",
"\" to: \"",
"+",
"remoteIpAddress",
"+",
"\" \"",
"+",
"port",
")",
";",
"sendStream",
"=",
"rtpMgrs",
"[",
"i",
"]",
".",
"createSendStream",
"(",
"dataOutput",
",",
"i",
")",
";",
"sendStreams",
".",
"add",
"(",
"sendStream",
")",
";",
"sendStream",
".",
"start",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"LOGGER",
".",
"log",
"(",
"Level",
".",
"WARNING",
",",
"\"exception\"",
",",
"e",
")",
";",
"return",
"e",
".",
"getMessage",
"(",
")",
";",
"}",
"}",
"return",
"null",
";",
"}"
] | Use the RTPManager API to create sessions for each jmf
track of the processor.
@return description | [
"Use",
"the",
"RTPManager",
"API",
"to",
"create",
"sessions",
"for",
"each",
"jmf",
"track",
"of",
"the",
"processor",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/jmf/AudioChannel.java#L341-L406 |
26,895 | igniterealtime/Smack | smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/jmf/AudioChannel.java | AudioChannel.setTrasmit | public void setTrasmit(boolean active) {
for (SendStream sendStream : sendStreams) {
try {
if (active) {
sendStream.start();
LOGGER.fine("START");
}
else {
sendStream.stop();
LOGGER.fine("STOP");
}
}
catch (IOException e) {
LOGGER.log(Level.WARNING, "exception", e);
}
}
} | java | public void setTrasmit(boolean active) {
for (SendStream sendStream : sendStreams) {
try {
if (active) {
sendStream.start();
LOGGER.fine("START");
}
else {
sendStream.stop();
LOGGER.fine("STOP");
}
}
catch (IOException e) {
LOGGER.log(Level.WARNING, "exception", e);
}
}
} | [
"public",
"void",
"setTrasmit",
"(",
"boolean",
"active",
")",
"{",
"for",
"(",
"SendStream",
"sendStream",
":",
"sendStreams",
")",
"{",
"try",
"{",
"if",
"(",
"active",
")",
"{",
"sendStream",
".",
"start",
"(",
")",
";",
"LOGGER",
".",
"fine",
"(",
"\"START\"",
")",
";",
"}",
"else",
"{",
"sendStream",
".",
"stop",
"(",
")",
";",
"LOGGER",
".",
"fine",
"(",
"\"STOP\"",
")",
";",
"}",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"LOGGER",
".",
"log",
"(",
"Level",
".",
"WARNING",
",",
"\"exception\"",
",",
"e",
")",
";",
"}",
"}",
"}"
] | Set transmit activity. If the active is true, the instance should transmit.
If it is set to false, the instance should pause transmit.
@param active active state | [
"Set",
"transmit",
"activity",
".",
"If",
"the",
"active",
"is",
"true",
"the",
"instance",
"should",
"transmit",
".",
"If",
"it",
"is",
"set",
"to",
"false",
"the",
"instance",
"should",
"pause",
"transmit",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/jmf/AudioChannel.java#L414-L431 |
26,896 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/geoloc/GeoLocationManager.java | GeoLocationManager.sendGeolocation | public void sendGeolocation(GeoLocation geoLocation)
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException, NotALeafNodeException {
getNode().publish(new PayloadItem<GeoLocation>(geoLocation));
} | java | public void sendGeolocation(GeoLocation geoLocation)
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException, NotALeafNodeException {
getNode().publish(new PayloadItem<GeoLocation>(geoLocation));
} | [
"public",
"void",
"sendGeolocation",
"(",
"GeoLocation",
"geoLocation",
")",
"throws",
"NoResponseException",
",",
"XMPPErrorException",
",",
"NotConnectedException",
",",
"InterruptedException",
",",
"NotALeafNodeException",
"{",
"getNode",
"(",
")",
".",
"publish",
"(",
"new",
"PayloadItem",
"<",
"GeoLocation",
">",
"(",
"geoLocation",
")",
")",
";",
"}"
] | Send geolocation through the PubSub node.
@param geoLocation
@throws InterruptedException
@throws NotConnectedException
@throws XMPPErrorException
@throws NoResponseException
@throws NotALeafNodeException | [
"Send",
"geolocation",
"through",
"the",
"PubSub",
"node",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/geoloc/GeoLocationManager.java#L105-L108 |
26,897 | igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/geoloc/GeoLocationManager.java | GeoLocationManager.stopPublishingGeolocation | public void stopPublishingGeolocation()
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException, NotALeafNodeException {
GeoLocation emptyGeolocation = new GeoLocation.Builder().build();
getNode().publish(new PayloadItem<GeoLocation>(emptyGeolocation));
} | java | public void stopPublishingGeolocation()
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException, NotALeafNodeException {
GeoLocation emptyGeolocation = new GeoLocation.Builder().build();
getNode().publish(new PayloadItem<GeoLocation>(emptyGeolocation));
} | [
"public",
"void",
"stopPublishingGeolocation",
"(",
")",
"throws",
"NoResponseException",
",",
"XMPPErrorException",
",",
"NotConnectedException",
",",
"InterruptedException",
",",
"NotALeafNodeException",
"{",
"GeoLocation",
"emptyGeolocation",
"=",
"new",
"GeoLocation",
".",
"Builder",
"(",
")",
".",
"build",
"(",
")",
";",
"getNode",
"(",
")",
".",
"publish",
"(",
"new",
"PayloadItem",
"<",
"GeoLocation",
">",
"(",
"emptyGeolocation",
")",
")",
";",
"}"
] | Send empty geolocation through the PubSub node.
@throws InterruptedException
@throws NotConnectedException
@throws XMPPErrorException
@throws NoResponseException
@throws NotALeafNodeException | [
"Send",
"empty",
"geolocation",
"through",
"the",
"PubSub",
"node",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/geoloc/GeoLocationManager.java#L119-L123 |
26,898 | igniterealtime/Smack | smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoService.java | OmemoService.setOmemoStoreBackend | @SuppressWarnings("unused")
public void setOmemoStoreBackend(
OmemoStore<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_Sess, T_Addr, T_ECPub, T_Bundle, T_Ciph> omemoStore) {
if (this.omemoStore != null) {
throw new IllegalStateException("An OmemoStore backend has already been set.");
}
this.omemoStore = omemoStore;
} | java | @SuppressWarnings("unused")
public void setOmemoStoreBackend(
OmemoStore<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_Sess, T_Addr, T_ECPub, T_Bundle, T_Ciph> omemoStore) {
if (this.omemoStore != null) {
throw new IllegalStateException("An OmemoStore backend has already been set.");
}
this.omemoStore = omemoStore;
} | [
"@",
"SuppressWarnings",
"(",
"\"unused\"",
")",
"public",
"void",
"setOmemoStoreBackend",
"(",
"OmemoStore",
"<",
"T_IdKeyPair",
",",
"T_IdKey",
",",
"T_PreKey",
",",
"T_SigPreKey",
",",
"T_Sess",
",",
"T_Addr",
",",
"T_ECPub",
",",
"T_Bundle",
",",
"T_Ciph",
">",
"omemoStore",
")",
"{",
"if",
"(",
"this",
".",
"omemoStore",
"!=",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"An OmemoStore backend has already been set.\"",
")",
";",
"}",
"this",
".",
"omemoStore",
"=",
"omemoStore",
";",
"}"
] | Set an omemoStore as backend. Throws an IllegalStateException, if there is already a backend set.
@param omemoStore store. | [
"Set",
"an",
"omemoStore",
"as",
"backend",
".",
"Throws",
"an",
"IllegalStateException",
"if",
"there",
"is",
"already",
"a",
"backend",
"set",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoService.java#L177-L184 |
26,899 | igniterealtime/Smack | smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoService.java | OmemoService.getOmemoRatchet | protected OmemoRatchet<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_Sess, T_Addr, T_ECPub, T_Bundle, T_Ciph>
getOmemoRatchet(OmemoManager manager) {
OmemoRatchet<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_Sess, T_Addr, T_ECPub, T_Bundle, T_Ciph>
omemoRatchet = omemoRatchets.get(manager);
if (omemoRatchet == null) {
omemoRatchet = instantiateOmemoRatchet(manager, omemoStore);
omemoRatchets.put(manager, omemoRatchet);
}
return omemoRatchet;
} | java | protected OmemoRatchet<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_Sess, T_Addr, T_ECPub, T_Bundle, T_Ciph>
getOmemoRatchet(OmemoManager manager) {
OmemoRatchet<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_Sess, T_Addr, T_ECPub, T_Bundle, T_Ciph>
omemoRatchet = omemoRatchets.get(manager);
if (omemoRatchet == null) {
omemoRatchet = instantiateOmemoRatchet(manager, omemoStore);
omemoRatchets.put(manager, omemoRatchet);
}
return omemoRatchet;
} | [
"protected",
"OmemoRatchet",
"<",
"T_IdKeyPair",
",",
"T_IdKey",
",",
"T_PreKey",
",",
"T_SigPreKey",
",",
"T_Sess",
",",
"T_Addr",
",",
"T_ECPub",
",",
"T_Bundle",
",",
"T_Ciph",
">",
"getOmemoRatchet",
"(",
"OmemoManager",
"manager",
")",
"{",
"OmemoRatchet",
"<",
"T_IdKeyPair",
",",
"T_IdKey",
",",
"T_PreKey",
",",
"T_SigPreKey",
",",
"T_Sess",
",",
"T_Addr",
",",
"T_ECPub",
",",
"T_Bundle",
",",
"T_Ciph",
">",
"omemoRatchet",
"=",
"omemoRatchets",
".",
"get",
"(",
"manager",
")",
";",
"if",
"(",
"omemoRatchet",
"==",
"null",
")",
"{",
"omemoRatchet",
"=",
"instantiateOmemoRatchet",
"(",
"manager",
",",
"omemoStore",
")",
";",
"omemoRatchets",
".",
"put",
"(",
"manager",
",",
"omemoRatchet",
")",
";",
"}",
"return",
"omemoRatchet",
";",
"}"
] | Return the deposited instance of the OmemoRatchet for the given manager.
If there is none yet, create a new one, deposit it and return it.
@param manager OmemoManager we want to have the ratchet for.
@return OmemoRatchet instance | [
"Return",
"the",
"deposited",
"instance",
"of",
"the",
"OmemoRatchet",
"for",
"the",
"given",
"manager",
".",
"If",
"there",
"is",
"none",
"yet",
"create",
"a",
"new",
"one",
"deposit",
"it",
"and",
"return",
"it",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoService.java#L213-L222 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.