MCPcopy Create free account
hub / github.com/BombusMod/BombusMod / sendInit

Method sendInit

src/main/java/io/file/transfer/TransferTask.java:281–312  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

279 }
280
281 void sendInit() {
282 started = System.currentTimeMillis();
283 if (state == ERROR) {
284 return;
285 }
286
287 JabberDataBlock iq = new Iq(jid.toString(), Iq.TYPE_SET, sid);
288
289 JabberDataBlock si = iq.addChildNs("si", TransferDispatcher.NS_SI);
290 si.setAttribute("id", sid);
291 si.setAttribute("mime-type", "text/plain");
292 si.setAttribute("profile", "http://jabber.org/protocol/si/profile/file-transfer");
293
294 JabberDataBlock f = si.addChildNs("file", "http://jabber.org/protocol/si/profile/file-transfer");
295 f.setAttribute("name", fileName);
296 f.setAttribute("size", String.valueOf(fileSize));
297
298 f.addChild("desc", description);
299
300 JabberDataBlock feature = si.addChildNs("feature", "http://jabber.org/protocol/feature-neg");
301
302 JabberDataBlock x = feature.addChildNs("x", DiscoForm.NS_XDATA);
303 x.setTypeAttribute("form");
304
305 JabberDataBlock field = x.addChild("field", null);
306 field.setTypeAttribute("list-single");
307 field.setAttribute("var", "stream-method");
308 // field.addChild("option", null).addChild("value", TransferDispatcher.NS_BYTESTREAMS);
309 field.addChild("option", null).addChild("value", TransferDispatcher.NS_IBB);
310 TransferDispatcher.getInstance().send(iq, true);
311
312 }
313
314 void initIBB() {
315 method = TransferDispatcher.NS_IBB;

Callers 1

sendFileMethod · 0.80

Calls 7

addChildNsMethod · 0.95
setAttributeMethod · 0.95
addChildMethod · 0.95
setTypeAttributeMethod · 0.95
getInstanceMethod · 0.95
toStringMethod · 0.45
sendMethod · 0.45

Tested by

no test coverage detected