예제 #1
0
파일: mybot.c 프로젝트: FabrizioFabbe/silc
static void
silc_connected(SilcClient client, SilcClientConnection conn,
	       SilcClientConnectionStatus status,
	       SilcStatus error, const char *message,
	       void *context)
{
  MyBot mybot = client->application;

  if (status == SILC_CLIENT_CONN_DISCONNECTED) {
    SILC_LOG_DEBUG(("Disconnected %s", message ? message : ""));
    silc_client_stop(client, silc_stopped, mybot);
    return;
  }

  if (status != SILC_CLIENT_CONN_SUCCESS &&
      status != SILC_CLIENT_CONN_SUCCESS_RESUME) {
    SILC_LOG_DEBUG(("Error connecting to server %d", status));
    silc_client_stop(client, silc_stopped, mybot);
    return;
  }

  fprintf(stdout, "\nMyBot: Connected to server\n\n");

  /* Now that we have connected to server, let's join a channel named
     "mybot". */
  silc_client_command_call(client, conn, "JOIN mybot");

  /* Save the connection context */
  mybot->conn = conn;
}
예제 #2
0
static void PySilcClient_Del(PyObject *obj)
{
    PySilcClient *pyclient = (PySilcClient *)obj;
    if (pyclient->silcobj) {
        silc_client_stop(pyclient->silcobj, NULL, NULL);
        silc_client_free(pyclient->silcobj);
    }
    Py_XDECREF(pyclient->keys);
    obj->ob_type->tp_free(obj);
}
예제 #3
0
int weechat_plugin_end(struct t_weechat_plugin *plugin) {
    silc_client_stop(silc_plugin->client, silc_stopped, NULL);
    silc_plugin_config_write();
    silc_plugin_config_free();
    return WEECHAT_RC_OK;
}