本文整理汇总了C++中PrintTextf函数的典型用法代码示例。如果您正苦于以下问题:C++ PrintTextf函数的具体用法?C++ PrintTextf怎么用?C++ PrintTextf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PrintTextf函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dns_name_callback
static void
dns_name_callback (GObject *obj, GAsyncResult *result, gpointer user_data)
{
GResolver *resolver = G_RESOLVER(obj);
session *sess = (session*)user_data;
GList* addrs;
gchar* addr;
GList* list;
g_return_if_fail (is_session (sess));
addrs = g_resolver_lookup_by_name_finish (resolver, result, NULL);
if (addrs)
{
PrintText (sess, _("Resolved to:"));
for (list = g_list_first (addrs); list; list = g_list_next (list))
{
addr = g_inet_address_to_string (list->data);
PrintTextf (sess, " %s", addr);
}
g_resolver_free_addresses (addrs);
}
else
PrintText (sess, _("Not found"));
}
示例2: xchat_print
void xchat_print(xchat_plugin *ph, const char *text)
{
if (!is_session(ph->context))
{
DEBUG(PrintTextf(0, "%s\txchat_print called without a valid context.\n", ph->name));
return;
}
PrintText(ph->context, (char*)text);
}
示例3: servlist_cycle_cb
static gint servlist_cycle_cb(server *serv)
{
if (serv->network) {
PrintTextf(serv->server_session,
_("Cycling to next server in %s...\n"),
((ircnet *)serv->network)->name);
servlist_connect(serv->server_session, serv->network, TRUE);
}
return 0;
}
示例4: servlist_cycle_cb
static gint
servlist_cycle_cb (server *serv)
{
if (serv->network)
{
PrintTextf (serv->server_session,
_("Cycling to next server in %s...\n"), serv->network->name.c_str());
servlist_connect(serv->server_session, *serv->network, true);
}
return 0;
}
示例5: plugin_auto_load_cb
static void
plugin_auto_load_cb (char *filename)
{
char *pMsg;
pMsg = plugin_load (ps, filename, NULL);
if (pMsg)
{
PrintTextf (ps, "AutoLoad failed for: %s\n", filename);
PrintText (ps, pMsg);
}
}
示例6: dns_addr_callback
static void
dns_addr_callback (GObject *obj, GAsyncResult *result, gpointer user_data)
{
GResolver *resolver = G_RESOLVER(obj);
session *sess = (session*)user_data;
gchar *addr;
g_return_if_fail (is_session(sess));
addr = g_resolver_lookup_by_address_finish (resolver, result, NULL);
if (addr)
PrintTextf (sess, _("Resolved to %s"), addr);
else
PrintText (sess, _("Not found"));
}
示例7: plugin_auto_load_cb
static void plugin_auto_load_cb(char *filename)
{
char *pMsg;
#ifndef WIN32 /* black listed */
if (!strcmp(file_part(filename), "dbus.so"))
return;
#endif
pMsg = plugin_load(ps, filename, nullptr);
if (pMsg)
{
PrintTextf(ps, "AutoLoad failed for: %s\n", filename);
PrintText(ps, pMsg);
}
}
示例8: hexchat_command
void
hexchat_command (hexchat_plugin *ph, const char *command)
{
char *command_utf8;
if (!is_session (ph->context))
{
DEBUG(PrintTextf(0, "%s\thexchat_command called without a valid context.\n", ph->name));
return;
}
/* scripts/plugins continue to send non-UTF8... *sigh* */
command_utf8 = text_fixup_invalid_utf8 (command, -1, NULL);
handle_command (ph->context, command_utf8, FALSE);
g_free (command_utf8);
}
示例9: xchat_command
void xchat_command(xchat_plugin *ph, const char *command)
{
char *conv;
int len = -1;
if (!is_session(ph->context))
{
DEBUG(PrintTextf(0, "%s\txchat_command called without a valid context.\n", ph->name));
return;
}
// scripts/plugins continue to send non-UTF8... *sigh*
conv = text_validate((char**)&command, &len);
handle_command(ph->context, (char*)command, FALSE);
g_free (conv);
}
示例10: do_dns
void
do_dns (session *sess, char *nick, char *host,
const message_tags_data *tags_data)
{
GResolver *res = g_resolver_get_default ();
GInetAddress *addr;
char *po;
po = strrchr (host, '@');
if (po)
host = po + 1;
if (nick)
EMIT_SIGNAL_TIMESTAMP (XP_TE_RESOLVINGUSER, sess, tags_data->timestamp, nick, host);
PrintTextf (sess, _("Looking up %s..."), host);
addr = g_inet_address_new_from_string (host);
if (addr)
g_resolver_lookup_by_address_async (res, addr, NULL, dns_addr_callback, sess);
else
g_resolver_lookup_by_name_async (res, host, NULL, dns_name_callback, sess);
}
示例11: hexchat_get_info
const char *
hexchat_get_info (hexchat_plugin *ph, const char *id)
{
session *sess;
guint32 hash;
/* 1234567890 */
if (!strncmp (id, "event_text", 10))
{
char *e = (char *)id + 10;
if (*e == ' ') e++; /* 2.8.0 only worked without a space */
return text_find_format_string (e);
}
hash = str_hash (id);
/* do the session independant ones first */
switch (hash)
{
case 0x325acab5: /* libdirfs */
#ifdef USE_PLUGIN
return plugin_get_libdir ();
#else
return NULL;
#endif
case 0x14f51cd8: /* version */
return PACKAGE_VERSION;
case 0xdd9b1abd: /* xchatdir */
case 0xe33f6c4a: /* xchatdirfs */
case 0xd00d220b: /* configdir */
return get_xdir ();
}
sess = ph->context;
if (!is_session (sess))
{
DEBUG(PrintTextf(0, "%s\thexchat_get_info called without a valid context.\n", ph->name));
return NULL;
}
switch (hash)
{
case 0x2de2ee: /* away */
if (sess->server->is_away)
return sess->server->last_away_reason;
return NULL;
case 0x2c0b7d03: /* channel */
return sess->channel;
case 0x2c0d614c: /* charset */
{
const char *locale;
if (sess->server->encoding)
return sess->server->encoding;
locale = NULL;
g_get_charset (&locale);
return locale;
}
case 0x30f5a8: /* host */
return sess->server->hostname;
case 0x1c0e99c1: /* inputbox */
return fe_get_inputbox_contents (sess);
case 0x633fb30: /* modes */
return sess->current_modes;
case 0x6de15a2e: /* network */
return server_get_network (sess->server, FALSE);
case 0x339763: /* nick */
return sess->server->nick;
case 0x4889ba9b: /* password */
case 0x438fdf9: /* nickserv */
if (sess->server->network)
return ((ircnet *)sess->server->network)->pass;
return NULL;
case 0xca022f43: /* server */
if (!sess->server->connected)
return NULL;
return sess->server->servername;
case 0x696cd2f: /* topic */
return sess->topic;
case 0x3419f12d: /* gtkwin_ptr */
return fe_gui_info_ptr (sess, 1);
case 0x506d600b: /* native win_ptr */
return fe_gui_info_ptr (sess, 0);
case 0x6d3431b5: /* win_status */
switch (fe_gui_info (sess, 0)) /* check window status */
//.........这里部分代码省略.........
示例12: process_named_msg
//.........这里部分代码省略.........
return;
case WORDL('P','R','I','V'):
{
char *to = word[3];
int len;
int id = FALSE; /* identified */
if (*to)
{
text = word_eol[4];
if (*text == ':')
text++;
if (serv->have_idmsg)
{
if (*text == '+')
{
id = TRUE;
text++;
} else if (*text == '-')
text++;
}
len = strlen (text);
if (text[0] == 1 && text[len - 1] == 1) /* ctcp */
{
text[len - 1] = 0;
text++;
if (strncasecmp (text, "ACTION", 6) != 0)
flood_check (nick, ip, serv, sess, 0);
if (strncasecmp (text, "DCC ", 4) == 0)
/* redo this with handle_quotes TRUE */
process_data_init (word[1], word_eol[1], word, word_eol, TRUE, FALSE);
ctcp_handle (sess, to, nick, ip, text, word, word_eol, id);
} else
{
if (is_channel (serv, to))
{
if (ignore_check (word[1], IG_CHAN))
return;
inbound_chanmsg (serv, NULL, to, nick, text, FALSE, id);
} else
{
if (ignore_check (word[1], IG_PRIV))
return;
inbound_privmsg (serv, nick, ip, text, id);
}
}
}
}
return;
case WORDL('T','O','P','I'):
inbound_topicnew (serv, nick, word[3],
(word_eol[4][0] == ':') ? word_eol[4] + 1 : word_eol[4]);
return;
case WORDL('W','A','L','L'):
text = word_eol[3];
if (*text == ':')
text++;
EMIT_SIGNAL (XP_TE_WALLOPS, sess, nick, text, NULL, NULL, 0);
return;
}
}
else if (len == 3)
{
guint32 t;
t = WORDL((guint8)type[0], (guint8)type[1], (guint8)type[2], (guint8)type[3]);
switch (t)
{
case WORDL('C','A','P','\0'):
if (strncasecmp(word[4], "ACK", 3) == 0)
{
if (strncasecmp(word[5][0]==':' ? word[5]+1 : word[5],
"identify-msg", 12) == 0)
{
serv->have_idmsg = TRUE;
tcp_send_len(serv, "CAP END\r\n", 9);
}
}
else if (strncasecmp(word[4], "LS", 2) == 0)
{
if (strstr(word_eol[5], "identify-msg") != 0)
tcp_send_len(serv, "CAP REQ :identify-msg\r\n", 23);
else
tcp_send_len(serv, "CAP END\r\n", 9);
}
else if (strncasecmp(word[4], "NAK",3) == 0)
{
tcp_send_len(serv, "CAP END\r\n", 9);
}
return;
}
}
garbage:
/* unknown message */
PrintTextf (sess, "GARBAGE: %s\n", word_eol[1]);
}
示例13: process_numeric
//.........这里部分代码省略.........
case 318: /* END OF WHOIS */
if (!serv->skip_next_whois)
EMIT_SIGNAL (XP_TE_WHOIS6, whois_sess, word[4], NULL,
NULL, NULL, 0);
serv->skip_next_whois = 0;
serv->inside_whois = 0;
break;
case 313:
case 319:
if (!serv->skip_next_whois)
EMIT_SIGNAL (XP_TE_WHOIS2, whois_sess, word[4],
word_eol[5] + 1, NULL, NULL, 0);
break;
case 307: /* dalnet version */
case 320: /* :is an identified user */
if (!serv->skip_next_whois)
EMIT_SIGNAL (XP_TE_WHOIS_ID, whois_sess, word[4],
word_eol[5] + 1, NULL, NULL, 0);
break;
case 321:
if (!fe_is_chanwindow (sess->server))
EMIT_SIGNAL (XP_TE_CHANLISTHEAD, serv->server_session, NULL, NULL, NULL, NULL, 0);
break;
case 322:
if (fe_is_chanwindow (sess->server))
{
fe_add_chan_list (sess->server, word[4], word[5], word_eol[6] + 1);
} else
{
PrintTextf (serv->server_session, "%-16s %-7d %s\017\n",
word[4], atoi (word[5]), word_eol[6] + 1);
}
break;
case 323:
if (!fe_is_chanwindow (sess->server))
EMIT_SIGNAL (XP_TE_SERVTEXT, serv->server_session, text, word[1], word[2], NULL, 0);
else
fe_chan_list_end (sess->server);
break;
case 324:
sess = find_channel (serv, word[4]);
if (!sess)
sess = serv->server_session;
if (sess->ignore_mode)
sess->ignore_mode = FALSE;
else
EMIT_SIGNAL (XP_TE_CHANMODES, sess, word[4], word_eol[5],
NULL, NULL, 0);
fe_update_mode_buttons (sess, 't', '-');
fe_update_mode_buttons (sess, 'n', '-');
fe_update_mode_buttons (sess, 's', '-');
fe_update_mode_buttons (sess, 'i', '-');
fe_update_mode_buttons (sess, 'p', '-');
fe_update_mode_buttons (sess, 'm', '-');
fe_update_mode_buttons (sess, 'l', '-');
fe_update_mode_buttons (sess, 'k', '-');
handle_mode (serv, word, word_eol, "", TRUE);
break;
case 329:
示例14: cmd_set
int
cmd_set (struct session *sess, char *tbuf, char *word[], char *word_eol[])
{
int wild = FALSE;
int or = FALSE;
int off = FALSE;
int quiet = FALSE;
int erase = FALSE;
int i = 0, finds = 0, found;
int idx = 2;
int prev_numeric;
char *var, *val, *prev_string;
if (g_ascii_strcasecmp (word[2], "-e") == 0)
{
idx++;
erase = TRUE;
}
/* turn a bit OFF */
if (g_ascii_strcasecmp (word[idx], "-off") == 0)
{
idx++;
off = TRUE;
}
/* turn a bit ON */
if (g_ascii_strcasecmp (word[idx], "-or") == 0 || g_ascii_strcasecmp (word[idx], "-on") == 0)
{
idx++;
or = TRUE;
}
if (g_ascii_strcasecmp (word[idx], "-quiet") == 0)
{
idx++;
quiet = TRUE;
}
var = word[idx];
val = word_eol[idx+1];
if (!*var)
{
set_list (sess, tbuf);
return TRUE;
}
if ((strchr (var, '*') || strchr (var, '?')) && !*val)
{
wild = TRUE;
}
if (*val == '=')
{
val++;
}
do
{
if (wild)
{
found = !match (var, vars[i].name);
}
else
{
found = g_ascii_strcasecmp (var, vars[i].name);
}
if (found == 0)
{
finds++;
switch (vars[i].type)
{
case TYPE_STR:
if (erase || *val)
{
/* save the previous value until we print it out */
prev_string = (char*) malloc (vars[i].len + 1);
strncpy (prev_string, (char *) &prefs + vars[i].offset, vars[i].len);
/* update the variable */
strncpy ((char *) &prefs + vars[i].offset, val, vars[i].len);
((char *) &prefs)[vars[i].offset + vars[i].len - 1] = 0;
if (!quiet)
{
PrintTextf (sess, "%s set to: %s (was: %s)\n", var, (char *) &prefs + vars[i].offset, prev_string);
}
free (prev_string);
}
else
{
set_showval (sess, &vars[i], tbuf);
}
break;
case TYPE_INT:
case TYPE_BOOL:
if (*val)
//.........这里部分代码省略.........
示例15: xchat_get_info
const char* xchat_get_info(xchat_plugin *ph, const char *id)
{
session *sess;
unsigned int hash;
// 1234567890
if (!strncmp(id, "event_text", 10))
{
char *e = (char*)id + 10;
if (*e == ' ') e++; // 2.8.0 only worked without a space
return text_find_format_string(e);
}
hash = str_hash(id);
// do the session independant ones first
switch (hash)
{
case 0x325acab5: // libdirfs
return XCHATLIBDIR;
case 0x14f51cd8: // version
return PACKAGE_VERSION;
case 0xdd9b1abd: // xchatdir
return get_xdir_utf8();
case 0xe33f6c4a: // xchatdirfs
return get_xdir_fs();
}
sess = ph->context;
if (!is_session(sess))
{
DEBUG(PrintTextf(0, "%s\txchat_get_info called without a valid context.\n", ph->name));
return nullptr;
}
switch (hash)
{
case 0x2de2ee: // away
if (sess->server->is_away)
return sess->server->last_away_reason;
return nullptr;
case 0x2c0b7d03: // channel
return sess->channel;
case 0x2c0d614c: // charset
{
const char *locale;
if (sess->server->encoding)
return sess->server->encoding;
locale = nullptr;
g_get_charset(&locale);
return locale;
}
case 0x30f5a8: // host
return sess->server->hostname;
case 0x1c0e99c1: // inputbox
return fe_get_inputbox_contents(sess);
case 0x633fb30: // modes
return sess->current_modes;
case 0x6de15a2e: // network
return server_get_network(sess->server, FALSE);
case 0x339763: // nick
return sess->server->nick;
case 0x438fdf9: // nickserv
if (sess->server->network)
return ((ircnet*)sess->server->network)->nickserv;
return nullptr;
case 0xca022f43: // server
if (!sess->server->connected)
return nullptr;
return sess->server->servername;
case 0x696cd2f: // topic
return sess->topic;
case 0x3419f12d: // gtkwin_ptr
return (const char*)fe_gui_info_ptr(sess, 1);
case 0x506d600b: // native win_ptr
return (const char*)fe_gui_info_ptr(sess, 0);
case 0x6d3431b5: // win_status
switch (fe_gui_info(sess, 0)) // check window status
{
case 0: return "normal";
case 1: return "active";
case 2: return "hidden";
}
//.........这里部分代码省略.........