xfirelib 0.1 review

Download
by rbytes.net on

xfirelib is a xfire protocol library created in C++. Just a small tutorial to guide you through the first steps … Connec

License: GPL (GNU General Public License)
File size: 0K
Developer: Herbert Poul and Beat Wolf
0 stars award from rbytes.net

xfirelib is a xfire protocol library created in C++.

Just a small tutorial to guide you through the first steps …

Connecting

xfirelib::Client *client = new xfirelib::Client();
client->connect("username","password");
client->addPacketListener( new MyOwnXFirePacketListener() );
This will allow you to log into an xfire account. after this you should be able to send and receive packets.

Listener

xfirelib uses a event/listener approach to let you know of new packets. so you need to subclass PacketListener:

class MyOwnXFirePacketListener : public xfirelib::PacketListener {
virtual void receivedPacket( xfirelib::XFirePacket *packet );
};
an implementation might look like:
void MyOwnXFirePacketListener::receivedPacket( xfirelib::XFirePacket *packet ) {
// First retrieve the packet content ...
xfirelib::XFirePacketContent *content = packet->getContent();
// Now see what kind of packet it actually is...
switch(content->getPacketId()) {
case XFIRE_MESSAGE_ID:
// we got a message.. but by whom ? let's look into our buddylist
xfirelib::BuddyListEntry buddy = client->getBuddyList()->getBuddyBySid( ((xfirelib::MessagePacket*)content)->getSid() );
std::cout

xfirelib 0.1 search tags