[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:
jilles 2007-06-30 15:15:35 -07:00
parent 66b4a7ae7a
commit 8aba962d43
6 changed files with 61 additions and 20 deletions

View File

@ -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)
Log:
Version bump on trunk to 2.3.

View File

@ -1,6 +1,6 @@
MONITOR - Protocol for notification of when clients become online/offline
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
@ -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
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
--------------------
:<server> 731 <nick> :nick[,nick1]*
@ -86,6 +90,8 @@ list is 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
-----------------
:<server> 732 <nick> :nick[,nick1]*

View File

@ -21,7 +21,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* 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
@ -33,6 +33,7 @@
struct Client;
struct Channel;
struct dlink_list;
struct monitor;
/* The nasty global also used in s_serv.c for server bursts */
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,
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 *,
const char *, ...) AFP(4, 5);

View File

@ -1 +1 @@
#define SERNO "20070610-3516"
#define SERNO "20070622-3518"

View File

@ -29,7 +29,7 @@
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* 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 "tools.h"
@ -98,8 +98,6 @@ monitor_signon(struct Client *client_p)
{
char buf[USERHOST_REPLYLEN];
struct monitor *monptr = find_monitor(client_p->name, 0);
struct Client *target_p;
dlink_node *ptr;
/* noones watching this nick */
if(monptr == NULL)
@ -108,13 +106,7 @@ monitor_signon(struct Client *client_p)
ircsnprintf(buf, sizeof(buf), "%s!%s@%s",
client_p->name, client_p->username, client_p->host);
DLINK_FOREACH(ptr, monptr->users.head)
{
target_p = ptr->data;
sendto_one(target_p, form_str(RPL_MONONLINE),
me.name, target_p->name, buf);
}
sendto_monitor(monptr, form_str(RPL_MONONLINE), me.name, "*", buf);
}
/* monitor_signoff()
@ -128,17 +120,13 @@ void
monitor_signoff(struct Client *client_p)
{
struct monitor *monptr = find_monitor(client_p->name, 0);
dlink_node *ptr;
/* noones watching this nick */
if(monptr == NULL)
return;
DLINK_FOREACH(ptr, monptr->users.head)
{
sendto_one(ptr->data, form_str(RPL_MONOFFLINE),
me.name, ((struct Client *) ptr->data)->name, client_p->name);
}
sendto_monitor(monptr, form_str(RPL_MONOFFLINE), me.name, "*",
client_p->name);
}
void

View File

@ -21,7 +21,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* 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"
@ -43,6 +43,7 @@
#include "s_log.h"
#include "memory.h"
#include "hook.h"
#include "monitor.h"
#define LOG_BUFSIZE 2048
@ -928,6 +929,40 @@ sendto_match_servs(struct Client *source_p, const char *mask, int cap,
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()
*
* inputs - target, source, va_args