本文整理汇总了C++中signal_add函数的典型用法代码示例。如果您正苦于以下问题:C++ signal_add函数的具体用法?C++ signal_add怎么用?C++ signal_add使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了signal_add函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: noui_init
void noui_init(void)
{
static struct poptOption options[] = {
POPT_AUTOHELP
{ "load", 'l', POPT_ARG_STRING, &autoload_module, 0, "Module to load (default = bot)", "MODULE" },
{ NULL, '\0', 0, NULL }
};
autoload_module = NULL;
args_register(options);
irssi_gui = IRSSI_GUI_NONE;
core_init();
irc_init();
signal_add("reload", (SIGNAL_FUNC) sig_reload);
signal_add("gui exit", (SIGNAL_FUNC) sig_exit);
#ifdef HAVE_STATIC_PERL
perl_core_init();
#endif
signal_emit("irssi init finished", 0);
}
示例2: keyboard_init
void keyboard_init(void)
{
keys = g_hash_table_new((GHashFunc) g_str_hash,
(GCompareFunc) g_str_equal);
default_keys = g_hash_table_new((GHashFunc) g_str_hash,
(GCompareFunc) g_str_equal);
keyinfos = NULL;
key_states = g_tree_new((GCompareFunc) strcmp);
key_config_frozen = 0;
memset(used_keys, 0, sizeof(used_keys));
key_bind("command", "Run any IRC command", NULL, NULL, (SIGNAL_FUNC) sig_command);
key_bind("key", "Specify name for key binding", NULL, NULL, (SIGNAL_FUNC) sig_key);
key_bind("multi", "Run multiple commands", NULL, NULL, (SIGNAL_FUNC) sig_multi);
/* read the keyboard config when all key binds are known */
signal_add("irssi init read settings", (SIGNAL_FUNC) read_keyboard_config);
signal_add("setup reread", (SIGNAL_FUNC) read_keyboard_config);
signal_add("complete command bind", (SIGNAL_FUNC) sig_complete_bind);
command_bind("bind", NULL, (SIGNAL_FUNC) cmd_bind);
command_set_options("bind", "delete");
}
示例3: themes_init
void themes_init(void)
{
settings_add_str("lookandfeel", "theme", "default");
default_formats = g_hash_table_new((GHashFunc) g_str_hash,
(GCompareFunc) g_str_equal);
internal_theme = read_internal_theme();
init_finished = FALSE;
init_errors = NULL;
themes_reload();
command_bind("format", NULL, (SIGNAL_FUNC) cmd_format);
command_bind("save", NULL, (SIGNAL_FUNC) cmd_save);
signal_add("complete command format", (SIGNAL_FUNC) sig_complete_format);
signal_add("irssi init finished", (SIGNAL_FUNC) sig_print_errors);
signal_add("setup changed", (SIGNAL_FUNC) read_settings);
signal_add("setup reread", (SIGNAL_FUNC) themes_reload);
command_set_options("format", "delete reset");
command_set_options("save", "formats");
}
示例4: chat_commands_init
void chat_commands_init(void)
{
settings_add_str("misc", "quit_message", "leaving");
command_bind("server", NULL, (SIGNAL_FUNC) cmd_server);
command_bind("server connect", NULL, (SIGNAL_FUNC) cmd_server_connect);
command_bind("connect", NULL, (SIGNAL_FUNC) cmd_connect);
command_bind("disconnect", NULL, (SIGNAL_FUNC) cmd_disconnect);
command_bind("quit", NULL, (SIGNAL_FUNC) cmd_quit);
command_bind("join", NULL, (SIGNAL_FUNC) cmd_join);
command_bind("msg", NULL, (SIGNAL_FUNC) cmd_msg);
command_bind("foreach", NULL, (SIGNAL_FUNC) cmd_foreach);
command_bind("foreach server", NULL, (SIGNAL_FUNC) cmd_foreach_server);
command_bind("foreach channel", NULL, (SIGNAL_FUNC) cmd_foreach_channel);
command_bind("foreach query", NULL, (SIGNAL_FUNC) cmd_foreach_query);
signal_add("default command server", (SIGNAL_FUNC) sig_default_command_server);
signal_add("server sendmsg", (SIGNAL_FUNC) sig_server_sendmsg);
command_set_options("connect", "4 6 !! -network ssl +ssl_cert +ssl_pkey ssl_verify +ssl_cafile +ssl_capath +host noproxy -rawlog");
command_set_options("join", "invite");
command_set_options("msg", "channel nick");
}
示例5: muc_init
void
muc_init(void)
{
CHAT_PROTOCOL_REC *chat;
if ((chat = chat_protocol_find(XMPP_PROTOCOL_NAME)) != NULL)
chat->channel_create = (CHANNEL_REC *(*)
(SERVER_REC *, const char *, const char *, int))muc_create;
disco_add_feature(XMLNS_MUC);
muc_commands_init();
muc_events_init();
muc_nicklist_init();
muc_reconnect_init();
signal_add("xmpp features", sig_features);
signal_add("channel created", sig_channel_created);
signal_add("channel destroyed", sig_channel_destroyed);
signal_add("server connected", sig_connected);
signal_add("xmpp set presence", sig_set_presence);
settings_add_int("xmpp_lookandfeel", "xmpp_history_maxstanzas", 30);
}
示例6: channel_rejoin_init
void channel_rejoin_init(void)
{
settings_add_bool("servers", "channels_rejoin_unavailable", TRUE);
rejoin_tag = g_timeout_add(REJOIN_TIMEOUT,
(GSourceFunc) sig_rejoin, NULL);
command_bind_irc("rmrejoins", NULL, (SIGNAL_FUNC) cmd_rmrejoins);
signal_add_first("event 407", (SIGNAL_FUNC) event_duplicate_channel);
signal_add_first("event 437", (SIGNAL_FUNC) event_target_unavailable);
signal_add_first("channel joined", (SIGNAL_FUNC) sig_remove_rejoin);
signal_add_first("channel destroyed", (SIGNAL_FUNC) sig_remove_rejoin);
signal_add("server disconnected", (SIGNAL_FUNC) sig_disconnected);
}
示例7: fe_server_init
void fe_server_init(void)
{
command_bind("server", NULL, (SIGNAL_FUNC) cmd_server);
command_bind("server connect", NULL, (SIGNAL_FUNC) cmd_server_connect);
command_bind("server add", NULL, (SIGNAL_FUNC) cmd_server_add);
command_bind("server remove", NULL, (SIGNAL_FUNC) cmd_server_remove);
command_bind_first("server", NULL, (SIGNAL_FUNC) server_command);
command_bind_first("disconnect", NULL, (SIGNAL_FUNC) server_command);
command_set_options("server add", "4 6 ssl +ssl_cert +ssl_pkey ssl_verify +ssl_cafile +ssl_capath auto noauto proxy noproxy -host -port");
signal_add("server looking", (SIGNAL_FUNC) sig_server_looking);
signal_add("server connecting", (SIGNAL_FUNC) sig_server_connecting);
signal_add("server connected", (SIGNAL_FUNC) sig_server_connected);
signal_add("server connect failed", (SIGNAL_FUNC) sig_connect_failed);
signal_add("server disconnected", (SIGNAL_FUNC) sig_server_disconnected);
signal_add("server quit", (SIGNAL_FUNC) sig_server_quit);
signal_add("server lag disconnect", (SIGNAL_FUNC) sig_server_lag_disconnected);
signal_add("server reconnect remove", (SIGNAL_FUNC) sig_server_reconnect_removed);
signal_add("server reconnect not found", (SIGNAL_FUNC) sig_server_reconnect_not_found);
signal_add("chat protocol unknown", (SIGNAL_FUNC) sig_chat_protocol_unknown);
}
示例8: setup_signals
/** Register all necessary signal handlers. */
void setup_signals(void)
{
struct sigaction act;
act.sa_handler = SIG_IGN;
act.sa_flags = 0;
sigemptyset(&act.sa_mask);
sigaddset(&act.sa_mask, SIGPIPE);
sigaddset(&act.sa_mask, SIGALRM);
#ifdef SIGWINCH
sigaddset(&act.sa_mask, SIGWINCH);
sigaction(SIGWINCH, &act, 0);
#endif
sigaction(SIGPIPE, &act, 0);
act.sa_handler = sigalrm_handler;
sigaction(SIGALRM, &act, 0);
signal_add(&sig_hup, sighup_callback, 0, SIGHUP);
signal_add(&sig_int, sigint_callback, 0, SIGINT);
signal_add(&sig_term, sigterm_callback, 0, SIGTERM);
signal_add(&sig_chld, sigchld_callback, 0, SIGCHLD);
}
示例9: luaH_object_add_signal
/* Add a signal to an object.
* `oud` is the object index on the stack.
* `name` is the name of the signal.
* `ud` is the index of function to call when signal is emitted. */
void
luaH_object_add_signal(lua_State *L, gint oud,
const gchar *name, gint ud) {
luaH_checkfunction(L, ud);
lua_object_t *obj = lua_touserdata(L, oud);
gchar *origin = luaH_callerinfo(L);
debug("add " ANSI_COLOR_BLUE "\"%s\"" ANSI_COLOR_RESET
" on %p from " ANSI_COLOR_GREEN "%s" ANSI_COLOR_RESET,
name, obj, origin);
g_free(origin);
signal_add(obj->signals, name, luaH_object_ref_item(L, oud, ud));
}
示例10: channels_query_init
void channels_query_init(void)
{
settings_add_bool("misc", "channel_sync", TRUE);
settings_add_int("misc", "channel_max_who_sync", 1000);
signal_add("server connected", (SIGNAL_FUNC) sig_connected);
signal_add("server disconnected", (SIGNAL_FUNC) sig_disconnected);
signal_add("channel joined", (SIGNAL_FUNC) sig_channel_joined);
signal_add("channel destroyed", (SIGNAL_FUNC) sig_channel_destroyed);
signal_add("chanquery mode", (SIGNAL_FUNC) event_channel_mode);
signal_add("chanquery who end", (SIGNAL_FUNC) event_end_of_who);
signal_add("chanquery ban end", (SIGNAL_FUNC) event_end_of_banlist);
signal_add("chanquery abort", (SIGNAL_FUNC) query_current_error);
}
示例11: main
int main(int argc,char **argv)
{
if(argc<3)
{
printf("usage:server [SERVER_IP] [SERVER_PORT]\n");
exit(0);
}
int port=atoi(argv[2]);
char *ip=argv[1];
struct sockaddr_in ser;
ser.sin_addr.s_addr=inet_addr(ip);
ser.sin_family=AF_INET;
ser.sin_port=htons(port);
int sockfd;
sockfd=socket(AF_INET,SOCK_STREAM,0);
int i=bind(sockfd,(struct sockaddr*)&ser,sizeof(ser));
if(i!=0)
{
printf("#BIND PORT ERROR#\n");
exit(0);
}
signal_add(SIGCHLD);
set_non_block(sockfd);
server_static_init(sockfd);
listen(sockfd,5);
int t;
for(i=0;i<PROCESS_NUM;i++)
{
t=fork();
if(t==0)
{
process();
exit(0);
}
else if(t<0)
{
printf("#fork error#");
exit(0);
}
else
{
fork_mark[fork_id]=t;
fork_id++;
}
}
while(1)
{
server_running_update();
}
}
示例12: rawlog_init
void rawlog_init(void)
{
signal_rawlog = signal_get_uniq_id("rawlog");
settings_add_int("history", "rawlog_lines", 200);
read_settings();
signal_add("setup changed", (SIGNAL_FUNC) read_settings);
command_bind("rawlog", NULL, (SIGNAL_FUNC) cmd_rawlog);
command_bind("rawlog save", NULL, (SIGNAL_FUNC) cmd_rawlog_save);
command_bind("rawlog open", NULL, (SIGNAL_FUNC) cmd_rawlog_open);
command_bind("rawlog close", NULL, (SIGNAL_FUNC) cmd_rawlog_close);
}
示例13: fe_ctcp_init
void fe_ctcp_init(void)
{
signal_add("default ctcp msg", (SIGNAL_FUNC) ctcp_default_msg);
signal_add("ctcp msg ping", (SIGNAL_FUNC) ctcp_ping_msg);
signal_add("ctcp msg version", (SIGNAL_FUNC) ctcp_version_msg);
signal_add("ctcp msg time", (SIGNAL_FUNC) ctcp_time_msg);
signal_add("default ctcp reply", (SIGNAL_FUNC) ctcp_default_reply);
signal_add("ctcp reply ping", (SIGNAL_FUNC) ctcp_ping_reply);
}
示例14: gui_context_nick_init
void gui_context_nick_init(void)
{
signal_add("gui window context word", (SIGNAL_FUNC) sig_window_word);
signal_add("gui window context enter", (SIGNAL_FUNC) sig_window_enter);
signal_add("gui window context leave", (SIGNAL_FUNC) sig_window_leave);
signal_add("gui window context press", (SIGNAL_FUNC) sig_window_press);
signal_add("gui nicklist enter", (SIGNAL_FUNC) sig_nicklist_enter);
signal_add("gui nicklist leave", (SIGNAL_FUNC) sig_nicklist_leave);
}
示例15: fe_server_init
void fe_server_init(void)
{
signal_add("server looking", (SIGNAL_FUNC) sig_server_looking);
signal_add("server connecting", (SIGNAL_FUNC) sig_server_connecting);
signal_add("server connected", (SIGNAL_FUNC) sig_server_connected);
signal_add("server connect failed", (SIGNAL_FUNC) sig_connect_failed);
signal_add("server disconnected", (SIGNAL_FUNC) sig_server_disconnected);
signal_add("server quit", (SIGNAL_FUNC) sig_server_quit);
}