## GrssFeedsPublisher GrssFeedsPublisher — feed writer and PubSubHubBub publisher |

## Functions

#define | FEEDS_PUBLISHER()
#define | FEEDS_PUBLISHER_CLASS()
#define | FEEDS_PUBLISHER_GET_CLASS()
GrssFeedsPublisher * | grss_feeds_publisher_new ()
gchar * | grss_feeds_publisher_format_content ()
gboolean | grss_feeds_publisher_publish_web ()
gboolean | grss_feeds_publisher_publish_file ()
void | grss_feeds_publisher_hub_set_port ()
void | grss_feeds_publisher_hub_set_topics ()
void | grss_feeds_publisher_hub_switch ()

## Signals

void | delete-subscription | Run Last
void | new-subscription | Run Last

## Types and Values

#define | FEEDS_PUBLISHER_TYPE

## Object Hierarchy

        GObject
        ╰── GrssFeedsPublisher

## 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.

## Functions

### FEEDS_PUBLISHER()

    #define FEEDS_PUBLISHER(o)		(G_TYPE_CHECK_INSTANCE_CAST ((o), FEEDS_PUBLISHER_TYPE, GrssFeedsPublisher))

### FEEDS_PUBLISHER_CLASS()

    #define FEEDS_PUBLISHER_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), FEEDS_PUBLISHER_TYPE, GrssFeedsPublisherClass))

### FEEDS_PUBLISHER_GET_CLASS()

    #define FEEDS_PUBLISHER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), FEEDS_PUBLISHER_TYPE, GrssFeedsPublisherClass))

### 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);

`grss_feeds_publisher_format_content` has been deprecated since version 0.6 and should not be used in newly-written code.

Use `grss_feed_formatter_format()` instead.

Format a GrssFeedChannel in Atom and returns the resulting string.

#### Parameters

pub | a GrssFeedsPublisher. |
channel | the GrssFeedChannel to dump in the file. |
items | list of GrssFeedItems to be added in the feed. | [element-type GrssFeedItem]
error | if an error occurred, `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` .

#### Parameters

pub | a GrssFeedsPublisher. |
channel | the GrssFeedChannel to dump in the file. |
items | list of GrssFeedItems to be added in the feed. | [element-type GrssFeedItem]
id | name used in the external URL of the feed. |
error | if an error occurred, `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.

#### Parameters

pub | a GrssFeedsPublisher. |
channel | the GrssFeedChannel to dump in the file. |
items | list of GrssFeedItems to be added in the feed. | [element-type GrssFeedItem]
uri | URI of the file to write. The full path must exists. |
error | if an error occurred, `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.

#### Parameters

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.

#### Parameters

pub | a GrssFeedsPublisher. |
topics | a list of GrssFeedChannels. | [element-type GrssFeedChannel]

### 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.

#### Parameters

pub | a GrssFeedsPublisher. |
run | `TRUE` to run the local server, `FALSE` to stop it. |

## Types and Values

### FEEDS_PUBLISHER_TYPE

    #define FEEDS_PUBLISHER_TYPE		(grss_feeds_publisher_get_type())

## Signal Details

### The `“delete-subscription”` signal

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

Flags: Run Last

### The `“new-subscription”` signal

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

Flags: Run Last