mirror of
https://github.com/matrix-construct/construct
synced 2025-01-01 02:14:13 +01:00
list: Strip colours from channel topics.
This allows in-channel use of coloured topics (or via /topic out of channel) but leaves channel listings clean.
This commit is contained in:
parent
dc9aebf467
commit
69e7a2cdc3
1 changed files with 28 additions and 8 deletions
|
@ -48,6 +48,7 @@
|
||||||
#include "msg.h"
|
#include "msg.h"
|
||||||
#include "parse.h"
|
#include "parse.h"
|
||||||
#include "modules.h"
|
#include "modules.h"
|
||||||
|
#include "inline/stringops.h"
|
||||||
|
|
||||||
static rb_dlink_list safelisting_clients = { NULL, NULL, 0 };
|
static rb_dlink_list safelisting_clients = { NULL, NULL, 0 };
|
||||||
|
|
||||||
|
@ -57,6 +58,8 @@ static void _moddeinit(void);
|
||||||
static int m_list(struct Client *, struct Client *, int, const char **);
|
static int m_list(struct Client *, struct Client *, int, const char **);
|
||||||
static int mo_list(struct Client *, struct Client *, int, const char **);
|
static int mo_list(struct Client *, struct Client *, int, const char **);
|
||||||
|
|
||||||
|
static void list_one_channel(struct Client *source_p, struct Channel *chptr, int visible);
|
||||||
|
|
||||||
static void safelist_check_cliexit(hook_data_client_exit * hdata);
|
static void safelist_check_cliexit(hook_data_client_exit * hdata);
|
||||||
static void safelist_client_instantiate(struct Client *, struct ListClient *);
|
static void safelist_client_instantiate(struct Client *, struct ListClient *);
|
||||||
static void safelist_client_release(struct Client *);
|
static void safelist_client_release(struct Client *);
|
||||||
|
@ -285,6 +288,29 @@ static int mo_list(struct Client *client_p, struct Client *source_p, int parc, c
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* list_one_channel()
|
||||||
|
*
|
||||||
|
* inputs - client pointer, channel pointer, whether normally visible
|
||||||
|
* outputs - none
|
||||||
|
* side effects - a channel is listed
|
||||||
|
*/
|
||||||
|
static void list_one_channel(struct Client *source_p, struct Channel *chptr,
|
||||||
|
int visible)
|
||||||
|
{
|
||||||
|
char topic[TOPICLEN + 1];
|
||||||
|
|
||||||
|
if (chptr->topic != NULL)
|
||||||
|
rb_strlcpy(topic, chptr->topic, sizeof topic);
|
||||||
|
else
|
||||||
|
topic[0] = '\0';
|
||||||
|
strip_colour(topic);
|
||||||
|
sendto_one(source_p, form_str(RPL_LIST), me.name, source_p->name,
|
||||||
|
visible ? "" : "!",
|
||||||
|
chptr->chname, rb_dlink_list_length(&chptr->members),
|
||||||
|
topic);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* safelist_sendq_exceeded()
|
* safelist_sendq_exceeded()
|
||||||
*
|
*
|
||||||
|
@ -392,10 +418,7 @@ static void safelist_channel_named(struct Client *source_p, const char *name, in
|
||||||
|
|
||||||
visible = !SecretChannel(chptr) || IsMember(source_p, chptr);
|
visible = !SecretChannel(chptr) || IsMember(source_p, chptr);
|
||||||
if (visible || operspy)
|
if (visible || operspy)
|
||||||
sendto_one(source_p, form_str(RPL_LIST), me.name, source_p->name,
|
list_one_channel(source_p, chptr, visible);
|
||||||
visible ? "" : "!",
|
|
||||||
chptr->chname, rb_dlink_list_length(&chptr->members),
|
|
||||||
chptr->topic == NULL ? "" : chptr->topic);
|
|
||||||
|
|
||||||
sendto_one(source_p, form_str(RPL_LISTEND), me.name, source_p->name);
|
sendto_one(source_p, form_str(RPL_LISTEND), me.name, source_p->name);
|
||||||
return;
|
return;
|
||||||
|
@ -436,10 +459,7 @@ static void safelist_one_channel(struct Client *source_p, struct Channel *chptr)
|
||||||
if (safelist_data->created_max && chptr->channelts > safelist_data->created_max)
|
if (safelist_data->created_max && chptr->channelts > safelist_data->created_max)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
sendto_one(source_p, form_str(RPL_LIST), me.name, source_p->name,
|
list_one_channel(source_p, chptr, visible);
|
||||||
visible ? "" : "!",
|
|
||||||
chptr->chname, rb_dlink_list_length(&chptr->members),
|
|
||||||
chptr->topic == NULL ? "" : chptr->topic);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in a new issue