1 /*  pckt_pmke.c
2  *
3  *  copyright (c) 2000-2003 SeaD
4  *  see GPL for copying info
5  *
6  */
7 
8 #include <string.h>
9 #include <unistd.h>
10 #include "echat.h"
11 #include "pckt_ppak.h"
12 
make_pwelcome(void)13 void make_pwelcome(void) {
14     status->packet_len = snprintf(packet, MSG_SIZE, "%c%s%c%u%c%u%c%u",
15         MSG_PWELCOME,
16         config->nick, MSG_SPLIT,
17         1, MSG_SPLIT,           /* mode */
18         1, MSG_SPLIT,           /* gender */
19         1);                     /* channel ? */
20 }
21 
make_pbye(void)22 void make_pbye(void) {
23     status->packet_len = snprintf(packet, MSG_SIZE, "%c%s%c%u",
24         MSG_PBYE,
25         config->nick, MSG_SPLIT,
26         1);                     /* channel ? */
27 }
28 
make_pjoin(void)29 void make_pjoin(void) {
30     status->packet_len = snprintf(packet, MSG_SIZE, "%c%s%c%s%c%s%c%u",
31         MSG_PJOIN,
32         config->nick, MSG_SPLIT,
33         status->nick, MSG_SPLIT,
34         status->channel, MSG_SPLIT,
35         1);                     /* mode || gender ? */
36 }
37 
make_pleave(void)38 void make_pleave(void) {
39     status->packet_len = snprintf(packet, MSG_SIZE, "%c%s%c%s%c%u",
40         MSG_PLEAVE,
41         status->channel, MSG_SPLIT,
42         config->nick, MSG_SPLIT,
43         1);                     /* gender ? */
44 }
45 
make_pherewho(void)46 void make_pherewho(void) {
47     status->packet_len = snprintf(packet, MSG_SIZE, "%c%s",
48         MSG_PHEREWHO,
49         config->nick);
50 }
51 
make_phereim(void)52 void make_phereim(void) {
53     status->packet_len = snprintf(packet, MSG_SIZE, "%c%s%c%u%c%s%c%u",
54         MSG_PHEREIM,
55         status->nick, MSG_SPLIT,
56         1, MSG_SPLIT,           /* mode ? */
57         config->nick, MSG_SPLIT,
58         0);                     /* active ? */
59 }
60 
make_phere(void)61 void make_phere(void) {
62     status->packet_len = snprintf(packet, MSG_SIZE, "%c%s",
63         MSG_PHEREWHO,
64         config->nick);
65 }
66 
make_pchat(void)67 void make_pchat(void) {
68     status->packet_len = snprintf(packet, MSG_SIZE, "%c%s%c%s%c%s",
69         MSG_PCHAT,
70         status->channel, MSG_SPLIT,
71         config->nick, MSG_SPLIT,
72         buf);
73 }
74 
make_pme(void)75 void make_pme(void) {
76     status->packet_len = snprintf(packet, MSG_SIZE, "%c%s%c%s%c%s",
77         MSG_PME,
78         status->channel, MSG_SPLIT,
79         config->nick, MSG_SPLIT,
80         buf);
81 }
82 
make_pmesg(void)83 void make_pmesg(void) {
84     status->packet_len = snprintf(packet, MSG_SIZE, "%c%s%c%s%c%s",
85         MSG_PMESG,
86         config->nick, MSG_SPLIT,
87         status->nick, MSG_SPLIT,
88         buf);
89 }
90 
make_pmass(void)91 void make_pmass(void) {
92     status->packet_len = snprintf(packet, MSG_SIZE, "%c%s%c%s%s%s%c%s",
93         MSG_PMASS,
94         config->nick, MSG_SPLIT,
95         "*Multiple*;", status->nick, ";", MSG_SPLIT,
96         buf);
97 }
98 
make_pmesgack(void)99 void make_pmesgack(void) {
100     status->packet_len = snprintf(packet, MSG_SIZE, "%c%s%c%s%c%u%c%s%s%s%c%u",
101         MSG_PMESGACK,
102         config->nick, MSG_SPLIT,
103         status->nick, MSG_SPLIT,
104         1, MSG_SPLIT,           /* gender */
105         (config->mode == MOD_DND) ? config->answer_dnd : "",
106         (config->mode == MOD_AWAY) ? config->answer_away : "",
107         (config->mode == MOD_OFF) ? config->answer_off : "",
108         MSG_SPLIT,
109         0);                     /* mode */
110 }
111 
make_ptopic(void)112 void make_ptopic(void) {
113     status->packet_len = snprintf(packet, MSG_SIZE, "%c%s%c%s",
114         MSG_PTOPIC,
115         status->nick, MSG_SPLIT,
116         status->chnl[chnl_getnum()].topic);
117 }
118 
make_ptopicnew(void)119 void make_ptopicnew(void) {
120     status->packet_len = snprintf(packet, MSG_SIZE, "%c%s%c%s",
121         MSG_PTOPICNEW,
122         config->nick, MSG_SPLIT,
123         status->room->topic);
124 }
125 
make_pprivjoin(void)126 void make_pprivjoin(void) {
127     status->packet_len = snprintf(packet, MSG_SIZE, "%c%s%c%s%c%u",
128         MSG_PPRIVJOIN,
129         config->nick, MSG_SPLIT,
130         status->channel, MSG_SPLIT,
131         0);                     /* gender */
132 }
133 
make_pprivjoinack(void)134 void make_pprivjoinack(void) {
135     status->packet_len = snprintf(packet, MSG_SIZE, "%c%s%c%s%c%u",
136         MSG_PPRIVJOINACK,
137         config->nick, MSG_SPLIT,
138         status->channel, MSG_SPLIT,
139         0);                     /* gender */
140 }
141 
make_pprivleave(void)142 void make_pprivleave(void) {
143     status->packet_len = snprintf(packet, MSG_SIZE, "%c%s%c%s%c%u",
144         MSG_PPRIVLEAVE,
145         config->nick, MSG_SPLIT,
146         status->channel, MSG_SPLIT,
147         0);                     /* gender */
148 }
149 
make_pnick(void)150 void make_pnick(void) {
151     status->packet_len = snprintf(packet, MSG_SIZE, "%c%s%c%s%c%u%c%u",
152         MSG_PNICK,
153         status->nick, MSG_SPLIT,
154         config->nick, MSG_SPLIT,
155         1, MSG_SPLIT,
156         0);
157 }
158 
make_pmode(void)159 void make_pmode(void) {
160     status->packet_len = snprintf(packet, MSG_SIZE, "%s%s%s%s%s%c%u%c%u",
161         (config->mode == MOD_NORMAL) ? "1" : "",
162         (config->mode == MOD_DND) ? "2" : "",
163         (config->mode == MOD_AWAY) ? "3" : "",
164         (config->mode == MOD_OFF) ? "4" : "",
165         config->nick, MSG_SPLIT,
166         1, MSG_SPLIT,           /* ??? */
167         1);                     /* ??? */
168 }
169 
make_pactive(void)170 void make_pactive(void) {
171     status->packet_len = snprintf(packet, MSG_SIZE, "%c%s%c%u%c%u",
172         MSG_PACTIVE,
173         config->nick, MSG_SPLIT,
174         1, MSG_SPLIT,           /* ??? */
175         config->active);
176 }
177 
make_pinfo(void)178 void make_pinfo(void) {
179     status->packet_len = snprintf(packet, MSG_SIZE, "%c%s%c%s",
180         MSG_PINFO,
181         status->nick, MSG_SPLIT,
182         config->nick);
183 }
184 
make_pinform(void)185 void make_pinform(void) {
186     status->packet_len = snprintf(packet, MSG_SIZE, "%c%s%c%s%c%s%c%s%c%s%c%s%c%s%c%s%c%s%c%s%c%s%c%s",
187         MSG_PINFORM,
188         status->nick, MSG_SPLIT,
189         "192.168.1.234", MSG_SPLIT,
190         "523=760 KB", MSG_SPLIT,
191         "47 %", MSG_SPLIT,
192         "autoanswer", MSG_SPLIT,
193         "userinfo", MSG_SPLIT,
194         config->nick, MSG_SPLIT,
195         "NBTHOST", MSG_SPLIT,
196         "User ???", MSG_SPLIT,
197         "* eChat *", MSG_SPLIT,
198         "FreeBSD", MSG_SPLIT,
199         "#Main ???");
200 }
201 
make_pbeep(void)202 void make_pbeep(void) {
203     status->packet_len = snprintf(packet, MSG_SIZE, "%c%s%c%s",
204         MSG_PBEEP,
205         status->nick, MSG_SPLIT,
206         config->nick);
207 }
208 
make_pbeepack(void)209 void make_pbeepack(void) {
210     status->packet_len = snprintf(packet, MSG_SIZE, "%c%s%c%s%c%u%c%u",
211         MSG_PBEEPACK,
212         status->nick, MSG_SPLIT,
213         config->nick, MSG_SPLIT,
214         0, MSG_SPLIT,           /* ??? */
215         0);                     /* gender */
216 }
217 
make_pexec(void)218 void make_pexec(void) {
219     status->packet_len = snprintf(packet, MSG_SIZE, "%c%s%c%s%c%s%c%s",
220         MSG_PEXEC,
221         config->nick, MSG_SPLIT,
222         status->nick, MSG_SPLIT,
223         buf, MSG_SPLIT,
224         "");
225 }
226 
make_pexecack(void)227 void make_pexecack(void) {
228     status->packet_len = snprintf(packet, MSG_SIZE, "%c%s%c%s%c%u",
229         MSG_PEXECACK,
230         status->nick, MSG_SPLIT,
231         config->nick, MSG_SPLIT,
232         3);                     /* ??? */
233 }
234 
make_pchnls(void)235 void make_pchnls(void) {
236     status->packet_len = snprintf(packet, MSG_SIZE, "%c%s%c%s%c%u",
237         MSG_PCHNLS,
238         status->channel, MSG_SPLIT,
239         config->nick, MSG_SPLIT,
240         1);                     /* ??? */
241 }
242 
make_pchnlslist(void)243 void make_pchnlslist(void) {
244     status->packet_len = snprintf(packet, MSG_SIZE, "%c%s%c%s",
245         MSG_PCHNLSLIST,
246         status->nick, MSG_SPLIT,
247         "#Main");
248 }
249