5

Libjingle seems very powerful and comes with a bunch of sample programs and extensions. Yet I have not been able to use it, and the people I have talked to on IRC have told me that they found that the API was a mess and I should rather use something else.

But I’m willing to giving it another try. Does anyone have a good tutorial ? Or a good presentation of the different classes, to start ? (Google’s official documentation is not).

qdii
  • 12,505
  • 10
  • 59
  • 116

2 Answers2

1

I just built libjingle. It didn't build out-of-the-box and required some patches (documented on the libjingle site) . And I'm about to do end-to-end tests with it. I'm happy to share things I learn.

auro
  • 1,079
  • 1
  • 10
  • 22
  • can provide information for libjingle document and steps to build it. Thanks in advance. – Deepak Patel Jul 14 '17 at 05:44
  • @Deepak Patel here is complete Developers guide for *libjingle*. You can visit this reference [Google Talk for Developers](https://developers.google.com/talk/libjingle/developer_guide). If you need further assistance then let me know. – Muhammad Usman Bashir Apr 03 '20 at 08:14
1

If you're having build problems, I feel bad for you, son. Because seriously, libjingle is a bitch to get compiled. If you can get it compiled for whatever platform you're building on, then you're 90% of the way there. It's really going to depend on you sitting down on a weekend and plowing through compiler issues one by one. Two quick pointers for Xcode: remove (but do not delete) all the windows-specific shit, and remove all files that have a main method (unittests and mains.)

Once you have it built, the API is actually rather straight-forward. The architecture of a typical libjingle application has several XMPP tasks that run. Some tasks are output tasks that will send out stanzas: http://code.google.com/p/libjingle/source/browse/trunk/talk/examples/call/friendinvitesendtask.cc (look at the Send method) This should be pretty straight-forward. It builds up an XML stanza and queues it up for the XMPPclient to process.

There are also input tasks that process stanzas: http://code.google.com/p/libjingle/source/browse/trunk/talk/examples/call/mucinviterecvtask.cc (look at the HandleStanza method)

While this particular HandleStanza method is a shit-show, the gist of it is that this method is called for all XMPP messages. You first need to determine if you care about it or not:

if (stanza->Name() != QN_MESSAGE) return false;

Then you'll walk through the XML and pull out the info you need and signal parts of your app that care about this.

Of course, there's also the tunneling API, which is substantially more complicated and not really in the scope of a StackOverflow answer. If there's enough interest I can get into this, but I recommend that you first at least set up libjingle and pass around some XMPP messages before you dive into setting up tunnels.

One last pointer about using libjingle: be EXTREMELY careful about threading.

Jieren
  • 1,952
  • 4
  • 18
  • 26