ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/ermyth/include/pmodule.h
Revision: 1.3
Committed: Tue Aug 28 17:08:07 2007 UTC (16 years, 9 months ago) by pippijn
Content type: text/plain
Branch: MAIN
Changes since 1.2: +38 -28 lines
Log Message:
- changed name
- updated the example config to the new system
- added more documentation
- enhanced documentation generators
- added a link to the pdf to the website
- added an RSS feed generator
- transitioned hooks to c++ callbacks
- did various merges with upstream along the way
- added const where appropriate
- removed the old block allocator
- fixed most memory leaks
- transitioned some dictionaries to std::map
- transitioned some lists to std::vector
- made some free functions members where appropriate
- renamed string to dynstr and added a static string ststr
- use NOW instead of time (NULL) if possible
- completely reworked database backends, crypto handlers and protocol handlers
  to use an object factory
- removed the old module system. ermyth does not do any dynamic loading anymore
- fixed most of the build system
- reworked how protocol commands work

File Contents

# Content
1 /*
2 * Copyright © 2005 William Pitcock, et al.
3 * Rights to this code are as documented in doc/pod/license.pod.
4 *
5 * Protocol module stuff.
6 * Modules usually do not need this.
7 *
8 * $Id: pmodule.h,v 1.2 2007-07-21 01:29:07 pippijn Exp $
9 */
10
11 #ifndef PMODULE_H
12 #define PMODULE_H
13
14 struct pcommand_t
15 {
16 char const *token;
17 void (*handler) (sourceinfo_t *si, int parc, char *parv[]);
18 int minparc;
19 int sourcetype;
20 };
21
22 /* values for sourcetype */
23 #define MSRC_UNREG 1 /* before SERVER is sent */
24 #define MSRC_USER 2 /* from users */
25 #define MSRC_SERVER 4 /* from servers */
26
27 #define MAXPARC 35 /* max # params to protocol command */
28
29 E void pcommand_add (pcommand_t const &pcmd);
30 E void pcommand_delete (pcommand_t const &pcmd);
31 E pcommand_t const *pcommand_find (char const * const token);
32
33 template<int N>
34 inline void
35 pcommand_add (pcommand_t const (*pcmd)[N])
36 {
37 for (int i = 0; i < N; i++)
38 pcommand_add ((*pcmd)[i]);
39 }
40
41 template<int N>
42 inline void
43 pcommand_delete (pcommand_t const (*pcmd)[N])
44 {
45 for (int i = 0; i < N; i++)
46 pcommand_delete ((*pcmd)[i]);
47 }
48
49 /* ptasks.c */
50 E void handle_version (user_t *u);
51 E void handle_admin (user_t *u);
52 E void handle_info (user_t *u);
53 E void handle_stats (user_t *u, char req);
54 E void handle_whois (user_t *u, char *target);
55 E void handle_trace (user_t *u, char *target, char *dest);
56 E void handle_motd (user_t *u);
57 E void handle_away (user_t *u, char const * const message);
58 E void handle_message (sourceinfo_t *si, char *target, bool is_notice, char *message);
59 E void handle_topic_from (sourceinfo_t *si, channel_t *c, char const * const setter, time_t ts, char const * const topic);
60 // This is in services.h
61 //E void handle_topic (channel_t *c, char *setter, time_t ts, char *topic);
62 E void handle_kill (sourceinfo_t *si, char *victim, char const *reason);
63 E server_t *handle_server (sourceinfo_t *si, char const * const name, char const * const sid, int hops, char const * const desc);
64 E void handle_eob (server_t *s);
65 E bool should_reg_umode (user_t *u);
66
67 /* services.c */
68 E void services_init (void);
69 E void reintroduce_user (user_t *u);
70 E void handle_nickchange (user_t *u);
71 E void handle_burstlogin (user_t *u, char *login);
72
73 #endif