コード例 #1
0
/**
 * inf_request_result_make_subscribe_chat:
 * @browser: A #InfBrowser.
 * @proxy: The #InfSessionProxy for the subscribed session.
 *
 * Creates a new #InfRequestResult for a "subscribe-chat" request, see
 * infc_browser_subscribe_chat(). The #InfRequestResult object is only valid
 * as long as the caller maintains a reference to @browser and @proxy.
 *
 * Returns: A new #InfRequestResult. Free with inf_request_result_free().
 */
InfRequestResult*
inf_request_result_make_subscribe_chat(InfBrowser* browser,
                                       InfSessionProxy* proxy)
{
  InfRequestResultSubscribeChat* data;

  g_return_val_if_fail(INF_IS_BROWSER(browser), NULL);
  g_return_val_if_fail(INF_IS_SESSION_PROXY(proxy), NULL);

  data = g_malloc(sizeof(InfRequestResultSubscribeChat));

  data->browser = browser;
  data->proxy = proxy;

  return inf_request_result_new(data, sizeof(*data));
}
コード例 #2
0
/**
 * inf_request_result_make_join_user:
 * @proxy: A #InfSessionProxy.
 * @user: The joined user.
 *
 * Creates a new #InfRequestResult for a "join-user" request, see
 * inf_session_proxy_join_user(). The #InfRequestResult object is only valid
 * as long as the caller maintains a reference to @proxy.
 *
 * Returns: A new #InfRequestResult. Free with inf_request_result_free().
 */
InfRequestResult*
inf_request_result_make_join_user(InfSessionProxy* proxy,
                                  InfUser* user)
{
  InfRequestResultJoinUser* data;

  g_return_val_if_fail(INF_IS_SESSION_PROXY(proxy), NULL);
  g_return_val_if_fail(user != NULL, NULL);

  data = g_malloc(sizeof(InfRequestResultJoinUser));

  data->proxy = proxy;
  data->user = user;

  return inf_request_result_new(data, sizeof(*data));
}
コード例 #3
0
/**
 * inf_session_proxy_join_user:
 * @proxy: A #InfSessionProxy.
 * @n_params: Number of parameters.
 * @params: Construction properties for the InfUser (or derived) object.
 * @func: Function to be called on completion of the user join, or %NULL.
 * @user_data: Additional data to be passed to @func.
 *
 * Requests a user join for a user with the given properties (which must not
 * include #InfUser:id or #InfUser:flags since these are chosen by the session
 * proxy). The #InfUser:status property is optional and defaults to
 * %INF_USER_ACTIVE if not given. It must not be %INF_USER_UNAVAILABLE.
 *
 * 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 #InfRequest::finished signal,
 * so that it is called as soon as the request finishes.
 *
 * Returns: A #InfRequest object that may be used to get notified
 * when the request finishes, or %NULL.
 */
InfRequest*
inf_session_proxy_join_user(InfSessionProxy* proxy,
                            guint n_params,
                            const GParameter* params,
                            InfRequestFunc func,
                            gpointer user_data)
{
  InfSessionProxyIface* iface;

  g_return_val_if_fail(INF_IS_SESSION_PROXY(proxy), NULL);
  g_return_val_if_fail(n_params == 0 || params != NULL, NULL);

  iface = INF_SESSION_PROXY_GET_IFACE(proxy);
  g_return_val_if_fail(iface->join_user != NULL, NULL);

  return iface->join_user(proxy, n_params, params, func, user_data);
}
コード例 #4
0
/**
 * infinoted_plugin_manager_get_session_info:
 * @mgr: A #InfinotedPluginManager.
 * @plugin_info: The @plugin_info pointer of a plugin instance.
 * @proxy: The #InfSessionProxy for which to retrieve plugin data.
 *
 * Queries the session-specfic plugin data for the plugin instance
 * @plugin_info. Returns %NULL if no such object exists, i.e. when the
 * plugin's @session_info_size is set to 0.
 *
 * Returns: A pointer to the session-specific plugin data, or %NULL.
 */
gpointer
infinoted_plugin_manager_get_session_info(InfinotedPluginManager* mgr,
                                          gpointer plugin_info,
                                          InfSessionProxy* proxy)
{
  InfinotedPluginManagerPrivate* priv;

  g_return_val_if_fail(INFINOTED_IS_PLUGIN_MANAGER(mgr), NULL);
  g_return_val_if_fail(INF_IS_SESSION_PROXY(proxy), NULL);

  priv = INFINOTED_PLUGIN_MANAGER_PRIVATE(mgr);

  return g_hash_table_lookup(
    priv->sessions,
    infinoted_plugin_manager_hash(plugin_info, proxy)
  );
}