InfcBrowser

InfcBrowser — Browse remote directories

Stability Level

Unstable, unless otherwise indicated

Synopsis

#include <libinfinity/client/infc-browser.h>

                    InfcBrowser;
struct              InfcBrowserClass;
InfcBrowser *       infc_browser_new                    (InfIo *io,
                                                         InfCommunicationManager *comm_manager,
                                                         InfXmlConnection *connection);
InfCommunicationManager * infc_browser_get_communication_manager
                                                        (InfcBrowser *browser);
InfXmlConnection *  infc_browser_get_connection         (InfcBrowser *browser);
gboolean            infc_browser_add_plugin             (InfcBrowser *browser,
                                                         const InfcNotePlugin *plugin);
const InfcNotePlugin * infc_browser_lookup_plugin       (InfcBrowser *browser,
                                                         const gchar *note_type);
InfRequest *        infc_browser_iter_save_session      (InfcBrowser *browser,
                                                         const InfBrowserIter *iter,
                                                         InfRequestFunc func,
                                                         gpointer user_data);
InfcSessionProxy *  infc_browser_iter_get_sync_in       (InfcBrowser *browser,
                                                         const InfBrowserIter *iter);
GSList *            infc_browser_iter_get_sync_in_requests
                                                        (InfcBrowser *browser,
                                                         const InfBrowserIter *iter);
gboolean            infc_browser_iter_is_valid          (InfcBrowser *browser,
                                                         const InfBrowserIter *iter);
InfRequest *        infc_browser_subscribe_chat         (InfcBrowser *browser,
                                                         InfRequestFunc func,
                                                         gpointer user_data);
InfRequest *        infc_browser_get_subscribe_chat_request
                                                        (InfcBrowser *browser);
InfcSessionProxy *  infc_browser_get_chat_session       (InfcBrowser *browser);

Object Hierarchy

  GObject
   +----InfcBrowser

Implemented Interfaces

InfcBrowser implements InfCommunicationObject and InfBrowser.

Properties

  "chat-session"             InfcSessionProxy*     : Read
  "communication-manager"    InfCommunicationManager*  : Read / Write / Construct Only
  "connection"               InfXmlConnection*     : Read / Write / Construct Only
  "io"                       InfIo*                : Read / Write / Construct Only

Description

The InfcBrowser is used to browse a remote directory and can be used to subscribe to sessions. InfcBrowser implements the InfBrowser interface, through which most operations are performed.

Details

InfcBrowser

typedef struct _InfcBrowser InfcBrowser;

InfcBrowser is an opaque data type. You should only access it via the public API functions.


struct InfcBrowserClass

struct InfcBrowserClass {
};

This structure does not contain any public fields.


infc_browser_new ()

InfcBrowser *       infc_browser_new                    (InfIo *io,
                                                         InfCommunicationManager *comm_manager,
                                                         InfXmlConnection *connection);

Creates a new InfcBrowser.

io :

A InfIo object used to schedule timeouts.

comm_manager :

A InfCommunicationManager to register the server connection and which forwards incoming data to the browser or running sessions.

connection :

Connection to the server.

Returns :

A new InfcBrowser.

infc_browser_get_communication_manager ()

InfCommunicationManager * infc_browser_get_communication_manager
                                                        (InfcBrowser *browser);

Returns the communication manager of this browser.

browser :

A InfcBrowser.

Returns :

A InfCommunicationManager.

infc_browser_get_connection ()

InfXmlConnection *  infc_browser_get_connection         (InfcBrowser *browser);

Returns the connection to the server.

browser :

A InfcBrowser.

Returns :

A InfXmlConnection.

infc_browser_add_plugin ()

gboolean            infc_browser_add_plugin             (InfcBrowser *browser,
                                                         const InfcNotePlugin *plugin);

Adds plugin to browser. This allows the browser to create sessions of the plugin's type. Only one plugin of each type can be added to the directory.

browser :

A InfcBrowser.

plugin :

A InfcNotePlugin.

Returns :

Whether the plugin was added successfully.

infc_browser_lookup_plugin ()

const InfcNotePlugin * infc_browser_lookup_plugin       (InfcBrowser *browser,
                                                         const gchar *note_type);

Returns a previously registered plugin (see infc_browser_add_plugin()) for the given note type, or NULL if there is no such plugin.

browser :

A InfcBrowser.

note_type :

A note type, such as "InfText".

Returns :

A InfcNotePlugin, or NULL.

infc_browser_iter_save_session ()

InfRequest *        infc_browser_iter_save_session      (InfcBrowser *browser,
                                                         const InfBrowserIter *iter,
                                                         InfRequestFunc func,
                                                         gpointer user_data);

Requests that the server saves the note pointed to by iter into its background storage. Normally, the server only does this when it is either shut down or when the there are no more subscriptions to the note. Note that this is merely a request and the server might decide not to save the session for whatever reason.

The request might either finish during the call to this function, in which case func will be called and NULL being returned. If the request does not finish within the function call, a InfRequest object is returned, where func has been installed for the "finished" signal, so that it is called as soon as the request finishes.

browser :

A InfcBrowser.

iter :

A InfcBrowserIter pointing to a note in browser.

func :

The function to be called when the request finishes, or NULL.

user_data :

Additional data to pass to func.

Returns :

A InfRequest that may be used to get notified when the request finishes or fails.

infc_browser_iter_get_sync_in ()

InfcSessionProxy *  infc_browser_iter_get_sync_in       (InfcBrowser *browser,
                                                         const InfBrowserIter *iter);

Returns the InfcSessionProxy that is used to synchronize the note iter points to to the server. Such a node is created by inf_browser_add_note() with non-NULL session parameter. If the client is subscribed to this note, then this returns the same session as inf_browser_get_session(). However, it is possible that we synchronize this node to the server without being subscribed to it. In this case, this function returns the session that does the synchronization, while inf_browser_get_session() would return NULL.

browser :

A InfcBrowser.

iter :

A InfcBrowserIter pointing to a note in browser.

Returns :

A InfcSessionProxy, or NULL if we are currently not synchronizing this node to the server.

infc_browser_iter_get_sync_in_requests ()

GSList *            infc_browser_iter_get_sync_in_requests
                                                        (InfcBrowser *browser,
                                                         const InfBrowserIter *iter);

Returns a list of all InfcNodeRequest created with inf_browser_add_note() with the node iter points to as parent. Such requests begin a synchronization to the server when they have finished.

browser :

A InfcBrowser.

iter :

A InfcBrowserIter pointing to a subdirectory node in browser.

Returns :

A list of InfcNodeRequests. Free with g_slist_free() when done.

infc_browser_iter_is_valid ()

gboolean            infc_browser_iter_is_valid          (InfcBrowser *browser,
                                                         const InfBrowserIter *iter);

Returns whether iter points to a valid node in browser. This is generally the case for any InfcBrowserIter returned by one of the InfcBrowser functions, it gets invalid however as soon as the node it points to is removed.

browser :

A InfcBrowser.

iter :

A InfcBrowserIter.

Returns :

Whether iter points to a node in browser.

infc_browser_subscribe_chat ()

InfRequest *        infc_browser_subscribe_chat         (InfcBrowser *browser,
                                                         InfRequestFunc func,
                                                         gpointer user_data);

Attempts to subscribe to the server's chat. When the operation finishes infc_browser_get_chat_session() will return a InfcSessionProxy representing the chat session. It can be used to read the chat's content. The request can fail in case the server chat is disabled.

The request might either finish during the call to this function, in which case func will be called and NULL being returned. If the request does not finish within the function call, a InfRequest object is returned, where func has been installed for the "finished" signal, so that it is called as soon as the request finishes.

browser :

A InfcBrowser.

func :

The function to be called when the request finishes, or NULL.

user_data :

Additional data to pass to func.

Returns :

A InfRequest that may be used to get notified when the request finishes or fails.

infc_browser_get_subscribe_chat_request ()

InfRequest *        infc_browser_get_subscribe_chat_request
                                                        (InfcBrowser *browser);

Returns the InfRequest that represests the request sent to the server which attempts to subscribe to its chat. If there is no such request running, then the function returns NULL. After such a request finishes, call infc_browser_get_chat_session() to get the InfcSessionProxy for the chat session. To initiate the request, call infc_browser_subscribe_chat().

browser :

A InfcBrowser.

Returns :

A InfRequest, or NULL.

infc_browser_get_chat_session ()

InfcSessionProxy *  infc_browser_get_chat_session       (InfcBrowser *browser);

Returns the InfcSessionProxy representing the running chat session if the local client is subscribed to it, or NULL otherwise.

browser :

A InfcBrowser.

Returns :

A InfcSessionProxy for the chat, or NULL.

Property Details

The "chat-session" property

  "chat-session"             InfcSessionProxy*     : Read

Active chat session.


The "communication-manager" property

  "communication-manager"    InfCommunicationManager*  : Read / Write / Construct Only

The communication manager for the browser.


The "connection" property

  "connection"               InfXmlConnection*     : Read / Write / Construct Only

Connection to the server exposing the directory to browse.


The "io" property

  "io"                       InfIo*                : Read / Write / Construct Only

The InfIo to schedule timeouts.

See Also

InfdDirectory