ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/branches/8.2.x/modules/m_resync.c
Revision: 10117
Committed: Mon Jun 13 15:12:33 2022 UTC (4 years, 1 month ago) by michael
Content type: text/x-csrc
File size: 2820 byte(s)
Log Message:
- Add RESYNC server command for later use. Servers can use this command to request the mode/topic state of a channel

File Contents

# Content
1 /*
2 * ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3 *
4 * Copyright (c) 2022-2022 ircd-hybrid development team
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
19 * USA
20 */
21
22 /*! \file m_resync.c
23 * \brief Includes required functions for processing the RESYNC command.
24 * \version $Id$
25 */
26
27 #include "stdinc.h"
28 #include "client.h"
29 #include "ircd.h"
30 #include "send.h"
31 #include "parse.h"
32 #include "modules.h"
33 #include "server.h"
34 #include "server_capab.h"
35 #include "hash.h"
36 #include "channel.h"
37
38
39 /*! \brief RESYNC command handler
40 *
41 * \param source_p Pointer to allocated Client struct from which the message
42 * originally comes from. This can be a local or remote client.
43 * \param parc Integer holding the number of supplied arguments.
44 * \param parv Argument vector where parv[0] .. parv[parc-1] are non-NULL
45 * pointers.
46 * \note Valid arguments for this command are:
47 * - parv[0] = command
48 * - parv[1] = channel name
49 */
50 static void
51 ms_resync(struct Client *source_p, int parc, char *parv[])
52 {
53 assert(MyConnect(source_p));
54 assert(IsServer(source_p));
55
56 if (!MyConnect(source_p))
57 return;
58
59 struct Channel *channel = hash_find_channel(parv[1]);
60 if (channel == NULL)
61 return;
62
63 channel_send_modes(source_p, channel);
64
65 if (channel->topic_time)
66 sendto_one(source_p, ":%s TBURST %ju %s %ju %s :%s", me.id,
67 channel->creation_time, channel->name,
68 channel->topic_time, channel->topic_info,
69 channel->topic);
70 }
71
72 static struct Message resync_msgtab =
73 {
74 .cmd = "RESYNC",
75 .handlers[UNREGISTERED_HANDLER] = { .handler = m_unregistered },
76 .handlers[CLIENT_HANDLER] = { .handler = m_ignore },
77 .handlers[SERVER_HANDLER] = { .handler = ms_resync },
78 .handlers[ENCAP_HANDLER] = { .handler = m_ignore },
79 .handlers[OPER_HANDLER] = { .handler = m_ignore }
80 };
81
82 static void
83 module_init(void)
84 {
85 mod_add_cmd(&resync_msgtab);
86 }
87
88 static void
89 module_exit(void)
90 {
91 mod_del_cmd(&resync_msgtab);
92 }
93
94 struct module module_entry =
95 {
96 .version = "$Revision$",
97 .modinit = module_init,
98 .modexit = module_exit,
99 };

Properties

Name Value
svn:eol-style native
svn:keywords Id Revision