()
| 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; |
no test coverage detected