本文整理汇总了C++中signal_emit函数的典型用法代码示例。如果您正苦于以下问题:C++ signal_emit函数的具体用法?C++ signal_emit怎么用?C++ signal_emit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了signal_emit函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:svn2github,项目名称:irssi,代码行数:20,代码来源:themes.c
示例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);
}
开发者ID:markhibberd,项目名称:irssi-xmpp,代码行数:20,代码来源:xmpp-servers.c
示例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);
}
开发者ID:svn2github,项目名称:irssi,代码行数:20,代码来源:ctcp.c
示例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);
}
开发者ID:svn2github,项目名称:irssi,代码行数:20,代码来源:queries.c
示例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);
}
开发者ID:svn2github,项目名称:irssi,代码行数:20,代码来源:gui-windows.c
示例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;
}
开发者ID:svn2github,项目名称:irssi,代码行数:20,代码来源:netsplit.c
示例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;
}
开发者ID:svn2github,项目名称:irssi,代码行数:20,代码来源:notifylist.c
示例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);
}
开发者ID:svn2github,项目名称:irssi,代码行数:21,代码来源:irc-commands.c
示例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);
}
}
开发者ID:svn2github,项目名称:irssi,代码行数:20,代码来源:dcc-chat.c
示例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);
}
开发者ID:svn2github,项目名称:irssi,代码行数:20,代码来源:modes.c
示例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);
}
开发者ID:svn2github,项目名称:irssi,代码行数:20,代码来源:channels.c
示例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;
}
开发者ID:FabrizioFabbe,项目名称:silc,代码行数:41,代码来源:mainwindows.c
示例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);
}
开发者ID:Manishearth,项目名称:irssi,代码行数:41,代码来源:listen.c
示例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;
}
开发者ID:ilbelkyr,项目名称:irssi,代码行数:42,代码来源:perl-core.c
示例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;
}
开发者ID:svn2github,项目名称:irssi,代码行数:43,代码来源:fe-exec.c
示例16: perl_script_eval
static int perl_script_eval(PERL_SCRIPT_REC *script)
{
dSP;
char *error;
int retcount;
SV *ret;
ENTER;
SAVETMPS;
PUSHMARK(SP);
XPUSHs(sv_2mortal(new_pv(script->path != NULL ? script->path :
script->data)));
XPUSHs(sv_2mortal(new_pv(script->name)));
PUTBACK;
retcount = perl_call_pv(script->path != NULL ?
"Irssi::Core::eval_file" :
"Irssi::Core::eval_data",
G_EVAL|G_SCALAR);
SPAGAIN;
error = NULL;
if (SvTRUE(ERRSV)) {
error = SvPV(ERRSV, PL_na);
if (error != NULL) {
error = g_strdup(error);
signal_emit("script error", 2, script, error);
g_free(error);
}
} else if (retcount > 0) {
ret = POPs;
}
PUTBACK;
FREETMPS;
LEAVE;
return error == NULL;
}
开发者ID:svn2github,项目名称:irssi,代码行数:41,代码来源:perl-core.c
示例17: eval_special_string
/* execute the commands in string - commands can be split with ';' */
void eval_special_string(const char *cmd, const char *data,
SERVER_REC *server, void *item)
{
const char *cmdchars;
char *orig, *str, *start, *ret;
int arg_used;
cmdchars = settings_get_str("cmdchars");
orig = start = str = g_strdup(cmd);
do {
if (is_split_char(str, start))
*str++ = '\0';
else if (*str != '\0') {
str++;
continue;
}
ret = parse_special_string(start, server, item,
data, &arg_used);
if (strchr(cmdchars, *ret) == NULL) {
/* no command char - let's put it there.. */
char *old = ret;
ret = g_strdup_printf("%c%s", *cmdchars, old);
g_free(old);
}
if (!arg_used && *data != '\0') {
/* append the string with all the arguments */
char *old = ret;
ret = g_strconcat(old, " ", data, NULL);
g_free(old);
}
signal_emit("send command", 3, ret, server, item);
g_free(ret);
start = str;
} while (*start != '\0');
g_free(orig);
}
开发者ID:svn2github,项目名称:irssi,代码行数:42,代码来源:special-vars.c
示例18: mainwindows_resize_smaller
static void mainwindows_resize_smaller(int ychange, int xchange)
{
GSList *sorted, *tmp;
int space;
space = 0;
for (tmp = mainwindows; tmp != NULL; tmp = tmp->next) {
MAIN_WINDOW_REC *rec = tmp->data;
space += rec->lines-WINDOW_MIN_SIZE;
}
if (space < -ychange) {
/* not enough space, use different algorithm */
mainwindows_resize_too_small(ychange, xchange);
return;
}
/* resize windows that have space */
sorted = mainwindows_get_sorted(TRUE);
for (tmp = sorted; tmp != NULL && ychange < 0; tmp = tmp->next) {
MAIN_WINDOW_REC *rec = tmp->data;
space = rec->lines-WINDOW_MIN_SIZE;
if (space <= 0) {
rec->first_line += ychange;
rec->last_line += ychange;
signal_emit("mainwindow moved", 1, rec);
continue;
}
if (space <= 0) space = 1;
if (space > -ychange) space = -ychange;
rec->last_line += ychange;
ychange += space;
rec->first_line += ychange;
mainwindow_resize(rec, -space, xchange);
}
g_slist_free(sorted);
}
开发者ID:svn2github,项目名称:irssi,代码行数:41,代码来源:mainwindows.c
示例19: window_item_remove
void window_item_remove(WI_ITEM_REC *item)
{
WINDOW_REC *window;
g_return_if_fail(item != NULL);
window = window_item_window(item);
if (window == NULL)
return;
item->window = NULL;
window->items = g_slist_remove(window->items, item);
if (window->active == item) {
window_item_set_active(window, window->items == NULL ? NULL :
window->items->data);
}
signal_emit("window item remove", 2, window, item);
}
开发者ID:svn2github,项目名称:irssi,代码行数:21,代码来源:window-items.c
示例20: gui_window_created
static void gui_window_created(WINDOW_REC *window)
{
MAIN_WINDOW_REC *parent;
g_return_if_fail(window != NULL);
parent = window_create_override != 0 &&
active_win != NULL && WINDOW_GUI(active_win) != NULL ?
WINDOW_GUI(active_win)->parent : mainwindow_create();
if (parent == NULL) {
/* not enough space for new window, but we really can't
abort creation of the window anymore, so create hidden
window instead. */
parent = WINDOW_GUI(active_win)->parent;
}
window_create_override = -1;
if (parent->active == NULL) parent->active = window;
window->gui_data = gui_window_init(window, parent);
signal_emit("gui window created", 1, window);
}
开发者ID:svn2github,项目名称:irssi,代码行数:21,代码来源:gui-windows.c
注:本文中的signal_emit函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论