Committer : entrope
CVSROOT : /cvsroot/undernet-ircu
Module : ircu2.10
Branch tags: u2_10_12_branch
Commit time: 2006-11-04 21:35:38 UTC
Modified files:
Tag: u2_10_12_branch
ChangeLog doc/readme.who include/whocmds.h ircd/channel.c
ircd/m_who.c ircd/whocmds.c
Log message:
Allow -A channels to have oplevels as well. Allow showing oplevels in /who.
---------------------- diff included ----------------------
Index: ircu2.10/ChangeLog
diff -u ircu2.10/ChangeLog:1.710.2.123 ircu2.10/ChangeLog:1.710.2.124
--- ircu2.10/ChangeLog:1.710.2.123 Sat Oct 21 08:29:10 2006
+++ ircu2.10/ChangeLog Sat Nov 4 13:35:27 2006
@@ -1,3 +1,21 @@
+2006-11-04 Michael Poole <[EMAIL PROTECTED]>
+
+ * doc/readme.who: Document new 'o' field flag.
+
+ * include/whocmds.h (WHO_FIELD_OPL): New flag.
+
+ * ircd/channel.c (send_channel_modes): Rename feat_oplevels to
+ send_oplevels and determine it automatically.
+ (modebuf_flush_int): Pass along oplevel if it's less than
+ MAXOPLEVEL.
+ (mode_process_clients): Allow oplevels to be inherited for -A
+ channels. Inherit the opper's oplevel if >= MAXOPLEVEL.
+
+ * ircd/m_who.c (m_who): Recognize 'o' flag as WHO_FIELD_OPL.
+
+ * ircd/whocmds.c (do_who): Send oplevel for WHO_FIELD_OPL, but
+ only show up to the requester's own oplevel.
+
2006-10-21 Michael Poole <[EMAIL PROTECTED]>
* ircd/convert-conf.c (finish_connects): Fix error display for
Index: ircu2.10/doc/readme.who
diff -u ircu2.10/doc/readme.who:1.4.2.1 ircu2.10/doc/readme.who:1.4.2.2
--- ircu2.10/doc/readme.who:1.4.2.1 Thu Apr 6 20:43:06 2006
+++ ircu2.10/doc/readme.who Sat Nov 4 13:35:28 2006
@@ -99,6 +99,7 @@
t : Include the querytype in the reply
u : Include userID with eventual ~
a : Include account name
+ o : Include oplevel (shows 999 to users without ops in the channel)
And the ,<querytype> final option can be used to specify what you want the
server to say in the querytype field of the output, useful to filter the
Index: ircu2.10/include/whocmds.h
diff -u ircu2.10/include/whocmds.h:1.10 ircu2.10/include/whocmds.h:1.10.2.1
--- ircu2.10/include/whocmds.h:1.10 Fri Sep 23 19:57:20 2005
+++ ircu2.10/include/whocmds.h Sat Nov 4 13:35:28 2006
@@ -1,6 +1,6 @@
/** @file whocmds.h
* @brief Support functions for /WHO-like commands.
- * @version $Id: whocmds.h,v 1.10 2005/09/24 02:57:20 entrope Exp $
+ * @version $Id: whocmds.h,v 1.10.2.1 2006/11/04 21:35:28 entrope Exp $
*/
#ifndef INCLUDED_whocmds_h
#define INCLUDED_whocmds_h
@@ -37,6 +37,7 @@
#define WHO_FIELD_REN 512 /**< Show realname (info). */
#define WHO_FIELD_IDL 1024 /**< Show idle time. */
#define WHO_FIELD_ACC 2048 /**< Show account name. */
+#define WHO_FIELD_OPL 4096 /**< Show oplevel. */
/** Default fields for /WHO */
#define WHO_FIELD_DEF ( WHO_FIELD_NIC | WHO_FIELD_UID | WHO_FIELD_HOS |
WHO_FIELD_SER )
Index: ircu2.10/ircd/channel.c
diff -u ircu2.10/ircd/channel.c:1.155.2.15 ircu2.10/ircd/channel.c:1.155.2.16
--- ircu2.10/ircd/channel.c:1.155.2.15 Tue Apr 4 16:09:47 2006
+++ ircu2.10/ircd/channel.c Sat Nov 4 13:35:28 2006
@@ -19,7 +19,7 @@
*/
/** @file
* @brief Channel management and maintenance
- * @version $Id: channel.c,v 1.155.2.15 2006/04/04 23:09:47 entrope Exp $
+ * @version $Id: channel.c,v 1.155.2.16 2006/11/04 21:35:28 entrope Exp $
*/
#include "config.h"
@@ -914,7 +914,7 @@
int opped_members_index = 0;
struct Membership** opped_members = NULL;
int last_oplevel = 0;
- int feat_oplevels = (chptr->mode.apass[0]) != '\0';
+ int send_oplevels = 0;
assert(0 != cptr);
assert(0 != chptr);
@@ -972,6 +972,9 @@
++number_of_ops;
else
opped_members[opped_members_index++] = member;
+ /* We also send oplevels if anyone is below the weakest level. */
+ if (OpLevel(member) < MAXOPLEVEL)
+ send_oplevels = 1;
}
/* Only handle the members with the flags that we are interested in. */
if ((member->status & CHFL_VOICED_OR_OPPED) == current_flags[flag_cnt])
@@ -1012,7 +1015,7 @@
if (IsChanOp(member)) /* flag_cnt == 2 or 3 */
{
/* append the absolute value of the oplevel */
- if (feat_oplevels)
+ if (send_oplevels)
loc += ircd_snprintf(0, tbuf + loc, sizeof(tbuf) - loc, "%u",
last_oplevel = member->oplevel);
else
tbuf[loc++] = 'o';
@@ -1021,7 +1024,7 @@
msgq_append(&me, mb, tbuf);
new_mode = 0;
}
- else if (feat_oplevels && flag_cnt > 1 && last_oplevel !=
member->oplevel)
+ else if (send_oplevels && flag_cnt > 1 && last_oplevel !=
member->oplevel)
{
/*
* This can't be the first member of a (continued) BURST
@@ -1806,8 +1809,7 @@
}
/* if we're changing oplevels and we know the oplevel, pass it on */
- if (mbuf->mb_channel->mode.apass[0]
- && (MB_TYPE(mbuf, i) & MODE_CHANOP)
+ if ((MB_TYPE(mbuf, i) & MODE_CHANOP)
&& MB_OPLEVEL(mbuf, i) < MAXOPLEVEL)
*strptr_i += ircd_snprintf(0, strptr + *strptr_i, BUFSIZE -
*strptr_i,
" %s%s:%d",
@@ -3083,8 +3085,8 @@
SetOpLevel(member, state->cli_change[i].oplevel);
else if (!state->member)
SetOpLevel(member, MAXOPLEVEL);
- else if (!state->chptr->mode.apass[0] || OpLevel(state->member) ==
MAXOPLEVEL)
- SetOpLevel(member, MAXOPLEVEL);
+ else if (OpLevel(state->member) >= MAXOPLEVEL)
+ SetOpLevel(member, OpLevel(state->member));
else
SetOpLevel(member, OpLevel(state->member) + 1);
}
Index: ircu2.10/ircd/m_who.c
diff -u ircu2.10/ircd/m_who.c:1.22.2.1 ircu2.10/ircd/m_who.c:1.22.2.2
--- ircu2.10/ircd/m_who.c:1.22.2.1 Fri Sep 30 20:45:19 2005
+++ ircu2.10/ircd/m_who.c Sat Nov 4 13:35:28 2006
@@ -20,7 +20,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * $Id: m_who.c,v 1.22.2.1 2005/10/01 03:45:19 entrope Exp $
+ * $Id: m_who.c,v 1.22.2.2 2006/11/04 21:35:28 entrope Exp $
*/
/*
@@ -271,6 +271,10 @@
case 'A':
fields |= WHO_FIELD_ACC;
break;
+ case 'o':
+ case 'O':
+ fields |= WHO_FIELD_OPL;
+ break;
default:
break;
}
Index: ircu2.10/ircd/whocmds.c
diff -u ircu2.10/ircd/whocmds.c:1.25 ircu2.10/ircd/whocmds.c:1.25.2.1
--- ircu2.10/ircd/whocmds.c:1.25 Mon Sep 26 20:59:55 2005
+++ ircu2.10/ircd/whocmds.c Sat Nov 4 13:35:28 2006
@@ -22,7 +22,7 @@
*/
/** @file
* @brief Support functions for /WHO-like commands.
- * @version $Id: whocmds.c,v 1.25 2005/09/27 03:59:55 entrope Exp $
+ * @version $Id: whocmds.c,v 1.25.2.1 2006/11/04 21:35:28 entrope Exp $
*/
#include "config.h"
@@ -86,7 +86,9 @@
that there are no common channels, thus use PubChannel and not
SeeChannel */
if (repchan)
+ {
chan = find_channel_member(acptr, repchan);
+ }
else if ((!fields || (fields & (WHO_FIELD_CHA | WHO_FIELD_FLA)))
&& !IsChannelService(acptr))
{
@@ -242,6 +244,23 @@
*(p1++) = '0';
}
+ if (fields & WHO_FIELD_OPL)
+ {
+ if (!chan || !IsChanOp(chan))
+ {
+ strcpy(p1, " n/a");
+ p1 += 4;
+ }
+ else
+ {
+ int vis_level = MAXOPLEVEL;
+ if ((IsGlobalChannel(chan->channel->chname) ? IsOper(sptr) :
IsAnOper(sptr))
+ || is_chan_op(sptr, chan->channel))
+ vis_level = OpLevel(chan);
+ p1 += ircd_snprintf(0, p1, 5, " %d", vis_level);
+ }
+ }
+
if (!fields || (fields & WHO_FIELD_REN))
{
char *p2 = cli_info(acptr);
----------------------- End of diff -----------------------
_______________________________________________
Patches mailing list
[email protected]
http://undernet.sbg.org/mailman/listinfo/patches