コード例 #1
0
ファイル: infd-server-pool.c プロジェクト: pkern/infinote
static void
infd_server_pool_notify_status_cb(InfdXmlServer* server,
                                  GParamSpec* pspec,
                                  gpointer user_data)
{
  InfdServerPool* server_pool;
  InfdServerPoolPrivate* priv;
  InfdServerPoolEntry* entry;
  InfdXmlServerStatus status;

  server_pool = INFD_SERVER_POOL(user_data);
  priv = INFD_SERVER_POOL_PRIVATE(server_pool);

  entry = (InfdServerPoolEntry*)g_hash_table_lookup(priv->servers, server);
  g_assert(entry != NULL);

  g_object_get(G_OBJECT(server), "status", &status, NULL);

  if(status == INFD_XML_SERVER_CLOSED)
  {
    /* This unpublishes if necessary */
    infd_server_pool_remove_server(server_pool, server);
  }
  else
  {
    if(status == INFD_XML_SERVER_OPEN)
      infd_server_pool_entry_publish(entry);
    else
      infd_server_pool_entry_unpublish(entry);
  }
}
コード例 #2
0
ファイル: server.cpp プロジェクト: aburgm/gobby
void Gobby::Server::set_pool(InfdServerPool* pool)
{
	if(m_pool != NULL)
	{
		if(m_xmpp4 != NULL)
			infd_server_pool_remove_server(
				m_pool, INFD_XML_SERVER(m_xmpp4));
		if(m_xmpp6 != NULL)
			infd_server_pool_remove_server(
				m_pool, INFD_XML_SERVER(m_xmpp6));

		g_object_unref(m_pool);
	}

	m_pool = pool;

	if(m_pool != NULL)
	{
		g_object_ref(m_pool);

		if(m_xmpp4 != NULL)
		{
			infd_server_pool_add_server(
				m_pool, INFD_XML_SERVER(m_xmpp4));
			infd_server_pool_add_local_publisher(
				m_pool, m_xmpp4, m_publisher);
		}

		if(m_xmpp6 != NULL)
		{
			infd_server_pool_add_server(
				m_pool, INFD_XML_SERVER(m_xmpp6));
			infd_server_pool_add_local_publisher(
				m_pool, m_xmpp6, m_publisher);
		}
	}
}