[guardian-dev] Gibberbot Smack XMPPConnection

Miron c1.android at niftybox.net
Thu Jun 20 21:47:26 EDT 2013


Leonid,

Note that we are working on a secure transfer mechanism wrapped inside
OTR.  See https://github.com/guardianproject/Gibberbot/pulls/210

On 06/17/2013 07:20 AM, Leonid Verhovskij wrote:
> Hi,
> 
> i am trying to integrate file transfer into Gibberbot.
> 
> I already tested File transfer with Android-Smack lib successful with
> the following code in my test app:
> 
>         // Create the file transfer manager
>         new ServiceDiscoveryManager(mConnections.get(0).connection);
>         //mConnections.get(0).connection is XMPPConnection from Smack
> Lib here
>         // FileTransferNegotiator.setServiceEnabled(connection, true);
>         FileTransferManager manager = new FileTransferManager(
>                 mConnections.get(0).connection);
>         // FileTransferNegotiator.setServiceEnabled(connection, true);
> 
>         OutgoingFileTransfer transfer =
> manager.createOutgoingFileTransfer(user
>                 + "/office"); //Hardcoded for testing purpose only
> 
>         File file = new File(getRealPathFromURI(selectedImage));
> 
>         try {
>             transfer.sendFile(file, "Image");
>         } catch (XMPPException e) {
>             e.printStackTrace();
>         }
>         while (!transfer.isDone()) {
>             if (transfer.getStatus().equals(Status.error)) {
>                 System.out.println("ERROR!!! " + transfer.getError());
>             } else if (transfer.getStatus().equals(Status.cancelled)
>                     || transfer.getStatus().equals(Status.refused)) {
>                 System.out.println("Cancelled!!! " + transfer.getError());
>             }
>             try {
>                 Thread.sleep(1000L);
> 
>                 Log.i("transfer file",
>                         "sending file status :- " + transfer.getStatus()
> + " "
>                                 + "progress:-" + transfer.getProgress());
> 
>             } catch (InterruptedException e) {
>                 e.printStackTrace();
>             }
>         }
>         if (transfer.getStatus().equals(Status.refused)
>                 || transfer.getStatus().equals(Status.error)
>                 || transfer.getStatus().equals(Status.cancelled)) {
>             System.out
>                     .println("refused cancelled error " +
> transfer.getError());
>         } else {
>             System.out.println("Success");
>         }
> 
> As you can see i use XMPPConnection from Smack Lib, how can i get it in
> Gibberbot?
> I try to integrate it in
> /info/guardianproject/otr/app/im/app/NewChatActivity.java
> 
> Thanks for advice.
> _______________________________________________
> Guardian-dev mailing list
> 
> Post: Guardian-dev at lists.mayfirst.org
> List info: https://lists.mayfirst.org/mailman/listinfo/guardian-dev
> 
> To Unsubscribe
>         Send email to:  Guardian-dev-unsubscribe at lists.mayfirst.org
>         Or visit: https://lists.mayfirst.org/mailman/options/guardian-dev/c1.android%40niftybox.net
> 
> You are subscribed as: c1.android at niftybox.net
> 



More information about the Guardian-dev mailing list