本文整理汇总了C++中signal_emit函数的典型用法代码示例。如果您正苦于以下问题:C++ signal_emit函数的具体用法?C++ signal_emit怎么用?C++ signal_emit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了signal_emit函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: g_return_val_if_fail
THEME_REC *theme_create(const char *path, const char *name)
{
THEME_REC *rec;
g_return_val_if_fail(path != NULL, NULL);
g_return_val_if_fail(name != NULL, NULL);
rec = g_new0(THEME_REC, 1);
rec->refcount = 1;
rec->path = g_strdup(path);
rec->name = g_strdup(name);
rec->abstracts = g_hash_table_new((GHashFunc) g_str_hash,
(GCompareFunc) g_str_equal);
rec->modules = g_hash_table_new((GHashFunc) g_istr_hash,
(GCompareFunc) g_istr_equal);
themes = g_slist_append(themes, rec);
signal_emit("theme created", 1, rec);
return rec;
}
示例2: sig_connected
static void
sig_connected(XMPP_SERVER_REC *server)
{
LmMessage *lmsg;
char *str;
if (!IS_XMPP_SERVER(server) || (server->connrec->reconnection
&& xmpp_presence_changed(server->connrec->show, server->show,
server->connrec->away_reason, server->away_reason,
server->connrec->priority, server->priority)))
return;
/* set presence available */
lmsg = lm_message_new_with_sub_type(NULL, LM_MESSAGE_TYPE_PRESENCE,
LM_MESSAGE_SUB_TYPE_AVAILABLE);
str = g_strdup_printf("%d", server->priority);
lm_message_node_add_child(lmsg->node, "priority", str);
g_free(str);
signal_emit("xmpp send presence", 2, server, lmsg);
lm_message_unref(lmsg);
}
示例3: event_notice
static void event_notice(const char *data, IRC_SERVER_REC *server,
const char *nick, const char *addr)
{
char *params, *target, *ptr, *msg;
g_return_if_fail(data != NULL);
params = event_get_params(data, 2, &target, &msg);
/* handle only ctcp replies */
if (*msg == 1) {
ptr = strrchr(++msg, 1);
if (ptr != NULL) *ptr = '\0';
signal_emit("ctcp reply", 5, msg, server, nick, addr, target);
signal_stop();
}
g_free(params);
}
示例4: query_destroy
void query_destroy(QUERY_REC *query)
{
g_return_if_fail(IS_QUERY(query));
if (query->destroying) return;
query->destroying = TRUE;
queries = g_slist_remove(queries, query);
if (query->server != NULL) {
query->server->queries =
g_slist_remove(query->server->queries, query);
}
signal_emit("query destroyed", 1, query);
MODULE_DATA_DEINIT(query);
g_free_not_null(query->server_tag);
g_free_not_null(query->address);
g_free(query->name);
g_free(query);
}
示例5: gui_window_destroyed
static void gui_window_destroyed(WINDOW_REC *window)
{
MAIN_WINDOW_REC *parent;
GUI_WINDOW_REC *gui;
g_return_if_fail(window != NULL);
gui = WINDOW_GUI(window);
parent = gui->parent;
gui_window_set_unsticky(window);
signal_emit("gui window destroyed", 1, window);
gui_window_deinit(gui);
window->gui_data = NULL;
if (parent->active == window)
mainwindow_change_active(parent, window);
}
示例6: netsplit_server_find
static NETSPLIT_SERVER_REC *netsplit_server_create(IRC_SERVER_REC *server, const char *servername, const char *destserver)
{
NETSPLIT_SERVER_REC *rec;
rec = netsplit_server_find(server, servername, destserver);
if (rec != NULL) {
rec->last = time(NULL);
return rec;
}
rec = g_new0(NETSPLIT_SERVER_REC, 1);
rec->last = time(NULL);
rec->server = g_strdup(servername);
rec->destserver = g_strdup(destserver);
server->split_servers = g_slist_append(server->split_servers, rec);
signal_emit("netsplit new server", 2, server, rec);
return rec;
}
示例7: g_return_val_if_fail
NOTIFYLIST_REC *notifylist_add(const char *mask, const char *ircnets,
int away_check, int idle_check_time)
{
NOTIFYLIST_REC *rec;
g_return_val_if_fail(mask != NULL, NULL);
rec = g_new0(NOTIFYLIST_REC, 1);
rec->mask = g_strdup(mask);
rec->ircnets = ircnets == NULL || *ircnets == '\0' ? NULL :
g_strsplit(ircnets, " ", -1);
rec->away_check = away_check;
rec->idle_check_time = idle_check_time;
notifylist_add_config(rec);
notifies = g_slist_append(notifies, rec);
signal_emit("notifylist new", 1, rec);
return rec;
}
示例8: cmd_ping
/* SYNTAX: PING <nicks> */
static void cmd_ping(const char *data, IRC_SERVER_REC *server, WI_ITEM_REC *item)
{
GTimeVal tv;
char *str;
CMD_IRC_SERVER(server);
if (*data == '\0' || strcmp(data, "*") == 0) {
if (!IS_IRC_ITEM(item))
cmd_return_error(CMDERR_NOT_JOINED);
data = window_item_get_target(item);
}
g_get_current_time(&tv);
str = g_strdup_printf("%s PING %ld %ld", data, tv.tv_sec, tv.tv_usec);
signal_emit("command ctcp", 3, str, server, item);
g_free(str);
}
示例9: dcc_chat_connect
static void dcc_chat_connect(DCC_REC *dcc)
{
g_return_if_fail(dcc != NULL);
if (dcc->addrstr[0] == '\0' || dcc->starttime != 0) {
/* already sent a chat request / already chatting */
return;
}
dcc->handle = net_connect_ip(&dcc->addr, dcc->port,
source_host_ok ? source_host_ip : NULL);
if (dcc->handle != -1) {
dcc->tagread = g_input_add(dcc->handle, G_INPUT_WRITE|G_INPUT_READ|G_INPUT_EXCEPTION,
(GInputFunction) sig_chat_connected, dcc);
} else {
/* error connecting */
signal_emit("dcc error connect", 1, dcc);
dcc_destroy(dcc);
}
}
示例10: sig_req_usermode_change
static void sig_req_usermode_change(IRC_SERVER_REC *server, const char *data,
const char *nick, const char *addr)
{
char *params, *target, *mode;
g_return_if_fail(data != NULL);
params = event_get_params(data, 2 | PARAM_FLAG_GETREST,
&target, &mode);
if (!ischannel(*target)) {
/* we requested a user mode change, save this */
mode = modes_join(NULL, server->wanted_usermode, mode, FALSE);
g_free_not_null(server->wanted_usermode);
server->wanted_usermode = mode;
}
g_free(params);
signal_emit("event mode", 4, server, data, nick, addr);
}
示例11: channel_destroy
void channel_destroy(CHANNEL_REC *channel)
{
g_return_if_fail(IS_CHANNEL(channel));
if (channel->destroying) return;
channel->destroying = TRUE;
channels = g_slist_remove(channels, channel);
if (channel->server != NULL)
channel->server->channels = g_slist_remove(channel->server->channels, channel);
signal_emit("channel destroyed", 1, channel);
MODULE_DATA_DEINIT(channel);
g_free_not_null(channel->topic);
g_free_not_null(channel->topic_by);
g_free_not_null(channel->key);
g_free(channel->mode);
g_free(channel->name);
g_free(channel);
}
示例12: g_new0
MAIN_WINDOW_REC *mainwindow_create(void)
{
MAIN_WINDOW_REC *rec, *parent;
int space;
rec = g_new0(MAIN_WINDOW_REC, 1);
rec->dirty = TRUE;
rec->width = term_width;
if (mainwindows == NULL) {
active_mainwin = rec;
rec->first_line = screen_reserved_top;
rec->last_line = term_height-1 - screen_reserved_bottom;
rec->height = rec->last_line-rec->first_line+1;
} else {
parent = WINDOW_MAIN(active_win);
if (MAIN_WINDOW_TEXT_HEIGHT(parent) <
WINDOW_MIN_SIZE+NEW_WINDOW_SIZE)
parent = find_window_with_room();
if (parent == NULL)
return NULL; /* not enough space */
space = parent->height / 2;
rec->first_line = parent->first_line;
rec->last_line = rec->first_line + space;
rec->height = rec->last_line-rec->first_line+1;
parent->first_line = rec->last_line+1;
parent->height = parent->last_line-parent->first_line+1;
mainwindow_resize(parent, 0, -space-1);
}
rec->screen_win = mainwindow_create_screen(rec);
term_refresh(NULL);
mainwindows = g_slist_append(mainwindows, rec);
signal_emit("mainwindow created", 1, rec);
return rec;
}
示例13: sig_listen
static void sig_listen(LISTEN_REC *listen)
{
CLIENT_REC *rec;
IPADDR ip;
NET_SENDBUF_REC *sendbuf;
GIOChannel *handle;
char host[MAX_IP_LEN];
int port;
g_return_if_fail(listen != NULL);
/* accept connection */
handle = net_accept(listen->handle, &ip, &port);
if (handle == NULL)
return;
net_ip2host(&ip, host);
sendbuf = net_sendbuffer_create(handle, 0);
rec = g_new0(CLIENT_REC, 1);
rec->listen = listen;
rec->handle = sendbuf;
rec->host = g_strdup(host);
rec->port = port;
if (g_strcmp0(listen->ircnet, "*") == 0) {
rec->proxy_address = g_strdup("irc.proxy");
rec->server = servers == NULL ? NULL : IRC_SERVER(servers->data);
} else {
rec->proxy_address = g_strdup_printf("%s.proxy", listen->ircnet);
rec->server = servers == NULL ? NULL :
IRC_SERVER(server_find_chatnet(listen->ircnet));
}
rec->recv_tag = g_input_add(handle, G_INPUT_READ,
(GInputFunction) sig_listen_client, rec);
proxy_clients = g_slist_prepend(proxy_clients, rec);
rec->listen->clients = g_slist_prepend(rec->listen->clients, rec);
signal_emit("proxy client connecting", 1, rec);
printtext(rec->server, NULL, MSGLEVEL_CLIENTNOTICE,
"Proxy: New client %s:%d on port %d (%s)",
rec->host, rec->port, listen->port, listen->ircnet);
}
示例14: perl_scripts_deinit
/* Destroy all perl scripts and deinitialize perl interpreter */
void perl_scripts_deinit(void)
{
if (my_perl == NULL)
return;
/* unload all scripts */
while (perl_scripts != NULL)
perl_script_unload(perl_scripts->data);
signal_emit("perl scripts deinit", 0);
perl_signals_stop();
perl_sources_stop();
perl_common_stop();
/* Unload all perl libraries loaded with dynaloader */
perl_eval_pv("foreach my $lib (@DynaLoader::dl_modules) { if ($lib =~ /^Irssi\\b/) { $lib .= '::deinit();'; eval $lib; } }", TRUE);
#if PERL_STATIC_LIBS == 1
/* If perl is statically built we should manually deinit the modules
which are booted in boot_Irssi_Core above */
perl_eval_pv("foreach my $lib (qw("
"Irssi" " "
"Irssi::Irc" " "
"Irssi::UI" " "
"Irssi::TextUI"
")) { eval $lib . '::deinit();'; }", TRUE);
#endif
/* We could unload all libraries .. but this crashes with some
libraries, probably because we don't call some deinit function..
Anyway, this would free some memory with /SCRIPT RESET, but it
leaks memory anyway. */
/*perl_eval_pv("eval { foreach my $lib (@DynaLoader::dl_librefs) { DynaLoader::dl_unload_file($lib); } }", TRUE);*/
/* perl interpreter */
PL_perl_destruct_level = 1;
perl_destruct(my_perl);
perl_free(my_perl);
my_perl = NULL;
}
示例15: cmd_options_get_signal
/* `optlist' should contain only one unknown key - the server tag.
returns NULL if there was unknown -option */
static int cmd_options_get_signal(const char *cmd,
GHashTable *optlist)
{
GSList *list, *tmp, *next;
char *signame;
int signum;
/* get all the options, then remove the known ones. there should
be only one left - the signal */
list = hashtable_get_keys(optlist);
if (cmd != NULL) {
for (tmp = list; tmp != NULL; tmp = next) {
char *option = tmp->data;
next = tmp->next;
if (command_have_option(cmd, option))
list = g_slist_remove(list, option);
}
}
if (list == NULL)
return -1;
signame = list->data;
signum = -1;
signum = is_numeric(signame, 0) ? atol(signame) :
signal_name_to_id(signame);
if (signum == -1 || list->next != NULL) {
/* unknown option (not a signal) */
signal_emit("error command", 2,
GINT_TO_POINTER(CMDERR_OPTION_UNKNOWN),
signum == -1 ? list->data : list->next->data);
signal_stop();
return -2;
}
g_slist_free(list);
return signum;
}