int command_silc_connect(void *data, struct t_gui_buffer *buffer, int argc, char **argv, char **argv_eol) { char *servername; struct t_gui_buffer *server_buffer; SilcPluginServerList server; if (argc < 3) { weechat_printf(buffer, "you need to specify a servername to connect to"); return WEECHAT_RC_ERROR; } servername = argv[2]; // create a new buffer for this connection but merge it into the main window server_buffer = weechat_buffer_new(servername, NULL, NULL, NULL, NULL); weechat_printf(server_buffer, "SILC: trying to connect to %s", servername); weechat_buffer_merge(server_buffer, weechat_buffer_search_main()); if (!silc_client_connect_to_server(silc_plugin->client, NULL, silc_plugin->public_key, silc_plugin->private_key, servername, 706, silc_plugin_connected, server_buffer)) { weechat_printf(server_buffer, "%sSILC: connection to server failed", weechat_prefix("error")); weechat_buffer_close(server_buffer); } server = add_server(servername, NULL, NULL, server_buffer); return WEECHAT_RC_OK; }
static void silc_running(SilcClient client, void *application) { MyBot mybot = application; SILC_LOG_DEBUG(("Client is running")); /* Connect to server. The silc_connected callback will be called after the connection is established or if an error occurs during connecting. */ silc_client_connect_to_server(mybot->client, NULL, mybot->public_key, mybot->private_key, "silc.silcnet.org", 706, silc_connected, mybot); }