summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Bratch <luke@bratch.co.uk>2019-05-18 23:14:30 +0100
committerLuke Bratch <luke@bratch.co.uk>2019-05-18 23:14:30 +0100
commita25fdf5088dfa815d575134c12a60eadedef0aa9 (patch)
tree608fde04431b85845e98b92d748cd8c3ac40ddce
parent34618f8ea69cc3d566e23a3ed8a3c0020826ead4 (diff)
No need to store channel modes as clients ask for them when JOINing.
-rw-r--r--blabouncer.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/blabouncer.c b/blabouncer.c
index a69ec71..e817f7e 100644
--- a/blabouncer.c
+++ b/blabouncer.c
@@ -1,8 +1,6 @@
// TODO:
// - Might need to change channel struct nicks to be channel struct user struct with its own nick/modes/etc.
-// - Do we actually need to store the modes in the channel struct?
// - Get CAP from server and relay to client
-// - Keep track of changing user modes in channels
// - Should replay log do more than PRIVMSGs?
// - Configurable auto channels
// - Comma separated channel list in JOINs/PARTs
@@ -62,7 +60,6 @@ struct channel {
// TODO - Make this Year 2038 proof
// TODO - Make this an int? It's just going to arrive and leave as a string every time anyway...
char topicwhen[11]; // 32-bit unixtime is up to 10 characters (+1 for null char) We use "0" to mean "not set".
- char modes[MAXDATASIZE]; // TODO - Is there a particular maximum modes length?
char nicks[MAXCHANUSERS][MAXNICKLENGTH]; // TODO - Need to modify this as people leave/join, not just when we first join
char namestype[2]; // Single character (@/*/=) (+1 for null char) // TODO - Is this a sensible name?
};
@@ -296,8 +293,8 @@ int disconnectclient(int fd, struct client *clients, struct ircdstrings *ircdstr
return 0;
}
-int createchannel(struct channel *channels, char *name, char *topic, char *topicwho, char *topicwhen, char *modes, char *namestype) {
- printf("createchannel(): given \"%s\", \"%s\", \"%s\", \"%s\", \"%s\", and \"%s\".\n", name, topic, topicwho, topicwhen, modes, namestype);
+int createchannel(struct channel *channels, char *name, char *topic, char *topicwho, char *topicwhen, char *namestype) {
+ printf("createchannel(): given \"%s\", \"%s\", \"%s\", \"%s\", and \"%s\".\n", name, topic, topicwho, topicwhen, namestype);
// Make sure the channel doesn't already exist
for (int i = 0; i < MAXCHANNELS; i++) {
@@ -324,8 +321,6 @@ int createchannel(struct channel *channels, char *name, char *topic, char *topic
channels[i].topicwho[strlen(topicwho)] = '\0';
strncpy(channels[i].topicwhen, topicwhen, strlen(topicwhen));
channels[i].topicwhen[strlen(topicwhen)] = '\0';
- strncpy(channels[i].modes, modes, strlen(modes));
- channels[i].modes[strlen(modes)] = '\0';
strncpy(channels[i].namestype, topic, strlen(namestype));
channels[i].namestype[strlen(namestype)] = '\0';
return 1;
@@ -689,7 +684,7 @@ int processircmessage(SSL *server_ssl, char *str, int source, struct client *cli
printf("Server JOIN: nickuserhost is ours ('%s' vs '%s').\n", prefixcopy, ircdstrings->nickuserhost);
// TODO - Saner way to initialise this since we don't have the variables yet?
// TODO - Defaulting to type '=' which is "public" since I don't know what else to guess.
- createchannel(channels, tokens[2], "TOPIC", "TOPICWHO", "0", "CHANNELMODES", "=");
+ createchannel(channels, tokens[2], "TOPIC", "TOPICWHO", "0", "=");
// If the user JOINing is not us, record the user in our channel array.
} else {
printf("Server JOIN: nickuserhost is NOT ours ('%s' vs '%s').\n", prefixcopy, ircdstrings->nickuserhost);