本文整理汇总了C++中PrintTextf函数的典型用法代码示例。如果您正苦于以下问题:C++ PrintTextf函数的具体用法?C++ PrintTextf怎么用?C++ PrintTextf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PrintTextf函数的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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"));
}
开发者ID:TheWug,项目名称:hexchat,代码行数:27,代码来源:inbound.c
示例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);
}
开发者ID:wowzaman12,项目名称:libPChat,代码行数:10,代码来源:plugin.cpp
示例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;
}
开发者ID:xchat-gnome,项目名称:xchat-gnome,代码行数:11,代码来源:servlist.c
示例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;
}
开发者ID:leeter,项目名称:hexchat,代码行数:12,代码来源:servlist.cpp
示例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);
}
}
开发者ID:IotaSpencer,项目名称:hexchat,代码行数:12,代码来源:plugin.c
示例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"));
}
开发者ID:TheWug,项目名称:hexchat,代码行数:15,代码来源:inbound.c
示例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);
}
}
开发者ID:wowzaman12,项目名称:libPChat,代码行数:16,代码来源:plugin.cpp
示例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);
}
开发者ID:IotaSpencer,项目名称:hexchat,代码行数:16,代码来源:plugin.c
示例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);
}
开发者ID:wowzaman12,项目名称:libPChat,代码行数:16,代码来源:plugin.cpp
示例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);
}
开发者ID:TheWug,项目名称:hexchat,代码行数:23,代码来源:inbound.c
示例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 */
//.........这里部分代码省略.........
开发者ID:IotaSpencer,项目名称:hexchat,代码行数:101,代码来源:plugin.c
示例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]);
}
开发者ID:Elrina,项目名称:xchat,代码行数:101,代码来源:proto-irc.c
示例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:
开发者ID:Elrina,项目名称:xchat,代码行数:67,代码来源:proto-irc.c
示例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)
//.........这里部分代码省略.........
开发者ID:IshaqAzmi,项目名称:hexchat,代码行数:101,代码来源:cfgfiles.c
示例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";
}
//.........这里部分代码省略.........
开发者ID:wowzaman12,项目名称:libPChat,代码行数:101,代码来源:plugin.cpp
示例16: process_named_msg
//.........这里部分代码省略.........
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;
guint32 want_cap; /* format the CAP REQ string based on previous capabilities being requested or not */
guint32 want_sasl; /* CAP END shouldn't be sent when SASL is requested, it needs further responses */
char *pass; /* buffer for SASL password */
char buffer[256]; /* buffer for requesting capabilities and emitting the signal */
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)
{
EMIT_SIGNAL (XP_TE_CAPACK, sess->server->server_session, word[1], word[5][0]==':' ? ++word_eol[5] : word_eol[5], NULL, NULL, 0);
if (strstr (word_eol[5], "identify-msg") != 0)
{
serv->have_idmsg = TRUE;
}
if (strstr (word_eol[5], "multi-prefix") != 0)
{
serv->have_namesx = TRUE;
}
if (strstr (word_eol[5], "sasl") != 0)
{
serv->have_sasl = TRUE;
EMIT_SIGNAL (XP_TE_SASLAUTH, serv->server_session, sess->server->sasluser, NULL, NULL, NULL, 0);
tcp_send_len (serv, "AUTHENTICATE PLAIN\r\n", 20);
pass = encode_sasl_pass (sess->server->sasluser, sess->server->saslpassword);
tcp_sendf (sess->server, "AUTHENTICATE %s\r\n", pass);
free (pass);
}
}
else if (strncasecmp (word[4], "LS", 2) == 0)
{
EMIT_SIGNAL (XP_TE_CAPLIST, serv->server_session, word[1], word[5][0]==':' ? ++word_eol[5] : word_eol[5], NULL, NULL, 0);
want_cap = 0;
want_sasl = 0;
if (strstr (word_eol[5], "identify-msg") != 0)
{
strcpy (buffer, "CAP REQ :identify-msg");
want_cap = 1;
}
if (strstr (word_eol[5], "multi-prefix") != 0)
{
want_cap ? strcat (buffer, " multi-prefix") : strcpy (buffer, "CAP REQ :multi-prefix");
want_cap = 1;
}
/* if the SASL password is set, request SASL auth */
if (strstr (word_eol[5], "sasl") != 0 && strlen (sess->server->saslpassword) != 0)
{
want_cap ? strcat (buffer, " sasl") : strcpy (buffer, "CAP REQ :sasl");
want_sasl = 1;
}
if (want_cap)
{
/* buffer + 9 = emit buffer without "CAP REQ :" */
EMIT_SIGNAL (XP_TE_CAPREQ, sess->server->server_session, buffer + 9, NULL, NULL, NULL, 0);
tcp_sendf (serv, "%s\r\n", buffer);
}
if (!want_sasl)
{
/* if we use SASL, CAP END is dealt via raw numerics */
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]);
}
开发者ID:shlomif,项目名称:hexchat,代码行数:101,代码来源:proto-irc.c
示例17: chanopt_command
int
chanopt_command (session *sess, char *tbuf, char *word[], char *word_eol[])
{
int dots, i = 0, j, p = 0;
guint8 val;
int offset = 2;
char *find;
gboolean quiet = FALSE;
int newval = -1;
if (!strcmp (word[2], "-quiet"))
{
quiet = TRUE;
offset++;
}
find = word[offset++];
if (word[offset][0])
{
if (!g_ascii_strcasecmp (word[offset], "ON"))
newval = 1;
else if (!g_ascii_strcasecmp (word[offset], "OFF"))
newval = 0;
else if (word[offset][0] == 'u')
newval = SET_DEFAULT;
else
newval = atoi (word[offset]);
}
if (!quiet)
PrintTextf (sess, "\002Network\002: %s \002Channel\002: %s\n",
sess->server->network ? server_get_network (sess->server, TRUE) : _("<none>"),
sess->channel[0] ? sess->channel : _("<none>"));
while (i < sizeof (chanopt) / sizeof (channel_options))
{
if (find[0] == 0 || match (find, chanopt[i].name) || (chanopt[i].alias && match (find, chanopt[i].alias)))
{
if (newval != -1) /* set new value */
{
*(guint8 *)G_STRUCT_MEMBER_P(sess, chanopt[i].offset) = newval;
}
if (!quiet) /* print value */
{
strcpy (tbuf, chanopt[i].name);
p = strlen (tbuf);
tbuf[p++] = 3;
tbuf[p++] = '2';
dots = 20 - strlen (chanopt[i].name);
for (j = 0; j < dots; j++)
tbuf[p++] = '.';
tbuf[p++] = 0;
val = G_STRUCT_MEMBER (guint8, sess, chanopt[i].offset);
PrintTextf (sess, "%s\0033:\017 %s", tbuf, chanopt_value (val));
}
}
i++;
}
return TRUE;
}
开发者ID:94m3k1n9,项目名称:hexchat,代码行数:67,代码来源:chanopt.c
示例18: 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;
char *var, *val;
if (strcasecmp (word[2], "-e") == 0)
{
idx++;
erase = TRUE;
}
/* turn a bit OFF */
if (strcasecmp (word[idx], "-off") == 0)
{
idx++;
off = TRUE;
}
/* turn a bit ON */
if (strcasecmp (word[idx], "-or") == 0 || strcasecmp (word[idx], "-on") == 0)
{
idx++;
or = TRUE;
}
if (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 = strcasecmp (var, vars[i].name);
if (found == 0)
{
finds++;
switch (vars[i].type)
{
case TYPE_STR:
if (erase || *val)
{
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\n", var, (char *) &prefs + vars[i].offset);
} else
{
set_showval (sess, &vars[i], tbuf);
}
break;
case TYPE_INT:
case TYPE_BOOL:
if (*val)
{
if (vars[i].type == TYPE_BOOL)
{
if (atoi (val))
*((int *) &prefs + vars[i].offset) = 1;
else
*((int *) &prefs + vars[i].offset) = 0;
if (!strcasecmp (val, "YES") || !strcasecmp (val, "ON"))
*((int *) &prefs + vars[i].offset) = 1;
if (!strcasecmp (val, "NO") || !strcasecmp (val, "OFF"))
*((int *) &prefs + vars[i].offset) = 0;
} else
{
if (or)
*((int *) &prefs + vars[i].offset) |= atoi (val);
else if (off)
*((int *) &prefs + vars[i].offset) &= ~(atoi (val));
else
*((int *) &prefs + vars[i].offset) = atoi (val);
}
//.........这里部分代码省略.........
开发者ID:ArdaXi,项目名称:XChat,代码行数:101,代码来源:cfgfiles.c
注:本文中的PrintTextf函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论