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

Comparing ircd-hybrid-8/modules/m_capab.c (file contents):
Revision 1178 by michael, Mon Aug 15 08:11:31 2011 UTC vs.
Revision 1569 by michael, Tue Oct 16 18:46:53 2012 UTC

# Line 23 | Line 23
23   */
24  
25   #include "stdinc.h"
26 #include "handlers.h"
26   #include "client.h"
27   #include "irc_string.h"
28   #include "s_serv.h"
29 < #include "s_conf.h"
31 < #include "msg.h"
29 > #include "conf.h"
30   #include "parse.h"
31   #include "modules.h"
32  
35 static void mr_capab(struct Client *, struct Client *, int, char *[]);
36
37 struct Message capab_msgtab = {
38  "CAPAB", 0, 0, 0, MAXPARA, MFLG_SLOW | MFLG_UNREG, 0,
39  { mr_capab, m_ignore, m_ignore, m_ignore, m_ignore, m_ignore }
40 };
41
42 void
43 _modinit(void)
44 {
45  mod_add_cmd(&capab_msgtab);
46 }
47
48 void
49 _moddeinit(void)
50 {
51  mod_del_cmd(&capab_msgtab);
52 }
53
54 const char *_version = "$Revision$";
33  
34   /*
35   * mr_capab - CAPAB message handler
# Line 67 | Line 45 | mr_capab(struct Client *client_p, struct
45    int cap;
46    char *p = NULL;
47    char *s = NULL;
70 #ifdef HAVE_LIBCRYPTO
71  const struct EncCapability *ecap;
72  unsigned int cipher = 0;
73 #endif
48  
49    if (client_p->localClient->caps && !(IsCapable(client_p, CAP_TS6)))
50    {
# Line 81 | Line 55 | mr_capab(struct Client *client_p, struct
55    SetCapable(client_p, CAP_CAP);
56  
57    for (i = 1; i < parc; ++i)
84  {
58      for (s = strtoken(&p, parv[i], " "); s;
59           s = strtoken(&p,    NULL, " "))
60 <    {
88 < #ifdef HAVE_LIBCRYPTO
89 <      if (!strncmp(s, "ENC:", 4))
90 <      {
91 <        /* Skip the "ENC:" portion */
92 <        s += 4;
93 <
94 <        /* Check the remaining portion against the list of ciphers we
95 <         * have available (CipherTable).
96 <         */
97 <        for (ecap = CipherTable; ecap->name; ++ecap)
98 <        {
99 <          if (!irccmp(ecap->name, s) && (ecap->cap & CAP_ENC_MASK))
100 <          {
101 <            cipher = ecap->cap;
102 <            break;
103 <          }
104 <        }
105 <
106 <        /* Since the name and capabilities matched, use it. */
107 <        if (cipher != 0)
108 <        {
109 <          SetCapable(client_p, CAP_ENC);
110 <          client_p->localClient->enc_caps |= cipher;
111 <        }
112 <        else
113 <        {
114 <          /* cipher is still zero; we didn't find a matching entry. */
115 <          exit_client(client_p, client_p,
116 <                      "Cipher selected is not available here.");
117 <          return;
118 <        }
119 <      }
120 <      else /* normal capab */
121 < #endif
122 <        if ((cap = find_capability(s)) != 0)
60 >        if ((cap = find_capability(s)))
61            SetCapable(client_p, cap);
124    }
125  }
62   }
63 +
64 + static struct Message capab_msgtab = {
65 +  "CAPAB", 0, 0, 0, MAXPARA, MFLG_SLOW, 0,
66 +  { mr_capab, m_ignore, m_ignore, m_ignore, m_ignore, m_ignore }
67 + };
68 +
69 + static void
70 + module_init(void)
71 + {
72 +  mod_add_cmd(&capab_msgtab);
73 + }
74 +
75 + static void
76 + module_exit(void)
77 + {
78 +  mod_del_cmd(&capab_msgtab);
79 + }
80 +
81 + struct module module_entry = {
82 +  .node    = { NULL, NULL, NULL },
83 +  .name    = NULL,
84 +  .version = "$Revision$",
85 +  .handle  = NULL,
86 +  .modinit = module_init,
87 +  .modexit = module_exit,
88 +  .flags   = 0
89 + };

Diff Legend

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