WockyContactFactory

WockyContactFactory — creates and looks up WockyContact objects

Synopsis

#include <wocky/wocky-contact-factory.h>

                    WockyContactFactory;
                    WockyContactFactoryClass;
                    WockyContactFactoryPrivate;
WockyContactFactory * wocky_contact_factory_new         (void);
WockyBareContact *  wocky_contact_factory_ensure_bare_contact
                                                        (WockyContactFactory *factory,
                                                         const gchar *bare_jid);
WockyBareContact *  wocky_contact_factory_lookup_bare_contact
                                                        (WockyContactFactory *factory,
                                                         const gchar *bare_jid);
WockyResourceContact * wocky_contact_factory_ensure_resource_contact
                                                        (WockyContactFactory *factory,
                                                         const gchar *full_jid);
WockyResourceContact * wocky_contact_factory_lookup_resource_contact
                                                        (WockyContactFactory *factory,
                                                         const gchar *full_jid);

Object Hierarchy

  GObject
   +----WockyContactFactory

Signals

  "bare-contact-added"                             : Run Last
  "resource-contact-added"                         : Run Last

Description

Provides a way to create WockyContact objects. The objects created this way are cached by the factory and you can eventually look them up without creating them again.

Details

WockyContactFactory

typedef struct _WockyContactFactory WockyContactFactory;


WockyContactFactoryClass

typedef struct {
  GObjectClass parent_class;
} WockyContactFactoryClass;


WockyContactFactoryPrivate

typedef struct _WockyContactFactoryPrivate WockyContactFactoryPrivate;


wocky_contact_factory_new ()

WockyContactFactory * wocky_contact_factory_new         (void);

Convenience function to create a new WockyContactFactory object.

Returns :

a newly created instance of WockyContactFactory

wocky_contact_factory_ensure_bare_contact ()

WockyBareContact *  wocky_contact_factory_ensure_bare_contact
                                                        (WockyContactFactory *factory,
                                                         const gchar *bare_jid);

Returns an instance of WockyBareContact for bare_jid. The factory cache is used, but if the contact is not found in the cache, a new WockyBareContact is created and cached for future use.

factory :

a WockyContactFactory instance

bare_jid :

the JID of a bare contact

Returns :

a new reference to a WockyBareContact instance, which the caller is expected to release with g_object_unref() after use.

wocky_contact_factory_lookup_bare_contact ()

WockyBareContact *  wocky_contact_factory_lookup_bare_contact
                                                        (WockyContactFactory *factory,
                                                         const gchar *bare_jid);

Looks up if there's a WockyBareContact for bare_jid in the cache, and returns it if it's found.

factory :

a WockyContactFactory instance

bare_jid :

the JID of a bare contact

Returns :

a borrowed WockyBareContact instance (which the caller should reference with g_object_ref() if it will be kept), or NULL if the contact is not found.

wocky_contact_factory_ensure_resource_contact ()

WockyResourceContact * wocky_contact_factory_ensure_resource_contact
                                                        (WockyContactFactory *factory,
                                                         const gchar *full_jid);

Returns an instance of WockyResourceContact for full_jid. The factory cache is used, but if the resource is not found in the cache, a new WockyResourceContact is created and cached for future use.

factory :

a WockyContactFactory instance

full_jid :

the full JID of a resource

Returns :

a new reference to a WockyResourceContact instance, which the caller is expected to release with g_object_unref() after use.

wocky_contact_factory_lookup_resource_contact ()

WockyResourceContact * wocky_contact_factory_lookup_resource_contact
                                                        (WockyContactFactory *factory,
                                                         const gchar *full_jid);

Looks up if there's a WockyResourceContact for full_jid in the cache, and returns it if it's found.

factory :

a WockyContactFactory instance

full_jid :

the full JID of a resource

Returns :

a borrowed WockyResourceContact instance (which the caller should reference with g_object_ref() if it will be kept), or NULL if the contact is not found.

Signal Details

The "bare-contact-added" signal

void                user_function                      (WockyContactFactory *wockycontactfactory,
                                                        GObject             *arg1,
                                                        gpointer             user_data)                : Run Last

wockycontactfactory :

the object which received the signal.

arg1 :

user_data :

user data set when the signal handler was connected.

The "resource-contact-added" signal

void                user_function                      (WockyContactFactory *wockycontactfactory,
                                                        GObject             *arg1,
                                                        gpointer             user_data)                : Run Last

wockycontactfactory :

the object which received the signal.

arg1 :

user_data :

user data set when the signal handler was connected.