diff options
| author | Nakidai <nakidai@disroot.org> | 2026-02-06 17:40:27 +0300 |
|---|---|---|
| committer | Nakidai <nakidai@disroot.org> | 2026-02-06 17:40:27 +0300 |
| commit | e6aff7291f742cf3a435b8103f98699eab75c948 (patch) | |
| tree | 215fc421e3f324e21d0a0fbf7df799db424f59c7 | |
| parent | 9ae659fd6c792407f3d80ea4d313bf850c2332ec (diff) | |
| download | libreircd-e6aff7291f742cf3a435b8103f98699eab75c948.tar.gz libreircd-e6aff7291f742cf3a435b8103f98699eab75c948.zip | |
Add basic support for channel oper
At least it is now set to a first user :D
| -rw-r--r-- | handle.c | 9 | ||||
| -rw-r--r-- | ircd.h | 2 |
2 files changed, 9 insertions, 2 deletions
diff --git a/handle.c b/handle.c index 75d42a9..c825ec6 100644 --- a/handle.c +++ b/handle.c @@ -67,7 +67,8 @@ join(struct Message *msg, struct Peer *peer) channels[channels_c] = (struct Channel){0}; strlcpy(channels[channels_c].name, msg->params[0], sizeof(channels->name)); - channel_join(&channels[channels_c++], peer); + channel_join(&channels[channels_c], peer); + channels[channels_c++].peers[0].modes |= CHANNEL_OPER; names(&namesmsg, peer); return 0; } @@ -116,6 +117,7 @@ static int names(struct Message *msg, struct Peer *peer) { static char buf[MESSAGE_MAX]; + struct ChannelPeer *chpp; size_t i, j; for (i = 0; i < peer->channels_c; ++i) @@ -126,6 +128,11 @@ names(struct Message *msg, struct Peer *peer) memset(buf, 0, sizeof(buf)); for (j = 0; j < peer->channels[i]->peers_c; ++j) { + chpp = &peer->channels[i]->peers[j]; + if (chpp->modes & CHANNEL_OPER) + strlcat(buf, "@", sizeof(buf)); + else if (chpp->modes & CHANNEL_VOICE) + strlcat(buf, "+", sizeof(buf)); strlcat(buf, peer->channels[i]->peers[j].p->nick, sizeof(buf)); if (strlen(buf) >= MESSAGE_MAX - 4*PEER_NICK_MAX) { diff --git a/ircd.h b/ircd.h index 0959d12..29457d8 100644 --- a/ircd.h +++ b/ircd.h @@ -65,7 +65,7 @@ struct Channel { enum { GLOBAL, LOCAL, MODELESS, SAFE } type; char name[CHANNEL_NAME_MAX]; - struct { + struct ChannelPeer { struct Peer *p; enum ChannelPeerMode { BIT(CHANNEL_OPER), |