mirror of
https://github.com/matrix-construct/construct
synced 2024-12-27 07:54:05 +01:00
[svn] monitor: send the same message buffer to all users
monitoring a certain nick; the target field of the numeric becomes *, much like server notices
This commit is contained in:
parent
66b4a7ae7a
commit
8aba962d43
6 changed files with 61 additions and 20 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
jilles 2007/06/22 21:59:09 UTC (20070622-3518)
|
||||||
|
Log:
|
||||||
|
Call add_to_hostname_hash() with correct (orig) hostname.
|
||||||
|
|
||||||
|
|
||||||
|
Changes: Modified:
|
||||||
|
+1 -1 trunk/modules/core/m_nick.c (File Modified)
|
||||||
|
|
||||||
|
|
||||||
jilles 2007/06/10 16:14:03 UTC (20070610-3516)
|
jilles 2007/06/10 16:14:03 UTC (20070610-3516)
|
||||||
Log:
|
Log:
|
||||||
Version bump on trunk to 2.3.
|
Version bump on trunk to 2.3.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
MONITOR - Protocol for notification of when clients become online/offline
|
MONITOR - Protocol for notification of when clients become online/offline
|
||||||
Lee Hardy <lee -at- leeh.co.uk>
|
Lee Hardy <lee -at- leeh.co.uk>
|
||||||
$Id: monitor.txt 6 2005-09-10 01:02:21Z nenolod $
|
$Id: monitor.txt 3520 2007-06-30 22:15:35Z jilles $
|
||||||
-------------------------------------------------------------------------
|
-------------------------------------------------------------------------
|
||||||
|
|
||||||
Currently, ISON requests by clients use a large amount of bandwidth. It is
|
Currently, ISON requests by clients use a large amount of bandwidth. It is
|
||||||
|
@ -76,6 +76,10 @@ This numeric is used to indicate to a client that either a nickname has just
|
||||||
become online, or that a nickname they have added to their monitor list is
|
become online, or that a nickname they have added to their monitor list is
|
||||||
online.
|
online.
|
||||||
|
|
||||||
|
The server may send "*" instead of the target nick (<nick>). (This makes it
|
||||||
|
possible to send the exact same message to all clients monitoring a certain
|
||||||
|
nick.)
|
||||||
|
|
||||||
731 - RPL_MONOFFLINE
|
731 - RPL_MONOFFLINE
|
||||||
--------------------
|
--------------------
|
||||||
:<server> 731 <nick> :nick[,nick1]*
|
:<server> 731 <nick> :nick[,nick1]*
|
||||||
|
@ -86,6 +90,8 @@ list is offline.
|
||||||
|
|
||||||
The argument is a chained list of nicknames that are offline.
|
The argument is a chained list of nicknames that are offline.
|
||||||
|
|
||||||
|
As with 730 the server may send "*" instead of the target nick.
|
||||||
|
|
||||||
732 - RPL_MONLIST
|
732 - RPL_MONLIST
|
||||||
-----------------
|
-----------------
|
||||||
:<server> 732 <nick> :nick[,nick1]*
|
:<server> 732 <nick> :nick[,nick1]*
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||||
* USA
|
* USA
|
||||||
*
|
*
|
||||||
* $Id: send.h 661 2006-02-03 04:20:31Z gxti $
|
* $Id: send.h 3520 2007-06-30 22:15:35Z jilles $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef INCLUDED_send_h
|
#ifndef INCLUDED_send_h
|
||||||
|
@ -33,6 +33,7 @@
|
||||||
struct Client;
|
struct Client;
|
||||||
struct Channel;
|
struct Channel;
|
||||||
struct dlink_list;
|
struct dlink_list;
|
||||||
|
struct monitor;
|
||||||
|
|
||||||
/* The nasty global also used in s_serv.c for server bursts */
|
/* The nasty global also used in s_serv.c for server bursts */
|
||||||
extern unsigned long current_serial;
|
extern unsigned long current_serial;
|
||||||
|
@ -65,6 +66,8 @@ extern void sendto_match_butone(struct Client *, struct Client *,
|
||||||
extern void sendto_match_servs(struct Client *source_p, const char *mask,
|
extern void sendto_match_servs(struct Client *source_p, const char *mask,
|
||||||
int capab, int, const char *, ...) AFP(5, 6);
|
int capab, int, const char *, ...) AFP(5, 6);
|
||||||
|
|
||||||
|
extern void sendto_monitor(struct monitor *monptr, const char *, ...) AFP(2, 3);
|
||||||
|
|
||||||
extern void sendto_anywhere(struct Client *, struct Client *, const char *,
|
extern void sendto_anywhere(struct Client *, struct Client *, const char *,
|
||||||
const char *, ...) AFP(4, 5);
|
const char *, ...) AFP(4, 5);
|
||||||
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
#define SERNO "20070610-3516"
|
#define SERNO "20070622-3518"
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id: monitor.c 312 2005-11-07 10:47:33Z jilles $
|
* $Id: monitor.c 3520 2007-06-30 22:15:35Z jilles $
|
||||||
*/
|
*/
|
||||||
#include "stdinc.h"
|
#include "stdinc.h"
|
||||||
#include "tools.h"
|
#include "tools.h"
|
||||||
|
@ -98,8 +98,6 @@ monitor_signon(struct Client *client_p)
|
||||||
{
|
{
|
||||||
char buf[USERHOST_REPLYLEN];
|
char buf[USERHOST_REPLYLEN];
|
||||||
struct monitor *monptr = find_monitor(client_p->name, 0);
|
struct monitor *monptr = find_monitor(client_p->name, 0);
|
||||||
struct Client *target_p;
|
|
||||||
dlink_node *ptr;
|
|
||||||
|
|
||||||
/* noones watching this nick */
|
/* noones watching this nick */
|
||||||
if(monptr == NULL)
|
if(monptr == NULL)
|
||||||
|
@ -108,13 +106,7 @@ monitor_signon(struct Client *client_p)
|
||||||
ircsnprintf(buf, sizeof(buf), "%s!%s@%s",
|
ircsnprintf(buf, sizeof(buf), "%s!%s@%s",
|
||||||
client_p->name, client_p->username, client_p->host);
|
client_p->name, client_p->username, client_p->host);
|
||||||
|
|
||||||
DLINK_FOREACH(ptr, monptr->users.head)
|
sendto_monitor(monptr, form_str(RPL_MONONLINE), me.name, "*", buf);
|
||||||
{
|
|
||||||
target_p = ptr->data;
|
|
||||||
|
|
||||||
sendto_one(target_p, form_str(RPL_MONONLINE),
|
|
||||||
me.name, target_p->name, buf);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* monitor_signoff()
|
/* monitor_signoff()
|
||||||
|
@ -128,17 +120,13 @@ void
|
||||||
monitor_signoff(struct Client *client_p)
|
monitor_signoff(struct Client *client_p)
|
||||||
{
|
{
|
||||||
struct monitor *monptr = find_monitor(client_p->name, 0);
|
struct monitor *monptr = find_monitor(client_p->name, 0);
|
||||||
dlink_node *ptr;
|
|
||||||
|
|
||||||
/* noones watching this nick */
|
/* noones watching this nick */
|
||||||
if(monptr == NULL)
|
if(monptr == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
DLINK_FOREACH(ptr, monptr->users.head)
|
sendto_monitor(monptr, form_str(RPL_MONOFFLINE), me.name, "*",
|
||||||
{
|
client_p->name);
|
||||||
sendto_one(ptr->data, form_str(RPL_MONOFFLINE),
|
|
||||||
me.name, ((struct Client *) ptr->data)->name, client_p->name);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
37
src/send.c
37
src/send.c
|
@ -21,7 +21,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||||
* USA
|
* USA
|
||||||
*
|
*
|
||||||
* $Id: send.c 3161 2007-01-25 07:23:01Z nenolod $
|
* $Id: send.c 3520 2007-06-30 22:15:35Z jilles $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "stdinc.h"
|
#include "stdinc.h"
|
||||||
|
@ -43,6 +43,7 @@
|
||||||
#include "s_log.h"
|
#include "s_log.h"
|
||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
#include "hook.h"
|
#include "hook.h"
|
||||||
|
#include "monitor.h"
|
||||||
|
|
||||||
#define LOG_BUFSIZE 2048
|
#define LOG_BUFSIZE 2048
|
||||||
|
|
||||||
|
@ -928,6 +929,40 @@ sendto_match_servs(struct Client *source_p, const char *mask, int cap,
|
||||||
linebuf_donebuf(&linebuf_name);
|
linebuf_donebuf(&linebuf_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* sendto_monitor()
|
||||||
|
*
|
||||||
|
* inputs - monitor nick to send to, format, va_args
|
||||||
|
* outputs - message to local users monitoring the given nick
|
||||||
|
* side effects -
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
sendto_monitor(struct monitor *monptr, const char *pattern, ...)
|
||||||
|
{
|
||||||
|
va_list args;
|
||||||
|
buf_head_t linebuf;
|
||||||
|
struct Client *target_p;
|
||||||
|
dlink_node *ptr;
|
||||||
|
dlink_node *next_ptr;
|
||||||
|
|
||||||
|
linebuf_newbuf(&linebuf);
|
||||||
|
|
||||||
|
va_start(args, pattern);
|
||||||
|
linebuf_putmsg(&linebuf, pattern, &args, NULL);
|
||||||
|
va_end(args);
|
||||||
|
|
||||||
|
DLINK_FOREACH_SAFE(ptr, next_ptr, monptr->users.head)
|
||||||
|
{
|
||||||
|
target_p = ptr->data;
|
||||||
|
|
||||||
|
if(IsIOError(target_p))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
_send_linebuf(target_p, &linebuf);
|
||||||
|
}
|
||||||
|
|
||||||
|
linebuf_donebuf(&linebuf);
|
||||||
|
}
|
||||||
|
|
||||||
/* sendto_anywhere()
|
/* sendto_anywhere()
|
||||||
*
|
*
|
||||||
* inputs - target, source, va_args
|
* inputs - target, source, va_args
|
||||||
|
|
Loading…
Reference in a new issue