48 |
|
int parc, char *parv[]) |
49 |
|
{ |
50 |
|
struct Channel *chptr = NULL; |
51 |
– |
const char *from, *to; |
52 |
– |
|
53 |
– |
if (!MyClient(source_p) && IsCapable(source_p->from, CAP_TS6) && HasID(source_p)) |
54 |
– |
{ |
55 |
– |
from = me.id; |
56 |
– |
to = source_p->id; |
57 |
– |
} |
58 |
– |
else |
59 |
– |
{ |
60 |
– |
from = me.name; |
61 |
– |
to = source_p->name; |
62 |
– |
} |
51 |
|
|
52 |
|
if (EmptyString(parv[1])) |
53 |
|
{ |
54 |
|
sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS), |
55 |
< |
from, to, "TOPIC"); |
55 |
> |
me.name, source_p->name, "TOPIC"); |
56 |
|
return; |
57 |
|
} |
58 |
|
|
59 |
< |
if (MyClient(source_p) && !IsFloodDone(source_p)) |
59 |
> |
if (!IsFloodDone(source_p)) |
60 |
|
flood_endgrace(source_p); |
61 |
|
|
62 |
|
if ((chptr = hash_find_channel(parv[1])) == NULL) |
63 |
|
{ |
64 |
|
sendto_one(source_p, form_str(ERR_NOSUCHCHANNEL), |
65 |
< |
from, to, parv[1]); |
65 |
> |
me.name, source_p->name, parv[1]); |
66 |
|
return; |
67 |
|
} |
68 |
|
|
73 |
|
|
74 |
|
if ((ms = find_channel_link(source_p, chptr)) == NULL) |
75 |
|
{ |
76 |
< |
sendto_one(source_p, form_str(ERR_NOTONCHANNEL), from, |
77 |
< |
to, parv[1]); |
76 |
> |
sendto_one(source_p, form_str(ERR_NOTONCHANNEL), me.name, |
77 |
> |
source_p->name, parv[1]); |
78 |
|
return; |
79 |
|
} |
80 |
|
|
85 |
|
|
86 |
|
snprintf(topic_info, sizeof(topic_info), "%s!%s@%s", source_p->name, |
87 |
|
source_p->username, source_p->host); |
88 |
< |
set_channel_topic(chptr, parv[2], topic_info, CurrentTime, !!MyClient(source_p)); |
88 |
> |
set_channel_topic(chptr, parv[2], topic_info, CurrentTime, 1); |
89 |
|
|
90 |
|
sendto_server(client_p, CAP_TS6, NOCAPS, |
91 |
|
":%s TOPIC %s :%s", |
104 |
|
} |
105 |
|
else |
106 |
|
sendto_one(source_p, form_str(ERR_CHANOPRIVSNEEDED), |
107 |
< |
from, to, chptr->chname); |
107 |
> |
me.name, source_p->name, chptr->chname); |
108 |
|
} |
109 |
|
else /* only asking for topic */ |
110 |
|
{ |
112 |
|
{ |
113 |
|
if (chptr->topic[0] == '\0') |
114 |
|
sendto_one(source_p, form_str(RPL_NOTOPIC), |
115 |
< |
from, to, chptr->chname); |
115 |
> |
me.name, source_p->name, chptr->chname); |
116 |
|
else |
117 |
|
{ |
118 |
|
sendto_one(source_p, form_str(RPL_TOPIC), |
119 |
< |
from, to, |
119 |
> |
me.name, source_p->name, |
120 |
|
chptr->chname, chptr->topic); |
121 |
|
sendto_one(source_p, form_str(RPL_TOPICWHOTIME), |
122 |
< |
from, to, chptr->chname, |
122 |
> |
me.name, source_p->name, chptr->chname, |
123 |
|
chptr->topic_info, |
124 |
|
chptr->topic_time); |
125 |
|
} |
126 |
|
} |
127 |
|
else |
128 |
|
sendto_one(source_p, form_str(ERR_NOTONCHANNEL), |
129 |
< |
from, to, chptr->chname); |
129 |
> |
me.name, source_p->name, chptr->chname); |
130 |
|
} |
131 |
|
} |
132 |
|
|
133 |
+ |
static void |
134 |
+ |
ms_topic(struct Client *client_p, struct Client *source_p, |
135 |
+ |
int parc, char *parv[]) |
136 |
+ |
{ |
137 |
+ |
struct Channel *chptr = NULL; |
138 |
+ |
const char *from, *to; |
139 |
+ |
char topic_info[USERHOST_REPLYLEN]; |
140 |
+ |
|
141 |
+ |
if (IsCapable(source_p->from, CAP_TS6) && HasID(source_p)) |
142 |
+ |
{ |
143 |
+ |
from = me.id; |
144 |
+ |
to = source_p->id; |
145 |
+ |
} |
146 |
+ |
|
147 |
+ |
if (EmptyString(parv[1])) |
148 |
+ |
{ |
149 |
+ |
sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS), |
150 |
+ |
from, to, "TOPIC"); |
151 |
+ |
return; |
152 |
+ |
} |
153 |
+ |
|
154 |
+ |
if ((chptr = hash_find_channel(parv[1])) == NULL) |
155 |
+ |
{ |
156 |
+ |
sendto_one(source_p, form_str(ERR_NOSUCHCHANNEL), |
157 |
+ |
from, to, parv[1]); |
158 |
+ |
return; |
159 |
+ |
} |
160 |
+ |
|
161 |
+ |
if (!IsClient(source_p)) |
162 |
+ |
strlcpy(topic_info, source_p->name, sizeof(topic_info)); |
163 |
+ |
else |
164 |
+ |
snprintf(topic_info, sizeof(topic_info), "%s!%s@%s", source_p->name, |
165 |
+ |
source_p->username, source_p->host); |
166 |
+ |
set_channel_topic(chptr, parv[2], topic_info, CurrentTime, 0); |
167 |
+ |
|
168 |
+ |
sendto_server(client_p, CAP_TS6, NOCAPS, ":%s TOPIC %s :%s", |
169 |
+ |
ID(source_p), chptr->chname, |
170 |
+ |
chptr->topic); |
171 |
+ |
sendto_server(client_p, NOCAPS, CAP_TS6, ":%s TOPIC %s :%s", |
172 |
+ |
source_p->name, chptr->chname, |
173 |
+ |
chptr->topic); |
174 |
+ |
|
175 |
+ |
if (!IsClient(source_p)) |
176 |
+ |
sendto_channel_local(ALL_MEMBERS, 0, chptr, ":%s TOPIC %s :%s", |
177 |
+ |
source_p->name, |
178 |
+ |
chptr->chname, chptr->topic); |
179 |
+ |
|
180 |
+ |
else |
181 |
+ |
sendto_channel_local(ALL_MEMBERS, 0, chptr, ":%s!%s@%s TOPIC %s :%s", |
182 |
+ |
source_p->name, |
183 |
+ |
source_p->username, |
184 |
+ |
source_p->host, |
185 |
+ |
chptr->chname, chptr->topic); |
186 |
+ |
} |
187 |
+ |
|
188 |
+ |
|
189 |
|
static struct Message topic_msgtab = { |
190 |
|
"TOPIC", 0, 0, 2, MAXPARA, MFLG_SLOW, 0, |
191 |
< |
{m_unregistered, m_topic, m_topic, m_ignore, m_topic, m_ignore} |
191 |
> |
{m_unregistered, m_topic, ms_topic, m_ignore, m_topic, m_ignore} |
192 |
|
}; |
193 |
|
|
194 |
|
static void |