diff options
author | michael <michael@82007160-df01-0410-b94d-b575c5fd34c7> | 2013-01-11 12:59:24 +0000 |
---|---|---|
committer | michael <michael@82007160-df01-0410-b94d-b575c5fd34c7> | 2013-01-11 12:59:24 +0000 |
commit | 9206712a4455da4ae692005f4e3181fd36ba6f42 (patch) | |
tree | 81a48680db284ee7813cd25672ba46f98cee2252 /modules | |
parent | 01cb956987521194a8ef673095a36025847387ac (diff) |
- Add support for "away-notify" client capability
git-svn-id: svn://svn.ircd-hybrid.org/svnroot/ircd-hybrid/trunk@1734 82007160-df01-0410-b94d-b575c5fd34c7
Diffstat (limited to 'modules')
-rw-r--r-- | modules/core/m_join.c | 16 | ||||
-rw-r--r-- | modules/core/m_nick.c | 4 | ||||
-rw-r--r-- | modules/core/m_sjoin.c | 5 | ||||
-rw-r--r-- | modules/m_away.c | 29 | ||||
-rw-r--r-- | modules/m_cap.c | 3 | ||||
-rw-r--r-- | modules/m_svsnick.c | 2 |
6 files changed, 52 insertions, 7 deletions
diff --git a/modules/core/m_join.c b/modules/core/m_join.c index badef89..569663b 100644 --- a/modules/core/m_join.c +++ b/modules/core/m_join.c @@ -233,6 +233,11 @@ m_join(struct Client *client_p, struct Client *source_p, source_p->host, chptr->chname); sendto_channel_local(ALL_MEMBERS, 0, chptr, ":%s MODE %s +nt", me.name, chptr->chname); + if (source_p->away[0]) + sendto_channel_local_butone(source_p, 0, CAP_AWAY_NOTIFY, chptr, + ":%s!%s@%s AWAY :%s", + source_p->name, source_p->username, + source_p->host, source_p->away); } else { @@ -248,6 +253,12 @@ m_join(struct Client *client_p, struct Client *source_p, sendto_channel_local(ALL_MEMBERS, 0, chptr, ":%s!%s@%s JOIN :%s", source_p->name, source_p->username, source_p->host, chptr->chname); + + if (source_p->away[0]) + sendto_channel_local_butone(source_p, 0, CAP_AWAY_NOTIFY, chptr, + ":%s!%s@%s AWAY :%s", + source_p->name, source_p->username, + source_p->host, source_p->away); } del_invite(chptr, source_p); @@ -415,6 +426,11 @@ ms_join(struct Client *client_p, struct Client *source_p, sendto_channel_local(ALL_MEMBERS, 0, chptr, ":%s!%s@%s JOIN :%s", source_p->name, source_p->username, source_p->host, chptr->chname); + if (source_p->away[0]) + sendto_channel_local_butone(source_p, 0, CAP_AWAY_NOTIFY, chptr, + ":%s!%s@%s AWAY :%s", + source_p->name, source_p->username, + source_p->host, source_p->away); } sendto_server(client_p, CAP_TS6, NOCAPS, diff --git a/modules/core/m_nick.c b/modules/core/m_nick.c index 2f10317..1250d2c 100644 --- a/modules/core/m_nick.c +++ b/modules/core/m_nick.c @@ -148,7 +148,7 @@ change_local_nick(struct Client *source_p, const char *nick) sendto_realops_flags(UMODE_NCHANGE, L_ALL, SEND_NOTICE, "Nick change: From %s to %s [%s@%s]", source_p->name, nick, source_p->username, source_p->host); - sendto_common_channels_local(source_p, 1, ":%s!%s@%s NICK :%s", + sendto_common_channels_local(source_p, 1, 0, ":%s!%s@%s NICK :%s", source_p->name, source_p->username, source_p->host, nick); add_history(source_p, 1); @@ -728,7 +728,7 @@ nick_from_server(struct Client *client_p, struct Client *source_p, int parc, source_p->tsinfo = newts ? newts : CurrentTime; } - sendto_common_channels_local(source_p, 1, ":%s!%s@%s NICK :%s", + sendto_common_channels_local(source_p, 1, 0, ":%s!%s@%s NICK :%s", source_p->name,source_p->username, source_p->host, nick); diff --git a/modules/core/m_sjoin.c b/modules/core/m_sjoin.c index a072183..c817c99 100644 --- a/modules/core/m_sjoin.c +++ b/modules/core/m_sjoin.c @@ -423,6 +423,11 @@ ms_sjoin(struct Client *client_p, struct Client *source_p, sendto_channel_local(ALL_MEMBERS, 0, chptr, ":%s!%s@%s JOIN :%s", target_p->name, target_p->username, target_p->host, chptr->chname); + if (target_p->away[0]) + sendto_channel_local_butone(target_p, 0, CAP_AWAY_NOTIFY, chptr, + ":%s!%s@%s AWAY :%s", + target_p->name, target_p->username, + target_p->host, target_p->away); } if (fl & CHFL_CHANOP) diff --git a/modules/m_away.c b/modules/m_away.c index 700494f..926ff21 100644 --- a/modules/m_away.c +++ b/modules/m_away.c @@ -53,12 +53,16 @@ m_away(struct Client *client_p, struct Client *source_p, /* Marking as not away */ if (source_p->away[0]) { + source_p->away[0] = '\0'; /* we now send this only if they were away before --is */ sendto_server(client_p, CAP_TS6, NOCAPS, ":%s AWAY", ID(source_p)); sendto_server(client_p, NOCAPS, CAP_TS6, ":%s AWAY", source_p->name); - source_p->away[0] = '\0'; + sendto_common_channels_local(source_p, 1, CAP_AWAY_NOTIFY, + ":%s!%s@%s AWAY", + source_p->name, source_p->username, + source_p->host); } sendto_one(source_p, form_str(RPL_UNAWAY), @@ -74,13 +78,21 @@ m_away(struct Client *client_p, struct Client *source_p, } source_p->localClient->last_away = CurrentTime; + sendto_one(source_p, form_str(RPL_NOWAWAY), me.name, source_p->name); + + if (strncmp(source_p->away, parv[1], sizeof(source_p->away) - 1)) + return; + strlcpy(source_p->away, parv[1], sizeof(source_p->away)); + sendto_common_channels_local(source_p, 1, CAP_AWAY_NOTIFY, + ":%s!%s@%s AWAY :%s", + source_p->name, source_p->username, + source_p->host, source_p->away); sendto_server(client_p, CAP_TS6, NOCAPS, ":%s AWAY :%s", ID(source_p), source_p->away); sendto_server(client_p, NOCAPS, CAP_TS6, ":%s AWAY :%s", source_p->name, source_p->away); - sendto_one(source_p, form_str(RPL_NOWAWAY), me.name, source_p->name); } static void @@ -95,19 +107,30 @@ ms_away(struct Client *client_p, struct Client *source_p, /* Marking as not away */ if (source_p->away[0]) { + source_p->away[0] = '\0'; /* we now send this only if they were away before --is */ sendto_server(client_p, CAP_TS6, NOCAPS, ":%s AWAY", ID(source_p)); sendto_server(client_p, NOCAPS, CAP_TS6, ":%s AWAY", source_p->name); - source_p->away[0] = '\0'; + sendto_common_channels_local(source_p, 1, CAP_AWAY_NOTIFY, + ":%s!%s@%s AWAY", + source_p->name, source_p->username, + source_p->host); } return; } + if (strncmp(source_p->away, parv[1], sizeof(source_p->away) - 1)) + return; + strlcpy(source_p->away, parv[1], sizeof(source_p->away)); + sendto_common_channels_local(source_p, 1, CAP_AWAY_NOTIFY, + ":%s!%s@%s AWAY :%s", + source_p->name, source_p->username, + source_p->host, source_p->away); sendto_server(client_p, CAP_TS6, NOCAPS, ":%s AWAY :%s", ID(source_p), source_p->away); sendto_server(client_p, NOCAPS, CAP_TS6, diff --git a/modules/m_cap.c b/modules/m_cap.c index 0633da3..842c1c9 100644 --- a/modules/m_cap.c +++ b/modules/m_cap.c @@ -58,7 +58,8 @@ static struct capabilities } capab_list[] = { #define _CAP(cap, flags, name) \ { (cap), (flags), (name), sizeof(name) - 1 } - _CAP(CAP_MULTI_PREFIX, 0, "multi-prefix") + _CAP(CAP_MULTI_PREFIX, 0, "multi-prefix"), + _CAP(CAP_AWAY_NOTIFY, 0, "away-notify") #undef _CAP }; diff --git a/modules/m_svsnick.c b/modules/m_svsnick.c index ff638d7..4847cbd 100644 --- a/modules/m_svsnick.c +++ b/modules/m_svsnick.c @@ -98,7 +98,7 @@ ms_svsnick(struct Client *client_p, struct Client *source_p, send_umode(target_p, target_p, oldmodes, 0xffffffff, modebuf); } - sendto_common_channels_local(target_p, 1, ":%s!%s@%s NICK :%s", + sendto_common_channels_local(target_p, 1, 0, ":%s!%s@%s NICK :%s", target_p->name, target_p->username, target_p->host, parv[2]); |