本文整理汇总了C++中IS_IRC_CHANNEL函数的典型用法代码示例。如果您正苦于以下问题:C++ IS_IRC_CHANNEL函数的具体用法?C++ IS_IRC_CHANNEL怎么用?C++ IS_IRC_CHANNEL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IS_IRC_CHANNEL函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cmd_who
/* SYNTAX: WHO <nicks>|<channels>|** */
static void cmd_who(const char *data, IRC_SERVER_REC *server, WI_ITEM_REC *item)
{
char *channel, *rest;
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_GETREST, &channel, &rest))
return;
if (strcmp(channel, "*") == 0 || *channel == '\0') {
if (!IS_IRC_CHANNEL(item))
cmd_param_error(CMDERR_NOT_JOINED);
channel = item->name;
}
if (strcmp(channel, "**") == 0) {
/* ** displays all nicks.. */
*channel = '\0';
}
irc_send_cmdv(server, *rest == '\0' ? "WHO %s" : "WHO %s %s",
channel, rest);
cmd_params_free(free_arg);
/* add default redirection */
server_redirect_default((SERVER_REC *) server, "bogus command who");
}
示例2: channel_mode_is_set
int channel_mode_is_set(IRC_CHANNEL_REC *channel, char mode)
{
g_return_val_if_fail(IS_IRC_CHANNEL(channel), FALSE);
return channel->mode == NULL ? FALSE :
mode_is_set(channel->mode, mode);
}
示例3: cmd_names
static void cmd_names(const char *data, IRC_SERVER_REC *server,
WI_ITEM_REC *item)
{
GHashTable *optlist;
char *channel;
void *free_arg;
CMD_IRC_SERVER(server);
if (!cmd_get_params(data, &free_arg, 1 | PARAM_FLAG_OPTIONS |
PARAM_FLAG_GETREST, "names", &optlist, &channel))
return;
if (strcmp(channel, "*") == 0 || *channel == '\0') {
if (!IS_IRC_CHANNEL(item))
cmd_param_error(CMDERR_NOT_JOINED);
channel = IRC_CHANNEL(item)->name;
}
if (strcmp(channel, "**") == 0) {
/* ** displays all nicks.. */
irc_send_cmd(server, "NAMES");
} else {
irc_send_cmdv(server, "NAMES %s", channel);
}
cmd_params_free(free_arg);
}
示例4: cmd_who
/* SYNTAX: WHO [<nicks> | <channels> | **] */
static void cmd_who(const char *data, IRC_SERVER_REC *server,
WI_ITEM_REC *item)
{
char *channel, *rest;
void *free_arg;
CMD_IRC_SERVER(server);
if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_GETREST, &channel, &rest))
return;
if (strcmp(channel, "*") == 0 || *channel == '\0') {
if (!IS_IRC_CHANNEL(item))
cmd_param_error(CMDERR_NOT_JOINED);
channel = IRC_CHANNEL(item)->name;
}
if (strcmp(channel, "**") == 0) {
/* ** displays all nicks.. */
*channel = '\0';
}
irc_send_cmdv(server, *rest == '\0' ? "WHO %s" : "WHO %s %s",
channel, rest);
cmd_params_free(free_arg);
}
示例5: g_return_val_if_fail
char *ban_get_mask(IRC_CHANNEL_REC *channel, const char *nick)
{
NICK_REC *rec;
char *str, *user, *host;
g_return_val_if_fail(IS_IRC_CHANNEL(channel), NULL);
g_return_val_if_fail(nick != NULL, NULL);
rec = nicklist_find(CHANNEL(channel), nick);
if (rec == NULL || rec->host == NULL) return NULL;
str = irc_get_mask(nick, rec->host, bantype);
/* there's a limit of 10 characters in user mask. so, banning
someone with user mask of 10 characters gives us "*1234567890",
which is one too much.. so, replace the 10th character with '*' */
user = strchr(str, '!');
if (user == NULL) return str;
host = strchr(++user, '@');
if (host == NULL) return str;
if ((int) (host-user) > 10) {
/* too long user mask */
user[9] = '*';
g_memmove(user+10, host, strlen(host)+1);
}
return str;
}
示例6: channel_destroyed
static void channel_destroyed(IRC_CHANNEL_REC *channel)
{
if (!IS_IRC_CHANNEL(channel))
return;
banlist_free(channel->banlist);
}
示例7: nick_mode_change
/* Change nick's mode in channel */
static void nick_mode_change(IRC_CHANNEL_REC *channel, const char *nick,
char mode, int type, const char *setby)
{
NICK_REC *nickrec;
char modestr[2], typestr[2];
g_return_if_fail(IS_IRC_CHANNEL(channel));
g_return_if_fail(nick != NULL);
nickrec = nicklist_find(CHANNEL(channel), nick);
if (nickrec == NULL) return; /* No /names list got yet */
if (mode == '@') nickrec->op = type == '+';
else if (mode == '+') nickrec->voice = type == '+';
else if (mode == '%') nickrec->halfop = type == '+';
if (channel->server->prefix[(unsigned char) mode] != '\0') {
if (type == '+')
prefix_add(nickrec->prefixes, mode, (SERVER_REC *) channel->server);
else
prefix_del(nickrec->prefixes, mode);
}
modestr[0] = mode; modestr[1] = '\0';
typestr[0] = type; typestr[1] = '\0';
signal_emit("nick mode changed", 5,
channel, nickrec, setby, modestr, typestr);
}
示例8: get_wildcard_nicks
static int get_wildcard_nicks(GString *output, const char *mask,
IRC_CHANNEL_REC *channel, int op, int voice)
{
GSList *nicks, *tmp;
int count;
g_return_val_if_fail(output != NULL, 0);
g_return_val_if_fail(mask != NULL, 0);
g_return_val_if_fail(IS_IRC_CHANNEL(channel), 0);
count = 0;
nicks = nicklist_find_multiple(CHANNEL(channel), mask);
for (tmp = nicks; tmp != NULL; tmp = tmp->next) {
NICK_REC *rec = tmp->data;
if ((op == 1 && !rec->op) || (op == 0 && rec->op) ||
(voice == 1 && !rec->voice) || (voice == 0 && rec->voice))
continue;
if (g_strcasecmp(rec->nick, channel->server->nick) == 0)
continue;
g_string_sprintfa(output, "%s ", rec->nick);
count++;
}
g_slist_free(nicks);
return count;
}
示例9: sig_channel_destroyed
static void sig_channel_destroyed(IRC_CHANNEL_REC *channel)
{
g_return_if_fail(channel != NULL);
if (IS_IRC_CHANNEL(channel) && !channel->server->disconnected &&
!channel->synced)
query_remove_all(channel);
}
示例10: NICK
/* expands to your usermode on channel, op '@', halfop '%', "+" voice */
static char *expando_cumode(SERVER_REC *server, void *item, int *free_ret)
{
if (IS_IRC_CHANNEL(item) && CHANNEL(item)->ownnick) {
return NICK(CHANNEL(item)->ownnick)->op ? "@" :
NICK(CHANNEL(item)->ownnick)->halfop ? "%" :
NICK(CHANNEL(item)->ownnick)->voice ? "+" : "";
}
return "";
}
示例11: sig_channel_destroyed
static void sig_channel_destroyed(IRC_CHANNEL_REC *channel)
{
if (!IS_IRC_CHANNEL(channel))
return;
if (channel->server != NULL && !channel->left && !channel->kicked) {
/* destroying channel record without actually
having left the channel yet */
signal_emit("command part", 3, "", channel->server, channel);
}
}
示例12: sig_remove_rejoin
/* join ok/failed - remove from rejoins list. this happens always after join
except if the "target unavailable" error happens again */
static void sig_remove_rejoin(IRC_CHANNEL_REC *channel)
{
REJOIN_REC *rec;
if (!IS_IRC_CHANNEL(channel) || channel->server == NULL)
return;
rec = rejoin_find(channel->server, channel->name);
if (rec != NULL && rec->joining) {
/* join failed, remove the rejoin */
rejoin_destroy(channel->server, rec);
}
}
示例13: cmd_devoice
/* SYNTAX: DEVOICE <nicks> */
static void cmd_devoice(const char *data, IRC_SERVER_REC *server,
IRC_CHANNEL_REC *channel)
{
char *nicks;
if (!IS_IRC_CHANNEL(channel))
return;
nicks = get_nicks(channel, data, 0, 1);
if (nicks != NULL && *nicks != '\0')
channel_set_singlemode(server, channel->name, nicks, "-v");
g_free_not_null(nicks);
}
示例14: channels_have_all_names
static int channels_have_all_names(IRC_SERVER_REC *server)
{
GSList *tmp;
for (tmp = server->channels; tmp != NULL; tmp = tmp->next) {
IRC_CHANNEL_REC *rec = tmp->data;
if (IS_IRC_CHANNEL(rec) && !rec->names_got)
return 0;
}
return 1;
}
示例15: NICK
/* expands to your usermode on channel, op '@', halfop '%', "+" voice or other */
static char *expando_cumode(SERVER_REC *server, void *item, int *free_ret)
{
if (IS_IRC_CHANNEL(item) && CHANNEL(item)->ownnick) {
char prefix = NICK(CHANNEL(item)->ownnick)->prefixes[0];
if (prefix != '\0') {
char *cumode = g_malloc(2);
cumode[0] = prefix;
cumode[1] = '\0';
*free_ret = TRUE;
return cumode;
}
}
return "";
}