unrealircd

- supernets unrealircd source & configuration
git clone git://git.acid.vegas/unrealircd.git
Log | Files | Refs | Archive | README | LICENSE

account-notify.c (2020B)

      1 /*
      2  *   IRC - Internet Relay Chat, src/modules/account-notify.c
      3  *   (C) 2012-2020 The UnrealIRCd Team
      4  *
      5  *   See file AUTHORS in IRC package for additional names of
      6  *   the programmers.
      7  *
      8  *   This program is free software; you can redistribute it and/or modify
      9  *   it under the terms of the GNU General Public License as published by
     10  *   the Free Software Foundation; either version 1, or (at your option)
     11  *   any later version.
     12  *
     13  *   This program is distributed in the hope that it will be useful,
     14  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
     15  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     16  *   GNU General Public License for more details.
     17  *
     18  *   You should have received a copy of the GNU General Public License
     19  *   along with this program; if not, write to the Free Software
     20  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     21  */
     22 
     23 #include "unrealircd.h"
     24 
     25 ModuleHeader MOD_HEADER
     26   = {
     27 	"account-notify",	/* Name of module */
     28 	"5.0", 			/* Version */
     29 	"account-notify CAP",	/* Short description of module */
     30 	"UnrealIRCd Team",
     31 	"unrealircd-6",
     32 	};
     33 
     34 /* Variables */
     35 long CAP_ACCOUNT_NOTIFY = 0L;
     36 
     37 /* Forward declarations */
     38 int account_notify_account_login(Client *client, MessageTag *mtags);
     39 
     40 MOD_INIT()
     41 {
     42 	ClientCapabilityInfo c;
     43 
     44 	MARK_AS_OFFICIAL_MODULE(modinfo);
     45 
     46 	memset(&c, 0, sizeof(c));
     47 	c.name = "account-notify";
     48 	ClientCapabilityAdd(modinfo->handle, &c, &CAP_ACCOUNT_NOTIFY);
     49 
     50 	HookAdd(modinfo->handle, HOOKTYPE_ACCOUNT_LOGIN, 0, account_notify_account_login);
     51 
     52 	return MOD_SUCCESS;
     53 }
     54 
     55 MOD_LOAD()
     56 {
     57 	return MOD_SUCCESS;
     58 }
     59 
     60 MOD_UNLOAD()
     61 {
     62 	return MOD_SUCCESS;
     63 }
     64 
     65 int account_notify_account_login(Client *client, MessageTag *recv_mtags)
     66 {
     67 	MessageTag *mtags = NULL;
     68 	new_message(client, recv_mtags, &mtags);
     69 	sendto_local_common_channels(client, client,
     70 				     CAP_ACCOUNT_NOTIFY, mtags,
     71 				     ":%s ACCOUNT %s",
     72 				     client->name,
     73 				     IsLoggedIn(client) ? client->user->account : "*");
     74 	free_message_tags(mtags);
     75 	return 0;
     76 }