File: message.h

package info (click to toggle)
floater 1.2b1-6
  • links: PTS
  • area: non-free
  • in suites: woody
  • size: 1,612 kB
  • ctags: 1,822
  • sloc: ansic: 16,755; tcl: 4,034; sh: 1,291; makefile: 129
file content (126 lines) | stat: -rw-r--r-- 4,016 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
/* Copyright (c) 1996--1999 Geoff Pike. */
/* All rights reserved. */

/* Floater is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */

/* This software is provided "as is" and comes with absolutely no */
/* warranties.  Geoff Pike is not liable for damages under any */
/* circumstances.  Support is not provided.  Use at your own risk. */

/* Personal, non-commercial use is allowed.  Attempting to make money */
/* from Floater or products or code derived from Floater is not allowed */
/* without prior written consent from Geoff Pike.  Anything that remotely */
/* involves commercialism, including (but not limited to) systems that */
/* show advertisements while being used and systems that collect */
/* information on users that is later sold or traded require prior */
/* written consent from Geoff Pike. */
#ifndef __MESSAGE_H__
#define __MESSAGE_H__

/* the possible kinds of message follow */

#define MULTIMESSAGE 'M'

/* first, non-broadcast message types */
#define TABLES_REQUEST 't'
#define GOODBYE 'g'
#define LOGIN 'L'
#define LOGGED_IN 'i'
#define WRONG_PASSWORD 'w'
#define CHANGEPW '_'
#define CHANGEDPW '='
#define CHANGEEMAIL 'G'
#define CHANGEDEMAIL 'h'
#define NAME_IN_USE 'u'
#define REQUEST_JOIN 'J'
#define REJECTED_JOIN 'N'
#define ACCEPTED_JOIN 'Y'
#define JOIN_ELSEWHERE 'E'
#define REQUEST_SERVE '['
#define SERVE ']'
#define RESULT 'I'
#define INFO 'y'
#define REQUEST_RESULT 'R'
#define YOU_HAVE_SEEN 'U'
#define FIND 'b'
#define FOUND 'B'
#define nonbroadcast(c) (isin((c), "MtgLiw_=GhuJNYE[]IyRUbB"))

/* messages which are manually rebroadcast (sometimes) */
#define UPDATE_LOCATION 'k'
#define ANNOUNCE_LOGINSERVER 'l'
#define ANNOUNCE_TABLEHOST 'H'
#define ANNOUNCE_TABLEROOT '^'
#define PLAY_STATUS 'p'
#define PASS_STATUS 'j'
#define AUCTION_STATUS 'a'
#define NEW_HAND '*'
#define REQUEST_SEAT 'S'
#define SEEN 'e'
#define CC_TO_HOST 'v'
#define manualrebroadcast(c) (isin((c), "klH^pja*Sev"))

/* table-broadcast message types */
#define RESULT_DUMP 'z'
#define SAY '"'
#define SAY_EXCEPT_PARD '\''
#define SAY_TO_ONE '/'
#define SAY_TO_OPP 'O'
#define SAY_TO_SPEC '%'
#define ANNOUNCE_CONNECT 'C'
#define ANNOUNCE_DISCONNECT 'D'
#define ANNOUNCE_PRESENCE 'P'
#define FORGET_WHO 'F'
#define SEATED 's'
#define CLAIM 'c'
#define REJECT_CLAIM 'r'
#define ACCEPT_CLAIM 'A'
#define RETRACT_CLAIM 'o'
#define ANNOUNCE_GLOBALDATE 'd'
#define SPEC 'W'
#define CC 'V'
#define tablebroadcast(c) (isin(c, "z\"'/O%CDPFscrAodWV"))

/* global-broadcast message types */
#define FORGET_TABLES 'f'
#define ANNOUNCE_TABLE 'T'
#define TABLE_DEMISE '-'
#define globalbroadcast(c) (isin(c, "fT-"))

#define validmessagekind(c)						\
(globalbroadcast(c) || tablebroadcast(c) || manualrebroadcast(c)	\
 || nonbroadcast(c))

#define MAXMSGARGS 10
typedef struct {
  char kind;
  char **args;
  char *from, *ID;
} message;

message *makemsg10(char kind,
		   char *a, char *b, char *c, char *d, char *e,
		   char *f, char *g, char *h, char *i, char *j);

#define makemsg9(kind, a, b, c, d, e, f, g, h, i) makemsg10(kind, a, b, c, d, e, f, g, h, i, NULL)
#define makemsg8(kind, a, b, c, d, e, f, g, h) makemsg9(kind, a, b, c, d, e, f, g, h, NULL)
#define makemsg7(kind, a, b, c, d, e, f, g) makemsg8(kind, a, b, c, d, e, f, g, NULL)
#define makemsg6(kind, a, b, c, d, e, f) makemsg7(kind, a, b, c, d, e, f, NULL)
#define makemsg5(kind, a, b, c, d, e) makemsg6(kind, a, b, c, d, e, NULL)
#define makemsg4(kind, a, b, c, d) makemsg5(kind, a, b, c, d, NULL)
#define makemsg3(kind, a, b, c) makemsg4(kind, a, b, c, NULL)
#define makemsg2(kind, a, b) makemsg3(kind, a, b, NULL)
#define makemsg1(kind, a) makemsg2(kind, a, NULL)
#define makemsg0(kind) makemsg1(kind, NULL)

/* the different capacities in which one may wish to join */
#define KIBITZER 'K'
#define TABLE_SERVER 'T'
#define LHO 'L'
#define KIBITZERs "K"
#define TABLE_SERVERs "T"
#define LHOs "L"

#endif