ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/modules/m_topic.c
(Generate patch)

Comparing:
ircd-hybrid-7.2/modules/m_topic.c (file contents), Revision 895 by michael, Fri Nov 2 11:15:22 2007 UTC vs.
ircd-hybrid-8/modules/m_topic.c (file contents), Revision 1230 by michael, Thu Sep 22 19:41:19 2011 UTC

# Line 23 | Line 23
23   */
24  
25   #include "stdinc.h"
26 < #include "tools.h"
26 > #include "list.h"
27   #include "handlers.h"
28   #include "channel.h"
29   #include "channel_mode.h"
# Line 40 | Line 40
40   #include "parse.h"
41   #include "modules.h"
42   #include "packet.h"
43 – #include "common.h"
43  
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
44  
45   /* m_topic()
46   *  parv[0] = sender prefix
# Line 122 | Line 99 | m_topic(struct Client *client_p, struct
99      {
100        char topic_info[USERHOST_REPLYLEN];
101  
102 <      ircsprintf(topic_info, "%s!%s@%s", source_p->name,
103 <                 source_p->username, source_p->host);
102 >      snprintf(topic_info, sizeof(topic_info), "%s!%s@%s", source_p->name,
103 >               source_p->username, source_p->host);
104        set_channel_topic(chptr, parv[2], topic_info, CurrentTime);
105  
106        sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
107                      ":%s TOPIC %s :%s",
108                      ID(source_p), chptr->chname,
109 <                    chptr->topic == NULL ? "" : chptr->topic);
109 >                    chptr->topic);
110        sendto_server(client_p, chptr, NOCAPS, CAP_TS6,
111                      ":%s TOPIC %s :%s",
112                      source_p->name, chptr->chname,
113 <                    chptr->topic == NULL ? "" : chptr->topic);
114 <      sendto_channel_local(ALL_MEMBERS, NO,
113 >                    chptr->topic);
114 >      sendto_channel_local(ALL_MEMBERS, 0,
115                             chptr, ":%s!%s@%s TOPIC %s :%s",
116                             source_p->name,
117                             source_p->username,
118                             source_p->host,
119 <                           chptr->chname, chptr->topic == NULL ?
143 <                           "" : chptr->topic);
119 >                           chptr->chname, chptr->topic);
120      }
121      else
122        sendto_one(source_p, form_str(ERR_CHANOPRIVSNEEDED),
# Line 150 | Line 126 | m_topic(struct Client *client_p, struct
126    {
127      if (!SecretChannel(chptr) || IsMember(source_p, chptr))
128      {
129 <      if (chptr->topic == NULL)
129 >      if (chptr->topic[0] == '\0')
130          sendto_one(source_p, form_str(RPL_NOTOPIC),
131                     from, to, chptr->chname);
132        else
# Line 169 | Line 145 | m_topic(struct Client *client_p, struct
145                   from, to, chptr->chname);
146    }
147   }
148 +
149 + static struct Message topic_msgtab = {
150 +  "TOPIC", 0, 0, 2, MAXPARA, MFLG_SLOW, 0,
151 +  {m_unregistered, m_topic, m_topic, m_ignore, m_topic, m_ignore}
152 + };
153 +
154 + static void
155 + module_init(void)
156 + {
157 +  mod_add_cmd(&topic_msgtab);
158 + }
159 +
160 + static void
161 + module_exit(void)
162 + {
163 +  mod_del_cmd(&topic_msgtab);
164 + }
165 +
166 + struct module module_entry = {
167 +  .node    = { NULL, NULL, NULL },
168 +  .name    = NULL,
169 +  .version = "$Revision$",
170 +  .handle  = NULL,
171 +  .modinit = module_init,
172 +  .modexit = module_exit,
173 +  .flags   = 0
174 + };

Diff Legend

– Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)