## Connection manager life cycle Connection manager life cycle — entry point for telepathy-glib connection managers |

## Synopsis

    #include <telepathy-glib/run.h>

    int                 tp_run_connection_manager           (const char *prog_name,
                                                             const char *version,
                                                             TpBaseConnectionManager* (*construct_cm) (void),
                                                             int argc,
                                                             char **argv);

## Description

`tp_run_connection_manager()` provides a convenient entry point for telepathy-glib connection managers. It initializes most of the functionality the CM will need, constructs a connection manager object and lets it run.

This function also manages the connection manager's lifetime - if there are no new connections for a while, it times out and exits.

## Details

### tp_run_connection_manager ()

    int                 tp_run_connection_manager           (const char *prog_name,
                                                             const char *version,
                                                             TpBaseConnectionManager* (*construct_cm) (void),
                                                             int argc,
                                                             char **argv);

Run the connection manager by initializing libraries, constructing a main loop, instantiating a connection manager and running the main loop. When this function returns, the program should exit.

If the connection manager does not create a connection within a short arbitrary time (currently 5 seconds), either on startup or after the last open connection is disconnected, and the PERSIST debug flag is not set, return 0.

If registering the connection manager on D-Bus fails, return 1.

`prog_name` : | The program name to be used in debug messages etc.
`version` : | The program version
`construct_cm` : | A function which will return the connection manager object
`argc` : | The number of arguments passed to the program
`argv` : | The arguments passed to the program
Returns : | the status code with which the process should exit