InfCommunicationFactory

InfCommunicationFactory — Creation of communication methods

Stability Level

Unstable, unless otherwise indicated

Functions

Types and Values

Object Hierarchy

    GInterface
    ╰── InfCommunicationFactory

Prerequisites

InfCommunicationFactory requires GObject.

Known Implementations

InfCommunicationFactory is implemented by InfCommunicationCentralFactory.

Includes

#include <libinfinity/communication/inf-communication-factory.h>

Description

A InfCommunicationFactory is used by the communication manager to create InfCommunicationMethods. All a factory has to do is to tell whether it supports a specific network and method name combination, and create a corresponding InfCommunicationMethod if it does.

InfCommunicationFactorys are added to a communication manager via inf_communication_manager_add_factory(). The communication manager will automatically use the factory if it needs to create a method it supports.

Functions

inf_communication_factory_supports_method ()

gboolean
inf_communication_factory_supports_method
                               (InfCommunicationFactory *factory,
                                const gchar *network,
                                const gchar *method_name);

Returns whether factory supports creating methods that implement method_name as communication method for connections on network (see “network”).

Parameters

factory

A InfCommunicationFactory.

 

network

A network specifier, such as "tcp/ip" or "jabber".

 

method_name

A method identifier, such as "central" or "groupchat".

 

Returns

Whether factory supports the given network and method name.


inf_communication_factory_instantiate ()

InfCommunicationMethod *
inf_communication_factory_instantiate (InfCommunicationFactory *factory,
                                       const gchar *network,
                                       const gchar *method_name,
                                       InfCommunicationRegistry *registry,
                                       InfCommunicationGroup *group);

Creates a new InfCommunicationMethod for network and method_name . The factory needs to support that method, see inf_communication_factory_supports_method().

Parameters

factory

A InfCommunicationFactory.

 

network

A network specifier, such as "tcp/ip" or "jabber".

 

method_name

A method identifier, such as "central" or "groupchat".

 

registry

A InfCommunicationRegistry at which the created method can register connections.

 

group

The InfCommunicationGroup for which to create the method.

 

Returns

A new InfCommunicationMethod.

[transfer full]

Types and Values

InfCommunicationFactory

typedef struct _InfCommunicationFactory InfCommunicationFactory;

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


struct InfCommunicationFactoryInterface

struct InfCommunicationFactoryInterface {
  gboolean (*supports_method)(InfCommunicationFactory* factory,
                              const gchar* network,
                              const gchar* method_name);

  InfCommunicationMethod* (*instantiate)(InfCommunicationFactory* factory,
                                         const gchar* network,
                                         const gchar* method_name,
                                         InfCommunicationRegistry* registry,
                                         InfCommunicationGroup* group);
};

The virtual methods of InfCommunicationFactory. These handle instantiating a InfCommunicationMethod for a InfCommunicationGroup.

Members

supports_method ()

Returns whether the given method_name is supported for the network in question by the factory.

 

instantiate ()

Instantiates a communication method for the given method name, handling communication for the passed group.

 

See Also

InfCommunicationManager