()
| 371 | } |
| 372 | |
| 373 | public void run() { |
| 374 | if (state == IN_ASK) { |
| 375 | try { |
| 376 | file = FileIO.createConnection(filePath + fileName); |
| 377 | os = file.openOutputStream(); |
| 378 | } catch (Exception e) { |
| 379 | decline(); |
| 380 | return; |
| 381 | } |
| 382 | |
| 383 | JabberDataBlock accept = new Iq(jid.toString(), Iq.TYPE_RESULT, id); |
| 384 | |
| 385 | JabberDataBlock si = accept.addChildNs("si", TransferDispatcher.NS_SI); |
| 386 | |
| 387 | JabberDataBlock feature = si.addChildNs("feature", "http://jabber.org/protocol/feature-neg"); |
| 388 | |
| 389 | JabberDataBlock x = feature.addChildNs("x", DiscoForm.NS_XDATA); |
| 390 | x.setTypeAttribute("submit"); |
| 391 | |
| 392 | JabberDataBlock field = x.addChild("field", null); |
| 393 | field.setAttribute("var", "stream-method"); |
| 394 | field.addChild("value", method); |
| 395 | |
| 396 | TransferDispatcher.getInstance().send(accept, false); |
| 397 | |
| 398 | state = HANDSHAKE; |
| 399 | return; |
| 400 | |
| 401 | } |
| 402 | if (method.equals(TransferDispatcher.NS_IBB)) { |
| 403 | byte buf[] = new byte[2048]; |
| 404 | int seq = 0; |
| 405 | try { |
| 406 | while (true) { |
| 407 | int sz = readFile(buf); |
| 408 | if (sz == 0) { |
| 409 | break; |
| 410 | } |
| 411 | JabberDataBlock msg = new Message(jid.toString()); |
| 412 | |
| 413 | JabberDataBlock data = msg.addChildNs("data", TransferDispatcher.NS_IBB); |
| 414 | data.setAttribute("sid", sid); |
| 415 | data.setAttribute("seq", String.valueOf(seq)); |
| 416 | seq++; |
| 417 | data.setText(Strconv.toBase64(buf, sz)); |
| 418 | |
| 419 | JabberDataBlock amp = msg.addChildNs("amp", "http://jabber.org/protocol/amp"); |
| 420 | |
| 421 | JabberDataBlock rule; |
| 422 | |
| 423 | rule = amp.addChild("rule", null); |
| 424 | rule.setAttribute("condition", "deliver-at"); |
| 425 | rule.setAttribute("value", "stored"); |
| 426 | rule.setAttribute("action", "error"); |
| 427 | |
| 428 | rule = amp.addChild("rule", null); |
| 429 | rule.setAttribute("condition", "match-resource"); |
| 430 | rule.setAttribute("value", "exact"); |
nothing calls this directly
no test coverage detected