_id
stringlengths
2
7
title
stringlengths
3
140
partition
stringclasses
3 values
text
stringlengths
73
34.1k
language
stringclasses
1 value
meta_information
dict
q21100
MultiUserChat.revokeVoice
train
public void revokeVoice(Collection<Resourcepart> nicknames) throws XMPPErrorException, NoResponseException, NotConnectedException, InterruptedException { changeRole(nicknames, MUCRole.visitor); }
java
{ "resource": "" }
q21101
MultiUserChat.revokeVoice
train
public void revokeVoice(Resourcepart nickname) throws XMPPErrorException, NoResponseException, NotConnectedException, InterruptedException { changeRole(nickname, MUCRole.visitor, null); }
java
{ "resource": "" }
q21102
MultiUserChat.grantModerator
train
public void grantModerator(Collection<Resourcepart> nicknames) throws XMPPErrorException, NoResponseException, NotConnectedException, InterruptedException { changeRole(nicknames, MUCRole.moderator); }
java
{ "resource": "" }
q21103
MultiUserChat.grantModerator
train
public void grantModerator(Resourcepart nickname) throws XMPPErrorException, NoResponseException, NotConnectedException, InterruptedException { changeRole(nickname, MUCRole.moderator, null); }
java
{ "resource": "" }
q21104
MultiUserChat.grantOwnership
train
public void grantOwnership(Collection<? extends Jid> jids) throws XMPPErrorException, NoResponseException, NotConnectedException, InterruptedException { changeAffiliationByAdmin(jids, MUCAffiliation.owner); }
java
{ "resource": "" }
q21105
MultiUserChat.grantOwnership
train
public void grantOwnership(Jid jid) throws XMPPErrorException, NoResponseException, NotConnectedException, InterruptedException { changeAffiliationByAdmin(jid, MUCAffiliation.owner, null); }
java
{ "resource": "" }
q21106
MultiUserChat.revokeOwnership
train
public void revokeOwnership(Collection<? extends Jid> jids) throws XMPPErrorException, NoResponseException, NotConnectedException, InterruptedException { changeAffiliationByAdmin(jids, MUCAffiliation.admin); }
java
{ "resource": "" }
q21107
MultiUserChat.revokeOwnership
train
public void revokeOwnership(Jid jid) throws XMPPErrorException, NoResponseException, NotConnectedException, InterruptedException { changeAffiliationByAdmin(jid, MUCAffiliation.admin, null); }
java
{ "resource": "" }
q21108
MultiUserChat.grantAdmin
train
public void grantAdmin(Jid jid) throws XMPPErrorException, NoResponseException, NotConnectedException, InterruptedException { changeAffiliationByAdmin(jid, MUCAffiliation.admin); }
java
{ "resource": "" }
q21109
MultiUserChat.revokeAdmin
train
public void revokeAdmin(EntityJid jid) throws XMPPErrorException, NoResponseException, NotConnectedException, InterruptedException { changeAffiliationByAdmin(jid, MUCAffiliation.member); }
java
{ "resource": "" }
q21110
MultiUserChat.changeSubject
train
public void changeSubject(final String subject) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { Message message = createMessage(); message.setSubject(subject); // Wait for an error or confirmation message back from the server. StanzaFilter re...
java
{ "resource": "" }
q21111
MultiUserChat.checkPresenceCode
train
private void checkPresenceCode( Set<Status> statusCodes, boolean isUserModification, MUCUser mucUser, EntityFullJid from) { // Check if an occupant was kicked from the room if (statusCodes.contains(Status.KICKED_307)) { // Check if this occupant was kicked ...
java
{ "resource": "" }
q21112
ReferenceElement.addMention
train
public static void addMention(Stanza stanza, int begin, int end, BareJid jid) { URI uri; try { uri = new URI("xmpp:" + jid.toString()); } catch (URISyntaxException e) { throw new AssertionError("Cannot create URI from bareJid."); } ReferenceElement referen...
java
{ "resource": "" }
q21113
ReferenceElement.getReferencesFromStanza
train
public static List<ReferenceElement> getReferencesFromStanza(Stanza stanza) { List<ReferenceElement> references = new ArrayList<>(); List<ExtensionElement> extensions = stanza.getExtensions(ReferenceElement.ELEMENT, ReferenceManager.NAMESPACE); for (ExtensionElement e : extensions) { ...
java
{ "resource": "" }
q21114
AMPExpireAtCondition.isSupported
train
public static boolean isSupported(XMPPConnection connection) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { return AMPManager.isConditionSupported(connection, NAME); }
java
{ "resource": "" }
q21115
OriginIdElement.addOriginId
train
public static OriginIdElement addOriginId(Message message) { OriginIdElement originId = new OriginIdElement(); message.addExtension(originId); // TODO: Find solution to have both the originIds stanzaId and a nice to look at incremental stanzaID. // message.setStanzaId(originId.getId()); ...
java
{ "resource": "" }
q21116
OriginIdElement.getOriginId
train
public static OriginIdElement getOriginId(Message message) { return message.getExtension(OriginIdElement.ELEMENT, StableUniqueStanzaIdManager.NAMESPACE); }
java
{ "resource": "" }
q21117
SharedGroupManager.getSharedGroups
train
public static List<String> getSharedGroups(XMPPConnection connection) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { // Discover the shared groups of the logged user SharedGroupsInfo info = new SharedGroupsInfo(); info.setType(IQ.Type.get); ...
java
{ "resource": "" }
q21118
ProviderManager.getIQProviders
train
public static List<IQProvider<IQ>> getIQProviders() { List<IQProvider<IQ>> providers = new ArrayList<>(iqProviders.size()); providers.addAll(iqProviders.values()); return providers; }
java
{ "resource": "" }
q21119
ProviderManager.addExtensionProvider
train
@SuppressWarnings("unchecked") public static void addExtensionProvider(String elementName, String namespace, Object provider) { validate(elementName, namespace); // First remove existing providers String key = removeExtensionProvider(elementName, namespace); if (provider ...
java
{ "resource": "" }
q21120
ProviderManager.getExtensionProviders
train
public static List<ExtensionElementProvider<ExtensionElement>> getExtensionProviders() { List<ExtensionElementProvider<ExtensionElement>> providers = new ArrayList<>(extensionProviders.size()); providers.addAll(extensionProviders.values()); return providers; }
java
{ "resource": "" }
q21121
Bookmarks.toXML
train
@Override public XmlStringBuilder toXML() { XmlStringBuilder buf = new XmlStringBuilder(); buf.halfOpenElement(ELEMENT).xmlnsAttribute(NAMESPACE).rightAngleBracket(); for (BookmarkedURL urlStorage : getBookmarkedURLS()) { if (urlStorage.isShared()) { continue; ...
java
{ "resource": "" }
q21122
Jingle.addContents
train
public void addContents(final List<JingleContent> contentList) { if (contentList != null) { synchronized (contents) { contents.addAll(contentList); } } }
java
{ "resource": "" }
q21123
Jingle.getSessionHash
train
public static int getSessionHash(final String sid, final Jid initiator) { final int PRIME = 31; int result = 1; result = PRIME * result + (initiator == null ? 0 : initiator.hashCode()); result = PRIME * result + (sid == null ? 0 : sid.hashCode()); return result; }
java
{ "resource": "" }
q21124
Jingle.getIQChildElementBuilder
train
@Override protected IQChildElementXmlStringBuilder getIQChildElementBuilder(IQChildElementXmlStringBuilder buf) { if (getInitiator() != null) { buf.append(" initiator=\"").append(getInitiator()).append('"'); } if (getResponder() != null) { buf.append(" responder=\"")....
java
{ "resource": "" }
q21125
MamManager.isSupported
train
public boolean isSupported() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { // Note that this may return 'null' but SDM's supportsFeature() does the right thing™ then. Jid archiveAddress = getArchiveAddress(); return serviceDiscoveryManager.supports...
java
{ "resource": "" }
q21126
MamManager.retrieveArchivingPreferences
train
public MamPrefsResult retrieveArchivingPreferences() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException, NotLoggedInException { MamPrefsIQ mamPrefIQ = new MamPrefsIQ(); return queryMamPrefs(mamPrefIQ); }
java
{ "resource": "" }
q21127
Affiliation.isAffiliationModification
train
public boolean isAffiliationModification() { if (jid != null && affiliation != null) { assert (node == null && namespace == AffiliationNamespace.owner); return true; } return false; }
java
{ "resource": "" }
q21128
PubSubManager.createNode
train
public LeafNode createNode() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { PubSub reply = sendPubsubPacket(Type.set, new NodeExtension(PubSubElementType.CREATE), null); NodeExtension elem = reply.getExtension("create", PubSubNamespace.basic.getXmlns()); ...
java
{ "resource": "" }
q21129
PubSubManager.createNode
train
public LeafNode createNode(String nodeId) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { return (LeafNode) createNode(nodeId, null); }
java
{ "resource": "" }
q21130
PubSubManager.createNode
train
public Node createNode(String nodeId, Form config) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { PubSub request = PubSub.createPubsubPacket(pubSubService, Type.set, new NodeExtension(PubSubElementType.CREATE, nodeId)); boolean isLeafNode = true; i...
java
{ "resource": "" }
q21131
PubSubManager.getNode
train
public Node getNode(String id) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException, NotAPubSubNodeException { Node node = nodeMap.get(id); if (node == null) { DiscoverInfo info = new DiscoverInfo(); info.setTo(pubSubService); i...
java
{ "resource": "" }
q21132
PubSubManager.getOrCreateLeafNode
train
public LeafNode getOrCreateLeafNode(final String id) throws NoResponseException, NotConnectedException, InterruptedException, XMPPErrorException, NotALeafNodeException { try { return getLeafNode(id); } catch (NotAPubSubNodeException e) { return createN...
java
{ "resource": "" }
q21133
PubSubManager.getLeafNode
train
public LeafNode getLeafNode(String id) throws NotALeafNodeException, NoResponseException, NotConnectedException, InterruptedException, XMPPErrorException, NotAPubSubNodeException { Node node; try { node = getNode(id); } catch (XMPPErrorException e) { ...
java
{ "resource": "" }
q21134
PubSubManager.discoverNodes
train
public DiscoverItems discoverNodes(String nodeId) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { DiscoverItems items = new DiscoverItems(); if (nodeId != null) items.setNode(nodeId); items.setTo(pubSubService); DiscoverItems nod...
java
{ "resource": "" }
q21135
PubSubManager.getSubscriptions
train
public List<Subscription> getSubscriptions() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { Stanza reply = sendPubsubPacket(Type.get, new NodeExtension(PubSubElementType.SUBSCRIPTIONS), null); SubscriptionsExtension subElem = reply.getExtension(PubSubElemen...
java
{ "resource": "" }
q21136
PubSubManager.getAffiliations
train
public List<Affiliation> getAffiliations() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { PubSub reply = sendPubsubPacket(Type.get, new NodeExtension(PubSubElementType.AFFILIATIONS), null); AffiliationsExtension listElem = reply.getExtension(PubSubElementTy...
java
{ "resource": "" }
q21137
PubSubManager.deleteNode
train
public boolean deleteNode(String nodeId) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { boolean res = true; try { sendPubsubPacket(Type.set, new NodeExtension(PubSubElementType.DELETE, nodeId), PubSubElementType.DELETE.getNamespace()); }...
java
{ "resource": "" }
q21138
PubSubManager.getDefaultConfiguration
train
public ConfigureForm getDefaultConfiguration() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { // Errors will cause exceptions in getReply, so it only returns // on success. PubSub reply = sendPubsubPacket(Type.get, new NodeExtension(PubSubElementTyp...
java
{ "resource": "" }
q21139
PubSubManager.supportsAutomaticNodeCreation
train
public boolean supportsAutomaticNodeCreation() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { ServiceDiscoveryManager sdm = ServiceDiscoveryManager.getInstanceFor(connection()); return sdm.supportsFeature(pubSubService, AUTO_CREATE_FEATU...
java
{ "resource": "" }
q21140
PubSubManager.getPubSubService
train
public static DomainBareJid getPubSubService(XMPPConnection connection) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { return ServiceDiscoveryManager.getInstanceFor(connection).findService(PubSub.NAMESPACE, ...
java
{ "resource": "" }
q21141
TransportResolver.triggerCandidateAdded
train
protected void triggerCandidateAdded(TransportCandidate cand) throws NotConnectedException, InterruptedException { Iterator<TransportResolverListener> iter = getListenersList().iterator(); while (iter.hasNext()) { TransportResolverListener trl = iter.next(); if (trl instanceof Tr...
java
{ "resource": "" }
q21142
TransportResolver.triggerResolveInit
train
private void triggerResolveInit() { Iterator<TransportResolverListener> iter = getListenersList().iterator(); while (iter.hasNext()) { TransportResolverListener trl = iter.next(); if (trl instanceof TransportResolverListener.Resolver) { TransportResolverListener.R...
java
{ "resource": "" }
q21143
TransportResolver.triggerResolveEnd
train
private void triggerResolveEnd() { Iterator<TransportResolverListener> iter = getListenersList().iterator(); while (iter.hasNext()) { TransportResolverListener trl = iter.next(); if (trl instanceof TransportResolverListener.Resolver) { TransportResolverListener.Re...
java
{ "resource": "" }
q21144
TransportResolver.addCandidate
train
protected void addCandidate(TransportCandidate cand) throws NotConnectedException, InterruptedException { synchronized (candidates) { if (!candidates.contains(cand)) candidates.add(cand); } // Notify the listeners triggerCandidateAdded(cand); }
java
{ "resource": "" }
q21145
TransportResolver.getPreferredCandidate
train
public TransportCandidate getPreferredCandidate() { TransportCandidate result = null; ArrayList<ICECandidate> cands = new ArrayList<>(); for (TransportCandidate tpcan : getCandidatesList()) { if (tpcan instanceof ICECandidate) cands.add((ICECandidate) tpcan); ...
java
{ "resource": "" }
q21146
TransportResolver.getCandidate
train
public TransportCandidate getCandidate(int i) { TransportCandidate cand; synchronized (candidates) { cand = candidates.get(i); } return cand; }
java
{ "resource": "" }
q21147
TransportResolver.initializeAndWait
train
public void initializeAndWait() throws XMPPException, SmackException, InterruptedException { this.initialize(); try { LOGGER.fine("Initializing transport resolver..."); while (!this.isInitialized()) { LOGGER.fine("Resolver init still pending"); Thr...
java
{ "resource": "" }
q21148
DNSResolver.lookupSRVRecords
train
public final List<SRVRecord> lookupSRVRecords(DnsName name, List<HostAddress> failedAddresses, DnssecMode dnssecMode) { checkIfDnssecRequestedAndSupported(dnssecMode); return lookupSRVRecords0(name, failedAddresses, dnssecMode); }
java
{ "resource": "" }
q21149
DiscussionHistory.getMUCHistory
train
MUCInitialPresence.History getMUCHistory() { // Return null if the history was not properly configured if (!isConfigured()) { return null; } return new MUCInitialPresence.History(maxChars, maxStanzas, seconds, since); }
java
{ "resource": "" }
q21150
ToMatchesFilter.create
train
public static ToMatchesFilter create(Jid address) { return new ToMatchesFilter(address, address != null ? address.hasNoResource() : false) ; }
java
{ "resource": "" }
q21151
AudioMediaSession.createSession
train
public static MediaSession createSession(String localhost, int localPort, String remoteHost, int remotePort, MediaSessionListener eventHandler, int quality, boolean secure, boolean micOn) throws NoProcessorException, UnsupportedFormatException, IOException, GeneralSecurityException { SpeexFormat.setFramesPerPa...
java
{ "resource": "" }
q21152
AudioMediaSession.startTransmit
train
@Override public void startTransmit() { try { LOGGER.fine("start"); mediaSession.start(true); this.mediaReceived(""); } catch (IOException e) { LOGGER.log(Level.WARNING, "exception", e); } }
java
{ "resource": "" }
q21153
AbstractHttpOverXmppProvider.parseHeaders
train
protected HeadersExtension parseHeaders(XmlPullParser parser) throws IOException, XmlPullParserException, SmackParsingException { HeadersExtension headersExtension = null; /* We are either at start of headers, start of data or end of req/res */ if (parser.next() == XmlPullParser.START_TAG && par...
java
{ "resource": "" }
q21154
AbstractHttpOverXmppProvider.parseData
train
protected AbstractHttpOverXmpp.Data parseData(XmlPullParser parser) throws XmlPullParserException, IOException { NamedElement child = null; boolean done = false; AbstractHttpOverXmpp.Data data = null; /* We are either at start of data or end of req/res */ if (parser.getEventType(...
java
{ "resource": "" }
q21155
MultiMediaManager.getPayloads
train
@Override public List<PayloadType> getPayloads() { List<PayloadType> list = new ArrayList<>(); if (preferredPayloadType != null) list.add(preferredPayloadType); for (JingleMediaManager manager : managers) { for (PayloadType payloadType : manager.getPayloads()) { i...
java
{ "resource": "" }
q21156
JingleManager.isServiceEnabled
train
public static boolean isServiceEnabled(XMPPConnection connection, Jid userID) throws XMPPException, SmackException, InterruptedException { return ServiceDiscoveryManager.getInstanceFor(connection).supportsFeature(userID, Jingle.NAMESPACE); }
java
{ "resource": "" }
q21157
JingleManager.addJingleSessionRequestListener
train
public synchronized void addJingleSessionRequestListener(final JingleSessionRequestListener jingleSessionRequestListener) { if (jingleSessionRequestListener != null) { if (jingleSessionRequestListeners == null) { initJingleSessionRequestListeners(); } synchron...
java
{ "resource": "" }
q21158
JingleManager.triggerSessionCreated
train
public void triggerSessionCreated(JingleSession jingleSession) { jingleSessions.add(jingleSession); jingleSession.addListener(this); for (CreatedJingleSessionListener createdJingleSessionListener : creationListeners) { try { createdJingleSessionListener.sessionCreated...
java
{ "resource": "" }
q21159
JingleManager.initJingleSessionRequestListeners
train
private void initJingleSessionRequestListeners() { StanzaFilter initRequestFilter = new StanzaFilter() { // Return true if we accept this packet @Override public boolean accept(Stanza pin) { if (pin instanceof IQ) { IQ iq = (IQ) pin; ...
java
{ "resource": "" }
q21160
JingleManager.disconnectAllSessions
train
public void disconnectAllSessions() { List<JingleSession> sessions = jingleSessions.subList(0, jingleSessions.size()); for (JingleSession jingleSession : sessions) try { jingleSession.terminate(); } catch (Exception e) { LOGGER.log(Level.WARNING,...
java
{ "resource": "" }
q21161
JingleManager.triggerSessionRequested
train
void triggerSessionRequested(Jingle initJin) { JingleSessionRequestListener[] jingleSessionRequestListeners; // Make a synchronized copy of the listenerJingles synchronized (this.jingleSessionRequestListeners) { jingleSessionRequestListeners = new JingleSessionRequestListener[this....
java
{ "resource": "" }
q21162
JingleManager.createOutgoingJingleSession
train
public JingleSession createOutgoingJingleSession(EntityFullJid responder) throws XMPPException { JingleSession session = new JingleSession(connection, null, connection.getUser(), responder, jingleMediaManagers); triggerSessionCreated(session); return session; }
java
{ "resource": "" }
q21163
JingleManager.createIncomingJingleSession
train
public JingleSession createIncomingJingleSession(JingleSessionRequest request) throws XMPPException { if (request == null) { throw new NullPointerException("Received request cannot be null"); } JingleSession session = new JingleSession(connection, request, request.getFrom(), connect...
java
{ "resource": "" }
q21164
JingleManager.getSession
train
public JingleSession getSession(String jid) { for (JingleSession jingleSession : jingleSessions) { if (jingleSession.getResponder().equals(jid)) { return jingleSession; } } return null; }
java
{ "resource": "" }
q21165
OmemoFingerprint.blocksOf8Chars
train
public String blocksOf8Chars() { StringBuilder pretty = new StringBuilder(); for (int i = 0; i < 8; i++) { if (i != 0) pretty.append(' '); pretty.append(this.fingerprintString.substring(8 * i, 8 * (i + 1))); } return pretty.toString(); }
java
{ "resource": "" }
q21166
IoTDataManager.getInstanceFor
train
public static synchronized IoTDataManager getInstanceFor(XMPPConnection connection) { IoTDataManager manager = INSTANCES.get(connection); if (manager == null) { manager = new IoTDataManager(connection); INSTANCES.put(connection, manager); } return manager; }
java
{ "resource": "" }
q21167
IoTDataManager.requestMomentaryValuesReadOut
train
public List<IoTFieldsExtension> requestMomentaryValuesReadOut(EntityFullJid jid) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { final XMPPConnection connection = connection(); final int seqNr = nextSeqNr.incrementAndGet(); IoTDat...
java
{ "resource": "" }
q21168
BlockingCommandManager.getInstanceFor
train
public static synchronized BlockingCommandManager getInstanceFor(XMPPConnection connection) { BlockingCommandManager blockingCommandManager = INSTANCES.get(connection); if (blockingCommandManager == null) { blockingCommandManager = new BlockingCommandManager(connection); INSTANC...
java
{ "resource": "" }
q21169
BlockingCommandManager.getBlockList
train
public List<Jid> getBlockList() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { if (blockListCached == null) { BlockListIQ blockListIQ = new BlockListIQ(); BlockListIQ blockListIQResult = connection().createStanzaCollectorAndSend...
java
{ "resource": "" }
q21170
BlockingCommandManager.blockContacts
train
public void blockContacts(List<Jid> jids) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { BlockContactsIQ blockContactIQ = new BlockContactsIQ(jids); connection().createStanzaCollectorAndSend(blockContactIQ).nextResultOrThrow(); }
java
{ "resource": "" }
q21171
BlockingCommandManager.unblockContacts
train
public void unblockContacts(List<Jid> jids) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { UnblockContactsIQ unblockContactIQ = new UnblockContactsIQ(jids); connection().createStanzaCollectorAndSend(unblockContactIQ).nextResultOrThrow(); }
java
{ "resource": "" }
q21172
BlockingCommandManager.unblockAll
train
public void unblockAll() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { UnblockContactsIQ unblockContactIQ = new UnblockContactsIQ(); connection().createStanzaCollectorAndSend(unblockContactIQ).nextResultOrThrow(); }
java
{ "resource": "" }
q21173
RemoteCommand.execute
train
public void execute(Form form) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { executeAction(Action.execute, form); }
java
{ "resource": "" }
q21174
AudioReceiver.controllerUpdate
train
@Override public synchronized void controllerUpdate(ControllerEvent ce) { Player p = (Player) ce.getSourceController(); if (p == null) return; // Get this when the internal players are realized. if (ce instanceof RealizeCompleteEvent) { p.start(); }...
java
{ "resource": "" }
q21175
HashManager.addAlgorithmsToFeatures
train
public void addAlgorithmsToFeatures(List<ALGORITHM> algorithms) { ServiceDiscoveryManager sdm = ServiceDiscoveryManager.getInstanceFor(connection()); for (ALGORITHM algo : algorithms) { sdm.addFeature(asFeature(algo)); } }
java
{ "resource": "" }
q21176
HashManager.getInstanceFor
train
public static synchronized HashManager getInstanceFor(XMPPConnection connection) { HashManager hashManager = INSTANCES.get(connection); if (hashManager == null) { hashManager = new HashManager(connection); INSTANCES.put(connection, hashManager); } return hashManag...
java
{ "resource": "" }
q21177
FileTransferManager.createOutgoingFileTransfer
train
public OutgoingFileTransfer createOutgoingFileTransfer(EntityFullJid userID) { // We need to create outgoing file transfers with a full JID since this method will later // use XEP-0095 to negotiate the stream. This is done with IQ stanzas that need to be addressed to a full JID // in order to re...
java
{ "resource": "" }
q21178
FileTransferManager.createIncomingFileTransfer
train
protected IncomingFileTransfer createIncomingFileTransfer( FileTransferRequest request) { if (request == null) { throw new NullPointerException("ReceiveRequest cannot be null"); } IncomingFileTransfer transfer = new IncomingFileTransfer(request, fileTrans...
java
{ "resource": "" }
q21179
Offer.accept
train
public void accept() throws NotConnectedException, InterruptedException { Stanza acceptPacket = new AcceptPacket(this.session.getWorkgroupJID()); connection.sendStanza(acceptPacket); // TODO: listen for a reply. accepted = true; }
java
{ "resource": "" }
q21180
Offer.reject
train
public void reject() throws NotConnectedException, InterruptedException { RejectPacket rejectPacket = new RejectPacket(this.session.getWorkgroupJID()); connection.sendStanza(rejectPacket); // TODO: listen for a reply. rejected = true; }
java
{ "resource": "" }
q21181
MessageEvent.toXML
train
@Override public String toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { StringBuilder buf = new StringBuilder(); buf.append('<').append(getElementName()).append(" xmlns=\"").append(getNamespace()).append( "\">"); // Note: Cancellation events don't specify...
java
{ "resource": "" }
q21182
DirectoryRosterStore.init
train
public static DirectoryRosterStore init(final File baseDir) { DirectoryRosterStore store = new DirectoryRosterStore(baseDir); if (store.setRosterVersion("")) { return store; } else { return null; } }
java
{ "resource": "" }
q21183
DirectoryRosterStore.open
train
public static DirectoryRosterStore open(final File baseDir) { DirectoryRosterStore store = new DirectoryRosterStore(baseDir); String s = FileUtils.readFile(store.getVersionFile()); if (s != null && s.startsWith(STORE_ID + "\n")) { return store; } else { re...
java
{ "resource": "" }
q21184
BoBHash.fromSrc
train
public static BoBHash fromSrc(String src) { String hashType = src.substring(src.lastIndexOf("cid:") + 4, src.indexOf("+")); String hash = src.substring(src.indexOf("+") + 1, src.indexOf("@bob.xmpp.org")); return new BoBHash(hash, hashType); }
java
{ "resource": "" }
q21185
BoBHash.fromCid
train
public static BoBHash fromCid(String cid) { String hashType = cid.substring(0, cid.indexOf("+")); String hash = cid.substring(cid.indexOf("+") + 1, cid.indexOf("@bob.xmpp.org")); return new BoBHash(hash, hashType); }
java
{ "resource": "" }
q21186
RosterUtil.preApproveSubscriptionIfRequiredAndPossible
train
public static void preApproveSubscriptionIfRequiredAndPossible(Roster roster, BareJid jid) throws NotLoggedInException, NotConnectedException, InterruptedException { if (!roster.isSubscriptionPreApprovalSupported()) { return; } RosterEntry entry = roster.getEntry(jid); ...
java
{ "resource": "" }
q21187
BridgedTransportManager.createResolver
train
@Override protected TransportResolver createResolver(JingleSession session) { BridgedResolver bridgedResolver = new BridgedResolver(this.xmppConnection); return bridgedResolver; }
java
{ "resource": "" }
q21188
DNSUtil.sortSRVRecords
train
private static List<HostAddress> sortSRVRecords(List<SRVRecord> records) { // RFC 2782, Usage rules: "If there is precisely one SRV RR, and its Target is "." // (the root domain), abort." if (records.size() == 1 && records.get(0).getFQDN().isRootLabel()) return Collections.emptyList(...
java
{ "resource": "" }
q21189
FileUtils.getClassLoaders
train
public static List<ClassLoader> getClassLoaders() { ClassLoader[] classLoaders = new ClassLoader[2]; classLoaders[0] = FileUtils.class.getClassLoader(); classLoaders[1] = Thread.currentThread().getContextClassLoader(); // Clean up possible null values. Note that #getClassLoader may retu...
java
{ "resource": "" }
q21190
FileUtils.readFileOrThrow
train
@SuppressWarnings("DefaultCharset") public static String readFileOrThrow(File file) throws IOException { try (Reader reader = new FileReader(file)) { char[] buf = new char[8192]; int len; StringBuilder s = new StringBuilder(); while ((len = reader.read(buf)) >...
java
{ "resource": "" }
q21191
OfferRequestProvider.parse
train
@Override public OfferRequestPacket parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException { int eventType = parser.getEventType(); String sessionID = null; int timeout = -1; OfferContent content ...
java
{ "resource": "" }
q21192
ReconnectionManager.getInstanceFor
train
public static synchronized ReconnectionManager getInstanceFor(AbstractXMPPConnection connection) { ReconnectionManager reconnectionManager = INSTANCES.get(connection); if (reconnectionManager == null) { reconnectionManager = new ReconnectionManager(connection); INSTANCES.put(conn...
java
{ "resource": "" }
q21193
ReconnectionManager.enableAutomaticReconnection
train
public synchronized void enableAutomaticReconnection() { if (automaticReconnectEnabled) { return; } XMPPConnection connection = weakRefConnection.get(); if (connection == null) { throw new IllegalStateException("Connection instance no longer available"); }...
java
{ "resource": "" }
q21194
ReconnectionManager.disableAutomaticReconnection
train
public synchronized void disableAutomaticReconnection() { if (!automaticReconnectEnabled) { return; } XMPPConnection connection = weakRefConnection.get(); if (connection == null) { throw new IllegalStateException("Connection instance no longer available"); ...
java
{ "resource": "" }
q21195
ReconnectionManager.reconnect
train
private synchronized void reconnect() { XMPPConnection connection = this.weakRefConnection.get(); if (connection == null) { LOGGER.fine("Connection is null, will not reconnect"); return; } // Since there is no thread running, creates a new one to attempt /...
java
{ "resource": "" }
q21196
MultiMap.remove
train
public List<V> remove(K key, int num) { List<V> values = map.get(key); if (values == null) { return Collections.emptyList(); } final int resultSize = values.size() > num ? num : values.size(); final List<V> result = new ArrayList<>(resultSize); for (int i = 0...
java
{ "resource": "" }
q21197
MultiMap.values
train
public List<V> values() { List<V> values = new ArrayList<>(size()); for (List<V> list : map.values()) { values.addAll(list); } return values; }
java
{ "resource": "" }
q21198
ScreenShareSession.initialize
train
@Override public void initialize() { JingleSession session = getJingleSession(); if (session != null && session.getInitiator().equals(session.getConnection().getUser())) { // If the initiator of the jingle session is us then we transmit a screen share. try { ...
java
{ "resource": "" }
q21199
SpoilerElement.addSpoiler
train
public static void addSpoiler(Message message, String hint) { message.addExtension(new SpoilerElement(null, hint)); }
java
{ "resource": "" }