summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormichael <michael@82007160-df01-0410-b94d-b575c5fd34c7>2014-01-23 19:11:35 +0000
committermichael <michael@82007160-df01-0410-b94d-b575c5fd34c7>2014-01-23 19:11:35 +0000
commit3408dd8c218a267139d9c4d64e3c6eb90502373a (patch)
treef822abd81f37ed9a93992f9765b03a0e1dc11f12
parent4794646cb6c696141411a34f2359d255e5ad9bad (diff)
- Implemented "userhost-in-names" client capability
git-svn-id: svn://svn.ircd-hybrid.org/svnroot/ircd-hybrid/branches/8.1.x@2911 82007160-df01-0410-b94d-b575c5fd34c7
-rw-r--r--include/client.h2
-rw-r--r--modules/m_cap.c1
-rw-r--r--src/channel.c20
3 files changed, 18 insertions, 5 deletions
diff --git a/include/client.h b/include/client.h
index ad9c69b..6f9ffdc 100644
--- a/include/client.h
+++ b/include/client.h
@@ -99,9 +99,11 @@ struct MaskItem;
#define CAP_MULTI_PREFIX 0x00000001
#define CAP_AWAY_NOTIFY 0x00000002
+#define CAP_UHNAMES 0x00000004
#define HasCap(x, y) ((x)->localClient->cap_active & (y))
+
/* housekeeping flags */
#define FLAGS_PINGSENT 0x00000001 /**< Unreplied ping sent */
#define FLAGS_DEADSOCKET 0x00000002 /**< Local socket is dead--Exiting soon */
diff --git a/modules/m_cap.c b/modules/m_cap.c
index 7771d31..970d9e5 100644
--- a/modules/m_cap.c
+++ b/modules/m_cap.c
@@ -56,6 +56,7 @@ static struct capabilities
} capab_list[] = {
#define _CAP(cap, flags, name) \
{ (cap), (flags), (name), sizeof(name) - 1 }
+ _CAP(CAP_UHNAMES, 0, "userhost-in-names"),
_CAP(CAP_MULTI_PREFIX, 0, "multi-prefix"),
_CAP(CAP_AWAY_NOTIFY, 0, "away-notify")
#undef _CAP
diff --git a/src/channel.c b/src/channel.c
index 4994df2..d422688 100644
--- a/src/channel.c
+++ b/src/channel.c
@@ -437,6 +437,7 @@ channel_member_names(struct Client *source_p, struct Channel *chptr,
int tlen = 0;
int is_member = IsMember(source_p, chptr);
int multi_prefix = HasCap(source_p, CAP_MULTI_PREFIX) != 0;
+ int uhnames = HasCap(source_p, CAP_UHNAMES) != 0;
if (PubChannel(chptr) || is_member)
{
@@ -452,7 +453,11 @@ channel_member_names(struct Client *source_p, struct Channel *chptr,
if (HasUMode(ms->client_p, UMODE_INVISIBLE) && !is_member)
continue;
- tlen = strlen(ms->client_p->name) + 1; /* nick + space */
+ if (!uhnames)
+ tlen = strlen(ms->client_p->name) + 1; /* nick + space */
+ else
+ tlen = strlen(ms->client_p->name) + strlen(ms->client_p->username) +
+ strlen(ms->client_p->host) + 3;
if (!multi_prefix)
{
@@ -476,8 +481,13 @@ channel_member_names(struct Client *source_p, struct Channel *chptr,
t = start;
}
- t += sprintf(t, "%s%s ", get_member_status(ms, multi_prefix),
- ms->client_p->name);
+ if (!uhnames)
+ t += sprintf(t, "%s%s ", get_member_status(ms, multi_prefix),
+ ms->client_p->name);
+ else
+ t += sprintf(t, "%s%s!%s@%s ", get_member_status(ms, multi_prefix),
+ ms->client_p->name, ms->client_p->username,
+ ms->client_p->host);
}
if (tlen != 0)
@@ -488,8 +498,8 @@ channel_member_names(struct Client *source_p, struct Channel *chptr,
}
if (show_eon)
- sendto_one(source_p, form_str(RPL_ENDOFNAMES),
- me.name, source_p->name, chptr->chname);
+ sendto_one(source_p, form_str(RPL_ENDOFNAMES), me.name,
+ source_p->name, chptr->chname);
}
/*! \brief adds client to invite list