2000-04-25 Kevin L. Mitchell <klmitch@mit.edu>
+ * ircd/ircd_snprintf.c (doprintf): implement %H for possible
+ future expansion (channel numerics?)
+
+ * include/ircd_snprintf.h: added documentation to # to explain use
+ with %C; added documentation for : to explain use with %C; added
+ documentation for %H for channels
+
* ircd/whocmds.c: use send_reply
* ircd/userload.c: use sendcmdto_one
#
# ChangeLog for ircu2.10.11
#
-# $Id: ChangeLog,v 1.101 2000-04-25 20:22:25 kev Exp $
+# $Id: ChangeLog,v 1.102 2000-04-25 20:33:50 kev Exp $
#
# Insert new changes at beginning of the change list.
#
** (normally, a decimal point appears in the results of those
** conversions only if a digit follows). For g and G
** conversions, trailing zeros are not removed from the result as
-** they would otherwise be.
+** they would otherwise be. For C conversions, if the
+** destination is local and the origin is a user, the
+** nick!user@host form is used.
**
** 0 specifying zero padding. For all conversions except n, the
** converted value is padded on the left with zeros rather than
** produced by a signed conversion. A + overrides a space if
** both are used.
**
+** : specifying that a struct Client name should be preceded by a
+** ':' character if the destination is a user
+**
** * An optional decimal digit string specifying a minimum field
** width. If the converted value has fewer characters than the
** field width, it will be padded with spaces on the left (or right,
** is printed; otherwise, the client's network numeric is
** printed.
**
+** H The channel argument identifier (channel name) is
+** printed.
+**
** v The argument given must be a pointer to a struct
** VarData with vd_format and vd_args must be initialized
** appropriately. On return, vd_chars will contain the
#define CONV_STRING 0x04000000 /* convert strings */
#define CONV_VARARGS 0x05000000 /* convert a %v */
#define CONV_CLIENT 0x06000000 /* convert a struct Client */
+#define CONV_CHANNEL 0x07000000 /* convert a struct Channel */
-#define CONV_RESERVED8 0x07000000 /* reserved for future expansion */
-#define CONV_RESERVED7 0x08000000
+#define CONV_RESERVED7 0x08000000 /* reserved for future expansion */
#define CONV_RESERVED6 0x09000000
#define CONV_RESERVED5 0x0a000000
#define CONV_RESERVED4 0x0b000000
fld_s.flags |= ARG_PTR | CONV_CLIENT;
break;
+ case 'H': /* convert a channel name... */
+ fld_s.flags &= ~(FLAG_PLUS | FLAG_SPACE | FLAG_ALT | FLAG_ZERO |
+ FLAG_COLON | TYPE_MASK);
+ fld_s.flags |= ARG_PTR | CONV_CHANNEL;
+ break;
+
default: /* Unsupported, display a message and the entire format */
adds(buf_p, -1, "(Unsupported: %");
adds(buf_p, fmt - fstart + 1, fstart);
if (str3)
adds(buf_p, slen3, str3);
+ if (plen > 0 && (fld_s.flags & FLAG_MINUS))
+ do_pad(buf_p, plen, spaces); /* post-padding */
+ } else if ((fld_s.flags & CONV_MASK) == CONV_CHANNEL) {
+ struct Channel *chan = (struct Channel *)fld_s.value.v_ptr;
+ char *str = chan->chname;
+ int slen, plen;
+
+ slen = my_strnlen(str, fld_s.prec); /* str lengths and pad lengths */
+ plen = (fld_s.width - slen <= 0 ? 0 : fld_s.width - slen);
+
+ if (plen > 0 && !(fld_s.flags & FLAG_MINUS))
+ do_pad(buf_p, plen, spaces); /* pre-padding */
+
+ adds(buf_p, slen, str); /* add the string */
+
if (plen > 0 && (fld_s.flags & FLAG_MINUS))
do_pad(buf_p, plen, spaces); /* post-padding */
}