1 /* 2 * IRC - Internet Relay Chat, include/h.h 3 * Copyright (C) 1996 - 1997 Carlo Wood 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 2, or (at your option) 8 * any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program; if not, write to the Free Software 17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 18 */ 19 /** @file 20 * @brief Interface for numeric nickname functions. 21 * @version $Id$ 22 */ 23 #ifndef INCLUDED_numnicks_h 24 #define INCLUDED_numnicks_h 25 #ifndef INCLUDED_client_h 26 #include "client.h" 27 #endif 28 #ifndef INCLUDED_sys_types_h 29 #include <sys/types.h> 30 #define INCLUDED_sys_types_h 31 #endif 32 33 /* 34 * General defines 35 */ 36 37 /* 38 * used for buffer size calculations in channel.c 39 */ 40 /** Maximum length of a full user numnick. */ 41 #define NUMNICKLEN 5 /* strlen("YYXXX") */ 42 43 /* 44 * Macros 45 */ 46 47 /** Provide format string arguments for a user's numnick. 48 * Use this macro as follows: sprintf(buf, "%s%s ...", NumNick(cptr), ...); 49 */ 50 #define NumNick(c) cli_yxx((cli_user(c))->server), cli_yxx(c) 51 52 /** Provide format string arguments for a server's numnick. 53 * Use this macro as follows: sprintf(buf, "%s ...", NumServ(cptr), ...); 54 */ 55 #define NumServ(c) cli_yxx(c) 56 57 /** Provide format string arguments for a server's capacity mask. 58 * Use this macro as follows: sprintf(buf, "%s%s ...", NumServCap(cptr), ...); 59 */ 60 #define NumServCap(c) cli_yxx(c), (cli_serv(c))->nn_capacity 61 62 /* 63 * Structures 64 */ 65 struct Client; 66 67 /* 68 * Proto types 69 */ 70 extern void SetRemoteNumNick(struct Client* cptr, const char* yxx); 71 extern int SetLocalNumNick(struct Client* cptr); 72 extern void RemoveYXXClient(struct Client* server, const char* yxx); 73 extern void SetServerYXX(struct Client* cptr, 74 struct Client* server, const char* yxx); 75 extern void ClearServerYXX(const struct Client* server); 76 77 extern void SetYXXCapacity(struct Client* myself, unsigned int max_clients); 78 extern void SetYXXServerName(struct Client* myself, unsigned int numeric); 79 80 extern int markMatchexServer(const char* cmask, int minlen); 81 extern struct Client* find_match_server(char* mask); 82 extern struct Client* findNUser(const char* yxx); 83 extern struct Client* FindNServer(const char* numeric); 84 85 extern unsigned int base64toint(const char* str); 86 extern const char* inttobase64(char* buf, unsigned int v, unsigned int count); 87 extern const char* iptobase64(char* buf, const struct irc_in_addr* addr, unsigned int count, int v6_ok); 88 extern void base64toip(const char* s, struct irc_in_addr* addr); 89 90 #endif /* INCLUDED_numnicks_h */ 91 92