GrssFeedsPublisher

GrssFeedsPublisher — feed writer and PubSubHubBub publisher

Synopsis

struct              GrssFeedsPublisher;
GrssFeedsPublisher * grss_feeds_publisher_new           ();
gchar *             grss_feeds_publisher_format_content (GrssFeedsPublisher *pub,
                                                         GrssFeedChannel *channel,
                                                         GList *items,
                                                         GError **error);
gboolean            grss_feeds_publisher_publish_web    (GrssFeedsPublisher *pub,
                                                         GrssFeedChannel *channel,
                                                         GList *items,
                                                         const gchar *id,
                                                         GError **error);
gboolean            grss_feeds_publisher_publish_file   (GrssFeedsPublisher *pub,
                                                         GrssFeedChannel *channel,
                                                         GList *items,
                                                         const gchar *uri,
                                                         GError **error);
void                grss_feeds_publisher_hub_set_port   (GrssFeedsPublisher *pub,
                                                         int port);
void                grss_feeds_publisher_hub_set_topics (GrssFeedsPublisher *pub,
                                                         GList *topics);
void                grss_feeds_publisher_hub_switch     (GrssFeedsPublisher *pub,
                                                         gboolean run);

Object Hierarchy

  GObject
   +----GrssFeedsPublisher

Signals

  "delete-subscription"                            : Run Last
  "new-subscription"                               : Run Last

Description

GrssFeedsPublisher may be used to expose contents for any given GrssFeedChannel, both writing a file to be dispatched by the local webserver or providing himself to distribute it, and implements a server able to receive subscriptions by PubSubHubbub clients and deliver them new contents in real-time.

Details

struct GrssFeedsPublisher

struct GrssFeedsPublisher;


grss_feeds_publisher_new ()

GrssFeedsPublisher * grss_feeds_publisher_new           ();

Allocates a new GrssFeedsPublisher.

Returns :

a new GrssFeedsPublisher.

grss_feeds_publisher_format_content ()

gchar *             grss_feeds_publisher_format_content (GrssFeedsPublisher *pub,
                                                         GrssFeedChannel *channel,
                                                         GList *items,
                                                         GError **error);

Format a GrssFeedChannel in Atom and returns the resulting string.

pub :

a GrssFeedsPublisher.

channel :

the GrssFeedChannel to dump in the file.

items :

list of GrssFeedItems to be added in the feed.

error :

if an error occourred, NULL is returned and this is filled with the message.

Returns :

a newly allocated string holding the formatted feed, to be freed when no longer in use.

grss_feeds_publisher_publish_web ()

gboolean            grss_feeds_publisher_publish_web    (GrssFeedsPublisher *pub,
                                                         GrssFeedChannel *channel,
                                                         GList *items,
                                                         const gchar *id,
                                                         GError **error);

If the local web server has been executed (with grss_feeds_publisher_hub_switch()) this function exposes the given channel as an Atom formatted file avalable to http://[LOCAL_IP:DEFINED_PORT]/id .

pub :

a GrssFeedsPublisher.

channel :

the GrssFeedChannel to dump in the file.

items :

list of GrssFeedItems to be added in the feed.

id :

name used in the external URL of the feed.

error :

if an error occourred, FALSE is returned and this is filled with the message.

Returns :

TRUE if the file is successfully written, FALSE otherwise.

grss_feeds_publisher_publish_file ()

gboolean            grss_feeds_publisher_publish_file   (GrssFeedsPublisher *pub,
                                                         GrssFeedChannel *channel,
                                                         GList *items,
                                                         const gchar *uri,
                                                         GError **error);

Dump the given channel in an Atom formatted file in path. If the local PubSubHubbub hub has been activated (with grss_feeds_publisher_hub_switch()) notifies remote subscribers about the new items which has been added since previous invocation of this function for the same GrssFeedChannel.

pub :

a GrssFeedsPublisher.

channel :

the GrssFeedChannel to dump in the file.

items :

list of GrssFeedItems to be added in the feed.

uri :

URI of the file to write. The full path must exists.

error :

if an error occourred, FALSE is returned and this is filled with the message.

Returns :

TRUE if the file is successfully written, FALSE otherwise.

grss_feeds_publisher_hub_set_port ()

void                grss_feeds_publisher_hub_set_port   (GrssFeedsPublisher *pub,
                                                         int port);

To customize the port opened by the local server to deliver feeds and catch incoming subscriptions. By default this is 80. Changing the port while the hub is running imply restart the local server.

pub :

a GrssFeedsPublisher.

port :

new listening port for the server.

grss_feeds_publisher_hub_set_topics ()

void                grss_feeds_publisher_hub_set_topics (GrssFeedsPublisher *pub,
                                                         GList *topics);

To define a list of valid "topics" for which the GrssFeedsPublisher will deliver contents. Sources of those channels, as retrieved by grss_feed_channel_get_source(), are accepted as "hub.topic" parameter in PubSubHubbub registration requests from remote subscribers. Pay attention to the fact subscriptions requests for different topic are now rejected.

pub :

a GrssFeedsPublisher.

topics :

a list of GrssFeedChannels.

grss_feeds_publisher_hub_switch ()

void                grss_feeds_publisher_hub_switch     (GrssFeedsPublisher *pub,
                                                         gboolean run);

Permits to start and stop the webserver implemented by this object.

pub :

a GrssFeedsPublisher.

run :

TRUE to run the local server, FALSE to stop it.

Signal Details

The "delete-subscription" signal

void                user_function                      (GrssFeedsPublisher *grssfeedspublisher,
                                                        GrssFeedChannel    *arg1,
                                                        gchar              *arg2,
                                                        gpointer            user_data)               : Run Last

grssfeedspublisher :

the object which received the signal.

user_data :

user data set when the signal handler was connected.

The "new-subscription" signal

void                user_function                      (GrssFeedsPublisher *grssfeedspublisher,
                                                        GrssFeedChannel    *arg1,
                                                        gchar              *arg2,
                                                        gpointer            user_data)               : Run Last

grssfeedspublisher :

the object which received the signal.

user_data :

user data set when the signal handler was connected.