| 23 |
|
*/ |
| 24 |
|
|
| 25 |
|
#include "stdinc.h" |
| 26 |
< |
#include "tools.h" |
| 27 |
< |
#include "handlers.h" |
| 26 |
> |
#include "list.h" |
| 27 |
|
#include "channel.h" |
| 28 |
|
#include "channel_mode.h" |
| 29 |
|
#include "client.h" |
| 33 |
|
#include "ircd.h" |
| 34 |
|
#include "numeric.h" |
| 35 |
|
#include "send.h" |
| 37 |
– |
#include "s_conf.h" |
| 36 |
|
#include "s_serv.h" |
| 39 |
– |
#include "msg.h" |
| 37 |
|
#include "parse.h" |
| 38 |
|
#include "modules.h" |
| 39 |
|
#include "packet.h" |
| 43 |
– |
#include "common.h" |
| 40 |
|
|
| 45 |
– |
static void m_topic(struct Client *, struct Client *, int, char *[]); |
| 46 |
– |
|
| 47 |
– |
struct Message topic_msgtab = { |
| 48 |
– |
"TOPIC", 0, 0, 2, 0, MFLG_SLOW, 0, |
| 49 |
– |
{m_unregistered, m_topic, m_topic, m_ignore, m_topic, m_ignore} |
| 50 |
– |
}; |
| 51 |
– |
|
| 52 |
– |
#ifndef STATIC_MODULES |
| 53 |
– |
void |
| 54 |
– |
_modinit(void) |
| 55 |
– |
{ |
| 56 |
– |
mod_add_cmd(&topic_msgtab); |
| 57 |
– |
} |
| 58 |
– |
|
| 59 |
– |
void |
| 60 |
– |
_moddeinit(void) |
| 61 |
– |
{ |
| 62 |
– |
mod_del_cmd(&topic_msgtab); |
| 63 |
– |
} |
| 64 |
– |
|
| 65 |
– |
const char *_version = "$Revision$"; |
| 66 |
– |
#endif |
| 41 |
|
|
| 42 |
|
/* m_topic() |
| 43 |
|
* parv[0] = sender prefix |
| 96 |
|
{ |
| 97 |
|
char topic_info[USERHOST_REPLYLEN]; |
| 98 |
|
|
| 99 |
< |
ircsprintf(topic_info, "%s!%s@%s", source_p->name, |
| 100 |
< |
source_p->username, source_p->host); |
| 99 |
> |
snprintf(topic_info, sizeof(topic_info), "%s!%s@%s", source_p->name, |
| 100 |
> |
source_p->username, source_p->host); |
| 101 |
|
set_channel_topic(chptr, parv[2], topic_info, CurrentTime); |
| 102 |
|
|
| 103 |
< |
sendto_server(client_p, chptr, CAP_TS6, NOCAPS, |
| 103 |
> |
sendto_server(client_p, CAP_TS6, NOCAPS, |
| 104 |
|
":%s TOPIC %s :%s", |
| 105 |
|
ID(source_p), chptr->chname, |
| 106 |
< |
chptr->topic == NULL ? "" : chptr->topic); |
| 107 |
< |
sendto_server(client_p, chptr, NOCAPS, CAP_TS6, |
| 106 |
> |
chptr->topic); |
| 107 |
> |
sendto_server(client_p, NOCAPS, CAP_TS6, |
| 108 |
|
":%s TOPIC %s :%s", |
| 109 |
|
source_p->name, chptr->chname, |
| 110 |
< |
chptr->topic == NULL ? "" : chptr->topic); |
| 111 |
< |
sendto_channel_local(ALL_MEMBERS, NO, |
| 110 |
> |
chptr->topic); |
| 111 |
> |
sendto_channel_local(ALL_MEMBERS, 0, |
| 112 |
|
chptr, ":%s!%s@%s TOPIC %s :%s", |
| 113 |
|
source_p->name, |
| 114 |
|
source_p->username, |
| 115 |
|
source_p->host, |
| 116 |
< |
chptr->chname, chptr->topic == NULL ? |
| 143 |
< |
"" : chptr->topic); |
| 116 |
> |
chptr->chname, chptr->topic); |
| 117 |
|
} |
| 118 |
|
else |
| 119 |
|
sendto_one(source_p, form_str(ERR_CHANOPRIVSNEEDED), |
| 123 |
|
{ |
| 124 |
|
if (!SecretChannel(chptr) || IsMember(source_p, chptr)) |
| 125 |
|
{ |
| 126 |
< |
if (chptr->topic == NULL) |
| 126 |
> |
if (chptr->topic[0] == '\0') |
| 127 |
|
sendto_one(source_p, form_str(RPL_NOTOPIC), |
| 128 |
|
from, to, chptr->chname); |
| 129 |
|
else |
| 142 |
|
from, to, chptr->chname); |
| 143 |
|
} |
| 144 |
|
} |
| 145 |
+ |
|
| 146 |
+ |
static struct Message topic_msgtab = { |
| 147 |
+ |
"TOPIC", 0, 0, 2, MAXPARA, MFLG_SLOW, 0, |
| 148 |
+ |
{m_unregistered, m_topic, m_topic, m_ignore, m_topic, m_ignore} |
| 149 |
+ |
}; |
| 150 |
+ |
|
| 151 |
+ |
static void |
| 152 |
+ |
module_init(void) |
| 153 |
+ |
{ |
| 154 |
+ |
mod_add_cmd(&topic_msgtab); |
| 155 |
+ |
} |
| 156 |
+ |
|
| 157 |
+ |
static void |
| 158 |
+ |
module_exit(void) |
| 159 |
+ |
{ |
| 160 |
+ |
mod_del_cmd(&topic_msgtab); |
| 161 |
+ |
} |
| 162 |
+ |
|
| 163 |
+ |
struct module module_entry = { |
| 164 |
+ |
.node = { NULL, NULL, NULL }, |
| 165 |
+ |
.name = NULL, |
| 166 |
+ |
.version = "$Revision$", |
| 167 |
+ |
.handle = NULL, |
| 168 |
+ |
.modinit = module_init, |
| 169 |
+ |
.modexit = module_exit, |
| 170 |
+ |
.flags = 0 |
| 171 |
+ |
}; |