67 lines
2.0 KiB
C
67 lines
2.0 KiB
C
|
/*
|
||
|
* This file is part of uIRC. (https://git.redxen.eu/caskd/uIRC)
|
||
|
* Copyright (c) 2019, 2020 Alex-David Denes
|
||
|
*
|
||
|
* uIRC is free software: you can redistribute it and/or modify
|
||
|
* it under the terms of the GNU General Public License as published by
|
||
|
* the Free Software Foundation, either version 3 of the License, or
|
||
|
* any later version.
|
||
|
*
|
||
|
* uIRC is distributed in the hope that it will be useful,
|
||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
* GNU General Public License for more details.
|
||
|
*
|
||
|
* You should have received a copy of the GNU General Public License
|
||
|
* along with uIRC. If not, see <https://www.gnu.org/licenses/>.
|
||
|
*/
|
||
|
|
||
|
#include "capabilities.h"
|
||
|
|
||
|
#include <stdlib.h>
|
||
|
#include <string.h>
|
||
|
|
||
|
const char* const IRC_v3_Caps[] = {
|
||
|
[CAP_ACCOUNT_NOTIFY] = "account-notify",
|
||
|
[CAP_ACCOUNT_TAG] = "account-tag",
|
||
|
[CAP_AWAY_NOTIFY] = "away-notify",
|
||
|
[CAP_BATCH] = "batch",
|
||
|
[CAP_CAP_NOTIFY] = "cap-notify",
|
||
|
[CAP_CHANNEL_RENAME] = "channel-rename",
|
||
|
[CAP_CHGHOST] = "chghost",
|
||
|
[CAP_ECHO_MESSAGE] = "echo-message",
|
||
|
[CAP_EXTENDED_JOIN] = "extended-join",
|
||
|
[CAP_INVITE_NOTIFY] = "invite-notify",
|
||
|
[CAP_LABELED_RESPONSE] = "labeled-response",
|
||
|
[CAP_MESSAGE_TAGS] = "message-tags",
|
||
|
[CAP_MONITOR] = "monitor",
|
||
|
[CAP_MULTI_PREFIX] = "multi-prefix",
|
||
|
[CAP_MULTILINE] = "multiline",
|
||
|
[CAP_SASL] = "sasl",
|
||
|
[CAP_SERVER_TIME] = "server-time",
|
||
|
[CAP_SETNAME] = "setname",
|
||
|
[CAP_TLS] = "tls",
|
||
|
[CAP_USERHOST_IN_NAMES] = "userhost-in-names",
|
||
|
};
|
||
|
|
||
|
#ifdef UIRC_HELPERS
|
||
|
int
|
||
|
Tok_CAPS(char* caps)
|
||
|
{
|
||
|
int temp = 0;
|
||
|
char* cur = NULL;
|
||
|
if ((cur = strtok(caps, " ")) != NULL) {
|
||
|
do {
|
||
|
for (int i = 1; (unsigned long) i < (sizeof(IRC_v3_Caps) / sizeof(*IRC_v3_Caps)); i++) {
|
||
|
if (strcmp(IRC_v3_Caps[i], cur) == 0) {
|
||
|
temp |= CAPBIT(i);
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
} while ((cur = strtok(NULL, " ")) != NULL);
|
||
|
}
|
||
|
return temp;
|
||
|
}
|
||
|
#endif /* UIRC_HELPERS */
|
||
|
|