ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/ermyth/src/commandtree.C
(Generate patch)

Comparing ermyth/src/commandtree.C (file contents):
Revision 1.6 by pippijn, Wed Aug 29 21:42:28 2007 UTC vs.
Revision 1.7 by pippijn, Thu Aug 30 19:56:24 2007 UTC

2 * Copyright © 2007 Pippijn van Steenhoven / The Ermyth Team 2 * Copyright © 2007 Pippijn van Steenhoven / The Ermyth Team
3 * Rights to this code are as documented in doc/pod/gplicense.pod. 3 * Rights to this code are as documented in doc/pod/gplicense.pod.
4 * 4 *
5 * Commandtree manipulation routines. 5 * Commandtree manipulation routines.
6 * 6 *
7 * $Id: commandtree.C,v 1.6 2007/08/29 21:42:28 pippijn Exp $ 7 * $Id: commandtree.C,v 1.7 2007/08/30 19:56:24 pippijn Exp $
8 */ 8 */
9 9
10#include <algorithm> 10#include <algorithm>
11 11
12#include "atheme.h" 12#include "atheme.h"
13#include <common/dynbuf.h>
13#include "users.h" 14#include "users.h"
14#include "privs.h" 15#include "privs.h"
15 16
16static char const rcsid[] = "$Id: commandtree.C,v 1.6 2007/08/29 21:42:28 pippijn Exp $"; 17static char const rcsid[] = "$Id: commandtree.C,v 1.7 2007/08/30 19:56:24 pippijn Exp $";
17 18
18cmdvec null_cmdvec; 19cmdvec null_cmdvec;
19 20
20struct cmd_eq 21struct cmd_eq
21{ 22{
131 cmd (si, parc, parv); 132 cmd (si, parc, parv);
132 return; 133 return;
133 } 134 }
134 135
135 if (has_any_privs (si)) 136 if (has_any_privs (si))
136 command_fail (si, fault_noprivs, _("You do not have %s privilege."), access); 137 command_fail (si, fault::noprivs, _("You do not have %s privilege."), access);
137 else 138 else
138 command_fail (si, fault_noprivs, _("You are not authorized to perform this operation.")); 139 command_fail (si, fault::noprivs, _("You are not authorized to perform this operation."));
139 /*snoop(_("DENIED CMD: \2%s\2 used %s %s"), origin, svs->name, cmd); */ 140 /*snoop(_("DENIED CMD: \2%s\2 used %s %s"), origin, svs->name, cmd); */
140} 141}
141 142
142void 143void
143command_exec_split (service_t *svs, sourceinfo_t *si, char const * const cmd, char const * const text, cmdvec &commandlist) 144command_exec_split (service_t *svs, sourceinfo_t *si, char const * const cmd, char const * const text, cmdvec &commandlist)
266 * (taken from command_exec()) 267 * (taken from command_exec())
267 */ 268 */
268 size_t l = indent; 269 size_t l = indent;
269 if (!string_in_list (maincmds, c->name) && has_priv (si, c->access)) 270 if (!string_in_list (maincmds, c->name) && has_priv (si, c->access))
270 { 271 {
271 if (buf.length () > l) 272 if (buf.size () > l)
272 buf.append (", ", 2); 273 buf.add (", ", 2);
273 if (buf.length () > 55) 274 if (buf.size () > 55)
274 { 275 {
275 command_success_nodata (si, "%s", buf.c_str ()); 276 command_success_nodata (si, "%s", buf.c_str ());
276 buf.reset (); 277 buf.clear ();
277 while (--l > 0) 278 while (--l > 0)
278 buf.append (' '); 279 buf.add (' ');
279 buf.append (' '); 280 buf.add (' ');
280 l = indent; 281 l = indent;
281 } 282 }
282 buf.append (c->name, strlen (c->name)); 283 buf.add (c->name, strlen (c->name));
283 } 284 }
284 } 285 }
285 286
286private: 287private:
287 sourceinfo_t *si; 288 sourceinfo_t *si;
304 305
305 std::for_each (commandlist.begin (), commandlist.end (), render_help_short (si, maincmds)); 306 std::for_each (commandlist.begin (), commandlist.end (), render_help_short (si, maincmds));
306 307
307 command_success_nodata (si, " "); 308 command_success_nodata (si, " ");
308 lbuf = _("Other commands: "); 309 lbuf = _("Other commands: ");
309 buf.append (lbuf, l = strlen (lbuf)); 310 buf.add (lbuf, l = strlen (lbuf));
310 311
311 std::for_each (commandlist.begin (), commandlist.end (), render_list (si, buf, maincmds, l)); 312 std::for_each (commandlist.begin (), commandlist.end (), render_list (si, buf, maincmds, l));
312 313
313 if (buf.length () > l) 314 if (buf.size () > l)
314 command_success_nodata (si, "%s", buf.c_str ()); 315 command_success_nodata (si, "%s", buf.c_str ());
315} 316}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines