本文整理汇总了C++中IS_IRC_SERVER函数的典型用法代码示例。如果您正苦于以下问题:C++ IS_IRC_SERVER函数的具体用法?C++ IS_IRC_SERVER怎么用?C++ IS_IRC_SERVER使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IS_IRC_SERVER函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: cmd_knockout
/* SYNTAX: KNOCKOUT [<seconds>] <nick> <reason> */
static void cmd_knockout(const char *data, IRC_SERVER_REC *server,
IRC_CHANNEL_REC *channel)
{
KNOCKOUT_REC *rec;
char *nick, *reason, *timeoutstr, *str;
void *free_arg;
int timeleft;
g_return_if_fail(data != NULL);
if (!IS_IRC_SERVER(server) || !server->connected)
cmd_return_error(CMDERR_NOT_CONNECTED);
if (!IS_IRC_CHANNEL(channel))
cmd_return_error(CMDERR_NOT_JOINED);
if (is_numeric(data, ' ')) {
/* first argument is the timeout */
if (!cmd_get_params(data, &free_arg, 3 | PARAM_FLAG_GETREST, &timeoutstr, &nick, &reason))
return;
timeleft = atoi(timeoutstr);
} else {
timeleft = 0;
if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_GETREST, &nick, &reason))
return;
}
if (timeleft == 0) timeleft = settings_get_int("knockout_time");
if (*nick == '\0') cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);
signal_emit("command ban", 3, nick, server, channel);
str = g_strdup_printf("%s %s", nick, reason);
signal_emit("command kick", 3, str, server, channel);
g_free(str);
/* create knockout record */
rec = g_new(KNOCKOUT_REC, 1);
rec->timeleft = timeleft;
rec->channel = channel;
rec->ban = ban_get_mask(channel, nick);
server->knockoutlist = g_slist_append(server->knockoutlist, rec);
cmd_params_free(free_arg);
}
开发者ID:svn2github,项目名称:irssi,代码行数:45,代码来源:irc-commands.c
示例2: server_rejoin_channels
static void server_rejoin_channels(IRC_SERVER_REC *server)
{
GSList *tmp, *next;
GString *channels, *keys;
int use_keys;
g_return_if_fail(IS_IRC_SERVER(server));
channels = g_string_new(NULL);
keys = g_string_new(NULL);
use_keys = FALSE;
for (tmp = server->rejoin_channels; tmp != NULL; tmp = next) {
REJOIN_REC *rec = tmp->data;
next = tmp->next;
if (rec->joining) {
/* we missed the join (failed) message,
remove from rejoins.. */
rejoin_destroy(server, rec);
continue;
}
rec->joining = TRUE;
g_string_sprintfa(channels, "%s,", rec->channel);
if (rec->key == NULL)
g_string_append(keys, "x,");
else {
g_string_sprintfa(keys, "%s,", rec->key);
use_keys = TRUE;
}
}
if (channels->len > 0) {
g_string_truncate(channels, channels->len-1);
g_string_truncate(keys, keys->len-1);
if (use_keys) g_string_sprintfa(channels, " %s", keys->str);
server->channels_join(SERVER(server), channels->str, TRUE);
}
g_string_free(channels, TRUE);
g_string_free(keys, TRUE);
}
开发者ID:svn2github,项目名称:irssi,代码行数:44,代码来源:channel-rejoin.c
示例3: cmd_dcc_server
/* SYNTAX: DCC SERVER [+|-scf] [port] */
static void cmd_dcc_server(const char *data, IRC_SERVER_REC *server)
{
void *free_arg;
GIOChannel *handle;
SERVER_DCC_REC *dcc;
IPADDR own_ip;
char *flags, *port;
g_return_if_fail(data != NULL);
if (!cmd_get_params(data, &free_arg, 2, &flags, &port))
return;
dcc = dcc_server_find_port(port);
if (dcc != NULL) {
/* Server is already running, update it */
dcc_server_update_flags(dcc, flags);
cmd_params_free(free_arg);
return;
}
/* start listening */
if (!IS_IRC_SERVER(server) || !server->connected) {
cmd_param_error(CMDERR_NOT_CONNECTED);
}
handle = dcc_listen_port(net_sendbuffer_handle(server->handle),
&own_ip, atoi(port));
if (handle == NULL) {
cmd_param_error(CMDERR_ERRNO);
}
dcc = dcc_server_create(server, flags);
dcc->handle = handle;
dcc->port = atoi(port);
dcc->tagconn = g_input_add(dcc->handle, G_INPUT_READ,
(GInputFunction) dcc_server_listen, dcc);
signal_emit("dcc server started", 1, dcc);
cmd_params_free(free_arg);
}
开发者ID:svn2github,项目名称:irssi,代码行数:44,代码来源:dcc-server.c
示例4: cmd_sethost
/* SYNTAX: SETHOST <host> <password> (non-ircops)
SETHOST <ident> <host> (ircops) */
static void cmd_sethost(const char *data, IRC_SERVER_REC *server)
{
GSList *tmp;
g_return_if_fail(data != NULL);
if (!IS_IRC_SERVER(server) || !server->connected)
cmd_return_error(CMDERR_NOT_CONNECTED);
/* Save all the joined channels in server to window binds, since
the server will soon /PART + /JOIN us in all channels. */
for (tmp = server->channels; tmp != NULL; tmp = tmp->next) {
CHANNEL_REC *channel = tmp->data;
window_bind_add(window_item_window(channel),
server->tag, channel->visible_name);
}
irc_send_cmdv(server, "SETHOST %s", data);
}
开发者ID:Liaf,项目名称:irssi,代码行数:21,代码来源:fe-irc-commands.c
示例5: notifylist_timeout_server
/* timeout function: send /ISON commands to server to check if someone in
notify list is in IRC */
static void notifylist_timeout_server(IRC_SERVER_REC *server)
{
MODULE_SERVER_REC *mserver;
GSList *tmp;
GString *cmd;
char *nick, *ptr;
int len;
g_return_if_fail(server != NULL);
if (!IS_IRC_SERVER(server))
return;
mserver = MODULE_DATA(server);
if (mserver->ison_count > 0) {
/* still not received all replies to previous /ISON commands.. */
return;
}
cmd = g_string_new(NULL);
for (tmp = notifies; tmp != NULL; tmp = tmp->next) {
NOTIFYLIST_REC *rec = tmp->data;
if (!notifylist_ircnets_match(rec, server->connrec->chatnet))
continue;
nick = g_strdup(rec->mask);
ptr = strchr(nick, '!');
if (ptr != NULL) *ptr = '\0';
len = strlen(nick);
if (cmd->len+len+1 > 510)
ison_send(server, cmd);
g_string_sprintfa(cmd, "%s ", nick);
g_free(nick);
}
if (cmd->len > 0)
ison_send(server, cmd);
g_string_free(cmd, TRUE);
}
开发者ID:svn2github,项目名称:irssi,代码行数:45,代码来源:notify-ison.c
示例6: cmd_part
/* SYNTAX: PART [<channels>] [<message>] */
static void cmd_part(const char *data, IRC_SERVER_REC *server, WI_ITEM_REC *item)
{
char *channame, *msg;
void *free_arg;
g_return_if_fail(data != NULL);
if (!IS_IRC_SERVER(server) || !server->connected)
cmd_return_error(CMDERR_NOT_CONNECTED);
if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_OPTCHAN | PARAM_FLAG_GETREST, item, &channame, &msg))
return;
if (*channame == '\0') cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);
if (*msg == '\0') msg = (char *) settings_get_str("part_message");
irc_send_cmdv(server, *msg == '\0' ? "PART %s" : "PART %s :%s",
channame, msg);
cmd_params_free(free_arg);
}
开发者ID:svn2github,项目名称:irssi,代码行数:20,代码来源:irc-commands.c
示例7: sig_disconnected
static void sig_disconnected(IRC_SERVER_REC *server)
{
SERVER_QUERY_REC *rec;
int n;
g_return_if_fail(server != NULL);
if (!IS_IRC_SERVER(server))
return;
rec = server->chanqueries;
g_return_if_fail(rec != NULL);
for (n = 0; n < CHANNEL_QUERIES; n++)
g_slist_free(rec->queries[n]);
g_slist_free(rec->current_queries);
g_free(rec);
server->chanqueries = NULL;
}
开发者ID:svn2github,项目名称:irssi,代码行数:19,代码来源:channels-query.c
示例8: cmd_nctcp
/* SYNTAX: NCTCP <targets> <ctcp command> [<ctcp data>] */
static void cmd_nctcp(const char *data, IRC_SERVER_REC *server)
{
char *target, *ctcpcmd, *ctcpdata;
void *free_arg;
g_return_if_fail(data != NULL);
if (!IS_IRC_SERVER(server) || !server->connected)
cmd_return_error(CMDERR_NOT_CONNECTED);
if (!cmd_get_params(data, &free_arg, 3 | PARAM_FLAG_GETREST, &target, &ctcpcmd, &ctcpdata))
return;
if (*target == '\0' || *ctcpcmd == '\0') cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);
g_strup(ctcpcmd);
g_string_sprintf(tmpstr, "NOTICE %s :\001%s %s\001", target, ctcpcmd, ctcpdata);
irc_send_cmd_split(server, tmpstr->str, 2, server->max_msgs_in_cmd);
cmd_params_free(free_arg);
}
开发者ID:svn2github,项目名称:irssi,代码行数:20,代码来源:irc-commands.c
示例9: command_set_ban
static void command_set_ban(const char *data, IRC_SERVER_REC *server,
WI_ITEM_REC *item, int set)
{
IRC_CHANNEL_REC *chanrec;
char *channel, *nicks;
void *free_arg;
g_return_if_fail(data != NULL);
if (server == NULL || !server->connected || !IS_IRC_SERVER(server))
cmd_return_error(CMDERR_NOT_CONNECTED);
if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_OPTCHAN | PARAM_FLAG_GETREST,
item, &channel, &nicks)) return;
if (!ischannel(*channel)) cmd_param_error(CMDERR_NOT_JOINED);
if (*nicks == '\0') {
if (strcmp(data, "*") != 0)
cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);
/* /BAN * or /UNBAN * - ban/unban everyone */
nicks = (char *) data;
}
chanrec = irc_channel_find(server, channel);
if (chanrec == NULL)
cmd_param_error(CMDERR_CHAN_NOT_FOUND);
if (!chanrec->wholist)
cmd_param_error(CMDERR_CHAN_NOT_SYNCED);
if (set)
ban_set(chanrec, nicks);
else {
if (is_numeric(nicks, '\0')) {
/* unban with ban number */
BAN_REC *ban = g_slist_nth_data(chanrec->banlist,
atoi(nicks)-1);
if (ban != NULL)
nicks = ban->ban;
}
ban_remove(chanrec, nicks);
}
cmd_params_free(free_arg);
}
开发者ID:svn2github,项目名称:irssi,代码行数:43,代码来源:bans.c
示例10: sig_message_own_public
static void sig_message_own_public(SERVER_REC *server, const char *msg,
const char *target, const char *origtarget)
{
char *nickmode;
if (IS_IRC_SERVER(server) && target != NULL &&
*target == '@' && ischannel(target[1])) {
/* Hybrid 6 feature, send msg to all ops in channel */
nickmode = channel_get_nickmode(channel_find(server, target+1),
server->nick);
printformat_module("fe-common/core", server, target+1,
MSGLEVEL_PUBLIC | MSGLEVEL_NOHILIGHT |
MSGLEVEL_NO_ACT,
TXT_OWN_MSG_CHANNEL,
server->nick, target, msg, nickmode);
signal_stop();
}
}
开发者ID:svn2github,项目名称:irssi,代码行数:19,代码来源:fe-irc-messages.c
示例11: notifylist_deinit_server
static void notifylist_deinit_server(IRC_SERVER_REC *server)
{
MODULE_SERVER_REC *mserver;
NOTIFY_NICK_REC *rec;
g_return_if_fail(server != NULL);
if (!IS_IRC_SERVER(server))
return;
mserver = MODULE_DATA(server);
while (mserver->notify_users != NULL) {
rec = mserver->notify_users->data;
mserver->notify_users = g_slist_remove(mserver->notify_users, rec);
notify_nick_destroy(rec);
}
g_free(mserver);
}
开发者ID:svn2github,项目名称:irssi,代码行数:19,代码来源:notifylist.c
示例12: channel_rejoin
static int channel_rejoin(IRC_SERVER_REC *server, const char *channel)
{
IRC_CHANNEL_REC *chanrec;
REJOIN_REC *rec;
g_return_val_if_fail(IS_IRC_SERVER(server), 0);
g_return_val_if_fail(channel != NULL, 0);
chanrec = irc_channel_find(server, channel);
if (chanrec == NULL || chanrec->joined) return 0;
if (!settings_get_bool("channels_rejoin_unavailable")) {
chanrec->left = TRUE;
channel_destroy(CHANNEL(chanrec));
return 0;
}
rec = rejoin_find(server, channel);
if (rec != NULL) {
/* already exists */
rec->joining = FALSE;
/* update channel key */
g_free_and_null(rec->key);
if (channel_have_key(chanrec))
rec->key = g_strdup(chanrec->key);
} else {
/* new rejoin */
rec = g_new0(REJOIN_REC, 1);
rec->channel = g_strdup(channel);
if (channel_have_key(chanrec))
rec->key = g_strdup(chanrec->key);
server->rejoin_channels =
g_slist_append(server->rejoin_channels, rec);
signal_emit("channel rejoin new", 2, server, rec);
}
chanrec->left = TRUE;
channel_destroy(CHANNEL(chanrec));
return 1;
}
开发者ID:Liaf,项目名称:irssi,代码行数:42,代码来源:channel-rejoin.c
示例13: cmd_oper
/* SYNTAX: OPER [<nick>] <password> */
static void cmd_oper(const char *data, IRC_SERVER_REC *server)
{
char *nick, *password;
void *free_arg;
g_return_if_fail(data != NULL);
if (!IS_IRC_SERVER(server) || !server->connected)
cmd_return_error(CMDERR_NOT_CONNECTED);
if (!cmd_get_params(data, &free_arg, 2, &nick, &password))
return;
if (*nick == '\0') cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);
if (*password == '\0') {
password = nick;
nick = server->nick;
}
irc_send_cmdv(server, "OPER %s %s", nick, password);
cmd_params_free(free_arg);
}
开发者ID:svn2github,项目名称:irssi,代码行数:21,代码来源:irc-commands.c
示例14: cmd_away
/* SYNTAX: AWAY [-one | -all] [<reason>] */
static void cmd_away(const char *data, IRC_SERVER_REC *server)
{
GHashTable *optlist;
char *reason;
void *free_arg;
g_return_if_fail(data != NULL);
if (!IS_IRC_SERVER(server) || !server->connected)
cmd_return_error(CMDERR_NOT_CONNECTED);
if (!cmd_get_params(data, &free_arg, 1 | PARAM_FLAG_OPTIONS |
PARAM_FLAG_GETREST, "away", &optlist, &reason)) return;
if (g_hash_table_lookup(optlist, "one") != NULL)
server_send_away(server, reason);
else
g_slist_foreach(servers, (GFunc) server_send_away, reason);
cmd_params_free(free_arg);
}
开发者ID:svn2github,项目名称:irssi,代码行数:21,代码来源:irc-commands.c
示例15: cmd_names
/* SYNTAX: NAMES [-yes] [<channels>] */
static void cmd_names(const char *data, IRC_SERVER_REC *server, WI_ITEM_REC *item)
{
g_return_if_fail(data != NULL);
if (!IS_IRC_SERVER(server) || !server->connected)
cmd_return_error(CMDERR_NOT_CONNECTED);
if (*data == '\0') cmd_return_error(CMDERR_NOT_GOOD_IDEA);
if (strcmp(data, "*") == 0) {
if (!IS_IRC_CHANNEL(item))
cmd_return_error(CMDERR_NOT_JOINED);
data = item->name;
}
if (g_strcasecmp(data, "-YES") == 0)
irc_send_cmd(server, "NAMES");
else
irc_send_cmdv(server, "NAMES %s", data);
}
开发者ID:svn2github,项目名称:irssi,代码行数:21,代码来源:irc-commands.c
示例16: sig_print_starting
/* something is going to be printed to screen, print our current netsplit
message before it. */
static void sig_print_starting(TEXT_DEST_REC *dest)
{
NETJOIN_SERVER_REC *rec;
if (printing_joins)
return;
if (!IS_IRC_SERVER(dest->server))
return;
if (!(dest->level & MSGLEVEL_PUBLIC))
return;
if (!server_ischannel(dest->server, dest->target))
return;
rec = netjoin_find_server(IRC_SERVER(dest->server));
if (rec != NULL && rec->netjoins != NULL)
print_netjoins(rec, dest->target);
}
开发者ID:mmuman,项目名称:irssi,代码行数:22,代码来源:fe-netjoin.c
示例17: flood_deinit_server
/* Deinitialize flood protection */
static void flood_deinit_server(IRC_SERVER_REC *server)
{
MODULE_SERVER_REC *mserver;
g_return_if_fail(server != NULL);
if (!IS_IRC_SERVER(server))
return;
mserver = MODULE_DATA(server);
if (mserver != NULL && mserver->floodlist != NULL) {
flood_timecheck = 0;
g_hash_table_foreach(mserver->floodlist,
(GHFunc) flood_hash_destroy, NULL);
g_hash_table_destroy(mserver->floodlist);
}
g_free(mserver);
MODULE_DATA_UNSET(server);
}
开发者ID:Brijen,项目名称:MacIrssi,代码行数:21,代码来源:flood.c
示例18: channel_set_singlemode
void channel_set_singlemode(IRC_SERVER_REC *server, const char *channel,
const char *nicks, const char *mode)
{
GString *str;
int num, modepos;
char **nick, **nicklist;
g_return_if_fail(IS_IRC_SERVER(server));
g_return_if_fail(channel != NULL && nicks != NULL && mode != NULL);
if (*nicks == '\0') return;
num = modepos = 0;
str = g_string_new(NULL);
nicklist = g_strsplit(nicks, " ", -1);
for (nick = nicklist; *nick != NULL; nick++) {
if (**nick == '\0')
continue;
if (num == 0)
{
g_string_sprintf(str, "MODE %s %s", channel, mode);
modepos = str->len;
} else {
/* insert the mode string */
g_string_insert(str, modepos, mode);
}
g_string_sprintfa(str, " %s", *nick);
if (++num == server->max_modes_in_cmd) {
/* max. modes / command reached, send to server */
irc_send_cmd(server, str->str);
num = 0;
}
}
if (num > 0) irc_send_cmd(server, str->str);
g_strfreev(nicklist);
g_string_free(str, TRUE);
}
开发者ID:svn2github,项目名称:irssi,代码行数:41,代码来源:modes.c
示例19: flood_timeout
static int flood_timeout(void)
{
MODULE_SERVER_REC *mserver;
GSList *tmp;
time_t now;
/* remove the old people from flood lists */
now = time(NULL);
for (tmp = servers; tmp != NULL; tmp = tmp->next) {
IRC_SERVER_REC *rec = tmp->data;
if (!IS_IRC_SERVER(rec))
continue;
mserver = MODULE_DATA(rec);
g_hash_table_foreach_remove(mserver->floodlist,
(GHRFunc) flood_hash_check_remove,
&now);
}
return 1;
}
开发者ID:Brijen,项目名称:MacIrssi,代码行数:21,代码来源:flood.c
示例20: cmd_kick
/* SYNTAX: KICK [<channel>] <nicks> [<reason>] */
static void cmd_kick(const char *data, IRC_SERVER_REC *server, WI_ITEM_REC *item)
{
char *channame, *nicks, *reason;
void *free_arg;
g_return_if_fail(data != NULL);
if (!IS_IRC_SERVER(server) || !server->connected)
cmd_return_error(CMDERR_NOT_CONNECTED);
if (!cmd_get_params(data, &free_arg, 3 | PARAM_FLAG_OPTCHAN | PARAM_FLAG_GETREST,
item, &channame, &nicks, &reason))
return;
if (*channame == '\0' || *nicks == '\0') cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);
if (!ischannel(*channame)) cmd_param_error(CMDERR_NOT_JOINED);
g_string_sprintf(tmpstr, "KICK %s %s :%s", channame, nicks, reason);
irc_send_cmd_split(server, tmpstr->str, 3, server->max_kicks_in_cmd);
cmd_params_free(free_arg);
}
开发者ID:svn2github,项目名称:irssi,代码行数:22,代码来源:irc-commands.c
注:本文中的IS_IRC_SERVER函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论