FeedsSubscriber

FeedsSubscriber — PubSubHub subscriber

Stability Level

, unless otherwise indicated

Synopsis

                    FeedsSubscriber;
FeedsSubscriber*    feeds_subscriber_new                ();
gboolean            feeds_subscriber_listen             (FeedsSubscriber *sub,
                                                         GList *feeds);
GList*              feeds_subscriber_get_listened       (FeedsSubscriber *sub);
void                feeds_subscriber_set_port           (FeedsSubscriber *sub,
                                                         int port);
void                feeds_subscriber_set_hub            (FeedsSubscriber *sub,
                                                         gchar *hub);
void                feeds_subscriber_switch             (FeedsSubscriber *sub,
                                                         gboolean run);

Object Hierarchy

  GObject
   +----FeedsSubscriber

Signals

  "notification-received"                          : Run Last

Description

FeedsSubscriber is an alternative for FeedsPool, able to receive real-time notifications by feeds managed by a PubSubHub hub. When the subscriber is executed (with feeds_subscriber_switch()) it opens a server on a local port (configurable with feeds_subscriber_set_port()), engage a subscription for each FeedChannel passed with feeds_subscriber_listen(), and waits for direct notifications by the remote hub. For more information look at http://code.google.com/p/pubsubhubbub/

Details

FeedsSubscriber

typedef struct _FeedsSubscriber FeedsSubscriber;


feeds_subscriber_new ()

FeedsSubscriber*    feeds_subscriber_new                ();

Allocates a new FeedsSubscriber

Returns :

a new FeedsSubscriber

feeds_subscriber_listen ()

gboolean            feeds_subscriber_listen             (FeedsSubscriber *sub,
                                                         GList *feeds);

To set the list of feeds to be managed by sub. The previous list, if any, is invalidated. After invokation to the function, feeds_subscriber_switch() must be call to run the subscription. The list in feeds can be freed after calling this; linked FeedChannel are g_object_ref'd here

sub :

a FeedsSubscriber

feeds :

a list of FeedChannel

Returns :

TRUE if all FeedChannels involved in feeds are valid (feed_channel_get_pubsubhub() returns TRUE), FALSE otherwise

feeds_subscriber_get_listened ()

GList*              feeds_subscriber_get_listened       (FeedsSubscriber *sub);

Returns the list of feeds currently managed by sub

sub :

a FeedsSubscriber

Returns :

a list of FeedChannel, to be freed with g_list_free() when no longer in use. Do not modify elements found in this list

feeds_subscriber_set_port ()

void                feeds_subscriber_set_port           (FeedsSubscriber *sub,
                                                         int port);

To customize the port opened by the local server to catch incoming publishers' events. By default this is 8444. Changing the port while the subscriber is running imply restart the local server. Pay attention to the fact many publishers' implementations accept only certain ports

sub :

a FeedsSubscriber

port :

new listening port for the server

feeds_subscriber_set_hub ()

void                feeds_subscriber_set_hub            (FeedsSubscriber *sub,
                                                         gchar *hub);

To customize the default hub to which send subscriptions. If this value is set, hubs from specific feeds are ignored

sub :

a FeedsSubscriber

hub :

URL of the custom hub

feeds_subscriber_switch ()

void                feeds_subscriber_switch             (FeedsSubscriber *sub,
                                                         gboolean run);

Permits to pause or resume sub listening for events

sub :

a FeedsSubscriber

run :

TRUE to run the subscriber, FALSE to pause it

Signal Details

The "notification-received" signal

void                user_function                      (FeedsSubscriber *pool,
                                                        GObject         *feed,
                                                        GObject         *item,
                                                        gpointer         user_data)      : Run Last

Emitted when a notification has been received and parsed. The item is unref'd at the end of signal

pool :

the FeedsSubscriber emitting the signal

feed :

the FeedChannel which has been updated

item :

the FeedItem received

user_data :

user data set when the signal handler was connected.