本文整理汇总了C++中printformat函数的典型用法代码示例。如果您正苦于以下问题:C++ printformat函数的具体用法?C++ printformat怎么用?C++ printformat使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了printformat函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: event_topic_info
static void event_topic_info(IRC_SERVER_REC *server, const char *data)
{
const char *channel;
char *params, *timestr, *bynick, *byhost, *topictime;
g_return_if_fail(data != NULL);
params = event_get_params(data, 4, NULL, &channel,
&bynick, &topictime);
timestr = my_asctime((time_t) atol(topictime));
byhost = strchr(bynick, '!');
if (byhost != NULL)
*byhost++ = '\0';
channel = get_visible_target(server, channel);
printformat(server, channel, MSGLEVEL_CRAP, IRCTXT_TOPIC_INFO,
bynick, timestr, byhost == NULL ? "" : byhost);
g_free(timestr);
g_free(params);
}
开发者ID:svn2github,项目名称:irssi,代码行数:22,代码来源:fe-events-numeric.c
示例2: dcc_connected
static void dcc_connected(CHAT_DCC_REC *dcc)
{
char *sender;
if (!IS_DCC_CHAT(dcc)) return;
sender = g_strconcat("=", dcc->id, NULL);
printformat(dcc->server, NULL, MSGLEVEL_DCC,
IRCTXT_DCC_CHAT_CONNECTED,
dcc->id, dcc->addrstr, dcc->port);
if (query_find(NULL, sender) == NULL) {
int level = settings_get_level("autocreate_query_level");
int autocreate_dccquery = (level & MSGLEVEL_DCCMSGS) != 0;
if (!autocreate_dccquery)
completion_last_message_add(sender);
else
irc_query_create(dcc->servertag, sender, TRUE);
}
g_free(sender);
}
开发者ID:Adam-,项目名称:irssi,代码行数:22,代码来源:fe-dcc-chat.c
示例3: chat_protocol_find_net
static SERVER_SETUP_REC *create_server_setup(GHashTable *optlist)
{
CHAT_PROTOCOL_REC *rec;
SERVER_SETUP_REC *server;
char *chatnet;
rec = chat_protocol_find_net(optlist);
if (rec == NULL)
rec = chat_protocol_get_default();
else {
chatnet = g_hash_table_lookup(optlist, rec->chatnet);
if (chatnet_find(chatnet) == NULL) {
printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE,
TXT_UNKNOWN_CHATNET, chatnet);
return NULL;
}
}
server = rec->create_server_setup();
server->chat_type = rec->id;
return server;
}
开发者ID:FabrizioFabbe,项目名称:silc,代码行数:22,代码来源:fe-server.c
示例4: set_print_pattern
static void set_print_pattern(const char *pattern)
{
GSList *sets, *tmp;
const char *last_section;
last_section = "";
sets = settings_get_sorted();
for (tmp = sets; tmp != NULL; tmp = tmp->next) {
SETTINGS_REC *rec = tmp->data;
if (stristr(rec->key, pattern) == NULL)
continue;
if (g_strcmp0(last_section, rec->section) != 0) {
/* print section */
printformat(NULL, NULL, MSGLEVEL_CLIENTCRAP,
TXT_SET_TITLE, rec->section);
last_section = rec->section;
}
set_print(rec);
}
g_slist_free(sets);
}
开发者ID:ahf,项目名称:irssi,代码行数:22,代码来源:fe-settings.c
示例5: set_print
static void set_print(SETTINGS_REC *rec)
{
const char *value;
char value_int[MAX_INT_STRLEN];
switch (rec->type) {
case SETTING_TYPE_BOOLEAN:
value = settings_get_bool(rec->key) ? "ON" : "OFF";
break;
case SETTING_TYPE_INT:
ltoa(value_int, settings_get_int(rec->key));
value = value_int;
break;
case SETTING_TYPE_STRING:
value = settings_get_str(rec->key);
break;
default:
value = "";
}
printformat(NULL, NULL, MSGLEVEL_CLIENTCRAP, TXT_SET_ITEM,
rec->key, value);
}
开发者ID:svn2github,项目名称:irssi,代码行数:22,代码来源:fe-settings.c
示例6: theme_save
static void theme_save(THEME_REC *theme, int save_all)
{
CONFIG_REC *config;
THEME_SAVE_REC data;
char *path;
int ok;
config = config_open(theme->path, -1);
if (config != NULL)
config_parse(config);
else {
if (g_strcasecmp(theme->name, "default") == 0) {
config = config_open(NULL, -1);
config_parse_data(config, default_theme, "internal");
config_change_file_name(config, theme->path, 0660);
} else {
config = config_open(theme->path, 0660);
if (config == NULL)
return;
config_parse(config);
}
}
data.config = config;
data.save_all = save_all;
g_hash_table_foreach(theme->modules, (GHFunc) module_save, &data);
/* always save the theme to ~/.irssi/ */
path = g_strdup_printf("%s/%s", get_irssi_dir(),
g_basename(theme->path));
ok = config_write(config, path, 0660) == 0;
printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE,
ok ? TXT_THEME_SAVED : TXT_THEME_SAVE_FAILED,
path, config_last_error(config));
g_free(path);
config_close(config);
}
开发者ID:svn2github,项目名称:irssi,代码行数:39,代码来源:themes.c
示例7: cmd_unignore
/* SYNTAX: UNIGNORE <id>|<mask> */
static void cmd_unignore(const char *data)
{
IGNORE_REC *rec;
GSList *tmp;
char *mask;
void *free_arg;
if (!cmd_get_params(data, &free_arg, 1, &mask))
return;
if (*mask == '\0')
cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);
if (is_numeric(mask, ' ')) {
/* with index number */
tmp = g_slist_nth(ignores, atoi(mask)-1);
rec = tmp == NULL ? NULL : tmp->data;
} else {
/* with mask */
const char *chans[2] = { "*", NULL };
if (active_win->active_server != NULL &&
server_ischannel(active_win->active_server, mask)) {
chans[0] = mask;
mask = NULL;
}
rec = ignore_find("*", mask, (char **) chans);
}
if (rec != NULL) {
rec->level = 0;
ignore_update_rec(rec);
} else {
printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE,
TXT_IGNORE_NOT_FOUND, mask);
}
cmd_params_free(free_arg);
}
开发者ID:FauxFaux,项目名称:irssi,代码行数:39,代码来源:fe-ignore.c
示例8: event_whois_channels
static void event_whois_channels(IRC_SERVER_REC *server, const char *data)
{
char *params, *nick, *chans, *recoded;
g_return_if_fail(data != NULL);
params = event_get_params(data, 3, NULL, &nick, &chans);
/* sure - we COULD print the channel names as-is, but since the
colors, bolds, etc. are mostly just to fool people, I think we
should show the channel names as they REALLY are so they could
even be joined without any extra tricks. */
chans = show_lowascii(chans);
if (settings_get_bool("whois_hide_safe_channel_id"))
hide_safe_channel_id(server, chans);
recoded = recode_in(SERVER(server), chans, nick);
printformat(server, nick, MSGLEVEL_CRAP,
IRCTXT_WHOIS_CHANNELS, nick, recoded);
g_free(chans);
g_free(params);
g_free(recoded);
}
开发者ID:xinutec,项目名称:irssi,代码行数:23,代码来源:fe-whois.c
示例9: ctcp_default_reply
static void ctcp_default_reply(IRC_SERVER_REC *server, const char *data,
const char *nick, const char *addr,
const char *target)
{
const char *ctcpdata;
char *ctcp, *ptr;
g_return_if_fail(data != NULL);
ctcp = g_strdup(data);
ptr = strchr(ctcp, ' ');
if (ptr == NULL)
ctcpdata = "";
else {
*ptr = '\0';
ctcpdata = ptr+1;
}
printformat(server, ischannel(*target) ? target : nick, MSGLEVEL_CTCPS,
ischannel(*target) ? IRCTXT_CTCP_REPLY_CHANNEL :
IRCTXT_CTCP_REPLY, ctcp, nick, ctcpdata, target);
g_free(ctcp);
}
开发者ID:svn2github,项目名称:irssi,代码行数:23,代码来源:fe-ctcp.c
示例10: event_who
static void event_who(IRC_SERVER_REC *server, const char *data)
{
char *params, *nick, *channel, *user, *host, *stat, *realname, *hops;
char *serv, *recoded;
g_return_if_fail(data != NULL);
params = event_get_params(data, 8, NULL, &channel, &user,
&host, &serv, &nick, &stat, &realname);
/* split hops/realname */
hops = realname;
while (*realname != '\0' && *realname != ' ') realname++;
if (*realname == ' ')
*realname++ = '\0';
recoded = recode_in(SERVER(server), realname, nick);
printformat(server, NULL, MSGLEVEL_CRAP, IRCTXT_WHO,
channel, nick, stat, hops, user, host, recoded, serv);
g_free(params);
g_free(recoded);
}
开发者ID:svn2github,项目名称:irssi,代码行数:23,代码来源:fe-events-numeric.c
示例11: event_away
static void event_away(IRC_SERVER_REC *server, const char *data)
{
char *params, *nick, *awaymsg, *recoded;
g_return_if_fail(data != NULL);
params = event_get_params(data, 3, NULL, &nick, &awaymsg);
recoded = recode_in(SERVER(server), awaymsg, nick);
if (!settings_get_bool("show_away_once") ||
last_away_nick == NULL || g_strcasecmp(last_away_nick, nick) != 0 ||
last_away_msg == NULL || g_strcasecmp(last_away_msg, awaymsg) != 0) {
/* don't show the same away message
from the same nick all the time */
g_free_not_null(last_away_nick);
g_free_not_null(last_away_msg);
last_away_nick = g_strdup(nick);
last_away_msg = g_strdup(awaymsg);
printformat(server, nick, MSGLEVEL_CRAP,
IRCTXT_NICK_AWAY, nick, recoded);
}
g_free(params);
g_free(recoded);
}
开发者ID:svn2github,项目名称:irssi,代码行数:24,代码来源:fe-events-numeric.c
示例12: sig_message_own_action
static void sig_message_own_action(IRC_SERVER_REC *server, const char *msg,
const char *target)
{
void *item;
const char *oldtarget;
char *freemsg = NULL;
oldtarget = target;
target = fe_channel_skip_prefix(IRC_SERVER(server), target);
if (server_ischannel(SERVER(server), target))
item = irc_channel_find(server, target);
else
item = irc_query_find(server, target);
if (settings_get_bool("emphasis"))
msg = freemsg = expand_emphasis(item, msg);
printformat(server, target,
MSGLEVEL_ACTIONS | MSGLEVEL_NOHILIGHT | MSGLEVEL_NO_ACT |
(server_ischannel(SERVER(server), target) ? MSGLEVEL_PUBLIC : MSGLEVEL_MSGS),
item != NULL && oldtarget == target ? IRCTXT_OWN_ACTION : IRCTXT_OWN_ACTION_TARGET,
server->nick, msg, oldtarget);
g_free_not_null(freemsg);
}
开发者ID:ailin-nemui,项目名称:irssi,代码行数:24,代码来源:fe-irc-messages.c
示例13: glog_func
void glog_func(const char *log_domain, GLogLevelFlags log_level,
const char *message)
{
const char *reason;
switch (log_level) {
case G_LOG_LEVEL_WARNING:
reason = "warning";
break;
case G_LOG_LEVEL_CRITICAL:
reason = "critical";
break;
default:
reason = "error";
break;
}
if (windows == NULL)
fprintf(stderr, "GLib %s: %s\n", reason, message);
else {
printformat(NULL, NULL, MSGLEVEL_CLIENTERROR,
TXT_GLIB_ERROR, reason, message);
}
}
开发者ID:rrebello,项目名称:irssi,代码行数:24,代码来源:fe-common-core.c
示例14: cmd_channel_add
/* SYNTAX: CHANNEL ADD [-auto | -noauto] [-bots <masks>] [-botcmd <command>]
<channel> <chatnet> [<password>] */
static void cmd_channel_add(const char *data)
{
GHashTable *optlist;
CHANNEL_SETUP_REC *rec;
char *botarg, *botcmdarg, *chatnet, *channel, *password;
void *free_arg;
if (!cmd_get_params(data, &free_arg, 3 | PARAM_FLAG_OPTIONS,
"channel add", &optlist, &channel, &chatnet, &password))
return;
botarg = g_hash_table_lookup(optlist, "bots");
botcmdarg = g_hash_table_lookup(optlist, "botcmd");
if (*chatnet == '\0' || *channel == '\0')
cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);
rec = channels_setup_find(channel, chatnet);
if (rec == NULL) {
rec = g_new0(CHANNEL_SETUP_REC, 1);
rec->name = g_strdup(channel);
rec->chatnet = g_strdup(chatnet);
} else {
if (g_hash_table_lookup(optlist, "bots")) g_free_and_null(rec->botmasks);
if (g_hash_table_lookup(optlist, "botcmd")) g_free_and_null(rec->autosendcmd);
if (*password != '\0') g_free_and_null(rec->password);
}
if (g_hash_table_lookup(optlist, "auto")) rec->autojoin = TRUE;
if (g_hash_table_lookup(optlist, "noauto")) rec->autojoin = FALSE;
if (botarg != NULL && *botarg != '\0') rec->botmasks = g_strdup(botarg);
if (botcmdarg != NULL && *botcmdarg != '\0') rec->autosendcmd = g_strdup(botcmdarg);
if (*password != '\0' && strcmp(password, "-") != 0) rec->password = g_strdup(password);
channels_setup_create(rec);
printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, IRCTXT_CHANSETUP_ADDED, channel, chatnet);
cmd_params_free(free_arg);
}
开发者ID:svn2github,项目名称:irssi,代码行数:38,代码来源:fe-channels.c
示例15: sig_module_loaded
static void sig_module_loaded(MODULE_REC *module, MODULE_FILE_REC *file)
{
printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE,
TXT_MODULE_LOADED, module->name, file->name);
}
开发者ID:svn2github,项目名称:irssi,代码行数:5,代码来源:fe-modules.c
示例16: cmd_log_open
/* SYNTAX: LOG OPEN [-noopen] [-autoopen] [-window] [-<server tag>]
[-targets <targets>] [-colors]
<fname> [<levels>] */
static void cmd_log_open(const char *data)
{
SERVER_REC *server;
GHashTable *optlist;
char *targetarg, *fname, *levels, *servertag;
void *free_arg;
char window[MAX_INT_STRLEN];
LOG_REC *log;
int level;
if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_GETREST |
PARAM_FLAG_UNKNOWN_OPTIONS | PARAM_FLAG_OPTIONS |
PARAM_FLAG_STRIP_TRAILING_WS, "log open", &optlist,
&fname, &levels))
return;
if (*fname == '\0') cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);
level = level2bits(levels, NULL);
log = log_create_rec(fname, level != 0 ? level : MSGLEVEL_ALL);
/* -<server tag> */
server = cmd_options_get_server("log open", optlist, NULL);
servertag = server == NULL ? NULL : server->tag;
if (g_hash_table_lookup(optlist, "window")) {
/* log by window ref# */
targetarg = g_hash_table_lookup(optlist, "targets");
if (targetarg == NULL || !is_numeric(targetarg, '\0')) {
ltoa(window, active_win->refnum);
targetarg = window;
}
log_item_add(log, LOG_ITEM_WINDOW_REFNUM, targetarg,
servertag);
} else {
targetarg = g_hash_table_lookup(optlist, "targets");
if (targetarg != NULL && *targetarg != '\0')
log_add_targets(log, targetarg, servertag);
else if (servertag != NULL)
log_add_targets(log, "*", servertag);
}
if (g_hash_table_lookup(optlist, "autoopen"))
log->autoopen = TRUE;
if (g_hash_table_lookup(optlist, "colors") == NULL)
log->colorizer = log_colorizer_strip;
log_update(log);
if (log->handle == -1 && g_hash_table_lookup(optlist, "noopen") == NULL) {
/* start logging */
if (log_start_logging(log)) {
printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE,
TXT_LOG_OPENED, fname);
} else {
log_close(log);
}
}
cmd_params_free(free_arg);
}
开发者ID:ailin-nemui,项目名称:irssi,代码行数:64,代码来源:fe-log.c
示例17: sig_log_create_failed
static void sig_log_create_failed(LOG_REC *log)
{
printformat(NULL, NULL, MSGLEVEL_CLIENTERROR,
TXT_LOG_CREATE_FAILED,
log->real_fname, g_strerror(errno));
}
开发者ID:ailin-nemui,项目名称:irssi,代码行数:6,代码来源:fe-log.c
示例18: sig_log_locked
static void sig_log_locked(LOG_REC *log)
{
printformat(NULL, NULL, MSGLEVEL_CLIENTERROR,
TXT_LOG_LOCKED, log->real_fname);
}
开发者ID:ailin-nemui,项目名称:irssi,代码行数:5,代码来源:fe-log.c
示例19: cmd_ignore
static void cmd_ignore(const char *data)
{
/* /IGNORE [-regexp | -word] [-pattern <pattern>] [-except]
[-replies] [-channels <channel>] <mask> <levels>
OR
/IGNORE [-regexp | -word] [-pattern <pattern>] [-except] [-replies]
<channels> <levels> */
GHashTable *optlist;
IGNORE_REC *rec;
char *patternarg, *chanarg, *mask, *levels, *key;
char **channels;
void *free_arg;
int new_ignore;
if (*data == '\0') {
cmd_ignore_show();
return;
}
if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_OPTIONS | PARAM_FLAG_GETREST,
"ignore", &optlist, &mask, &levels))
return;
patternarg = g_hash_table_lookup(optlist, "pattern");
chanarg = g_hash_table_lookup(optlist, "channels");
if (*levels == '\0') cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);
if (ischannel(*mask)) {
chanarg = mask;
mask = "";
}
channels = (chanarg == NULL || *chanarg == '\0') ? NULL :
g_strsplit(replace_chars(chanarg, ',', ' '), " ", -1);
rec = ignore_find(NULL, mask, channels);
new_ignore = rec == NULL;
if (rec == NULL) {
rec = g_new0(IGNORE_REC, 1);
rec->mask = *mask == '\0' ? NULL : g_strdup(mask);
rec->channels = channels;
} else {
g_free_and_null(rec->pattern);
g_strfreev(channels);
}
if (g_hash_table_lookup(optlist, "except") != NULL) {
rec->except_level = combine_level(rec->except_level, levels);
} else {
ignore_split_levels(levels, &rec->level, &rec->except_level);
}
rec->pattern = (patternarg == NULL || *patternarg == '\0') ?
NULL : g_strdup(patternarg);
rec->regexp = g_hash_table_lookup(optlist, "regexp") != NULL;
rec->fullword = g_hash_table_lookup(optlist, "word") != NULL;
rec->replies = g_hash_table_lookup(optlist, "replies") != NULL;
if (rec->level == 0 && rec->except_level == 0) {
printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, IRCTXT_UNIGNORED,
rec->mask == NULL ? "" : rec->mask);
} else {
key = ignore_get_key(rec);
levels = ignore_get_levels(rec->level, rec->except_level);
printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, IRCTXT_IGNORED, key, levels);
g_free(key);
g_free(levels);
}
if (new_ignore)
ignore_add_rec(rec);
else
ignore_update_rec(rec);
cmd_params_free(free_arg);
}
开发者ID:svn2github,项目名称:irssi,代码行数:79,代码来源:fe-ignore.c
示例20: cmd_ignore
static void cmd_ignore(const char *data)
{
/* /IGNORE [-regexp | -word] [-pattern <pattern>] [-except]
[-channels <channel>] <mask> <levels>
OR
/IGNORE [-regexp | -word] [-pattern <pattern>] [-except]
<channels> <levels> */
char *params, *args, *patternarg, *chanarg, *mask, *levels, *key;
char **channels;
IGNORE_REC *rec;
int new_ignore;
if (*data == '\0') {
cmd_ignore_show();
return;
}
args = "pattern channels";
params = cmd_get_params(data, 5 | PARAM_FLAG_MULTIARGS | PARAM_FLAG_GETREST,
&args, &patternarg, &chanarg, &mask, &levels);
if (*levels == '\0') cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);
if (ischannel(*mask)) {
chanarg = mask;
mask = "";
}
channels = *chanarg == '\0' ? NULL :
g_strsplit(replace_chars(chanarg, ',', ' '), " ", -1);
rec = ignore_find(NULL, mask, channels);
new_ignore = rec == NULL;
if (rec == NULL) {
rec = g_new0(IGNORE_REC, 1);
rec->mask = *mask == '\0' ? NULL : g_strdup(mask);
rec->channels = channels;
} else {
g_free_and_null(rec->pattern);
g_strfreev(channels);
}
if (stristr(args, "-except") != NULL) {
rec->except_level = combine_level(rec->except_level, levels);
} else {
ignore_split_levels(levels, &rec->level, &rec->except_level);
}
rec->pattern = *patternarg == '\0' ? NULL : g_strdup(patternarg);
rec->regexp = stristr(args, "-regexp") != NULL;
rec->fullword = stristr(args, "-word") != NULL;
rec->replies = stristr(args, "-replies") != NULL;
if (rec->level == 0 && rec->except_level == 0) {
printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, IRCTXT_UNIGNORED,
rec->mask == NULL ? "" : rec->mask);
} else {
key = ignore_get_key(rec);
levels = ignore_get_levels(rec->level, rec->except_level);
printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, IRCTXT_IGNORED, key, levels);
g_free(key);
g_free(levels);
}
if (new_ignore)
ignore_add_rec(rec);
else
ignore_update_rec(rec);
g_free(params);
}
开发者ID:svn2github,项目名称:irssi,代码行数:72,代码来源:fe-ignore.c
注:本文中的printformat函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论