2 * SNAC - General Family
4 * Copyright (C) 2001 Barnaby Gray <barnaby@beedesign.co.uk>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
29 // --------------- Generic (Family 0x0001) ------------
31 void ServerReadySNAC::ParseBody(Buffer
& b
) {
32 /* The body of the server ready SNAC seems
33 * to be a list of the SNAC families the server
34 * will accept - the client is then expected
35 * to send back a list of those it wants
36 * - basically ignore this for the moment :-)
44 void RequestRateInfoSNAC::OutputBody(Buffer
& b
) const {
48 void RateInfoSNAC::ParseBody(Buffer
& b
) {
50 // shamelessly not parsing any of this :-(
54 for (unsigned short a
= 0; a
< n
; a
++) {
55 unsigned short major
, minor
;
64 void RateInfoAckSNAC::OutputBody(Buffer
& b
) const {
65 b
<< (unsigned short)0x0001
66 << (unsigned short)0x0002
67 << (unsigned short)0x0003
68 << (unsigned short)0x0004
69 << (unsigned short)0x0005;
72 void RateInfoChangeSNAC::ParseBody(Buffer
& b
) {
85 void CapabilitiesSNAC::OutputBody(Buffer
& b
) const {
86 /* doesn't seem any need currently to do more
87 * than copy the official client
89 unsigned short v1
= 0x0001, v3
= 0x0003, v4
= 0x0004;
90 b
<< SNAC_FAM_GEN
<< v3
98 << SNAC_FAM_SBL
<< v4
;
101 void CapAckSNAC::ParseBody(Buffer
& b
) {
102 /* server sends back the list from ServerReady again
103 * but with versions of families included
104 * - again ignore for the moment
106 unsigned short cap
, ver
;
107 while(b
.beforeEnd()) {
114 SetStatusSNAC::SetStatusSNAC(unsigned short status
, bool web_aware
)
115 : m_status(status
), m_sendextra(false), m_web_aware(web_aware
) { }
117 void SetStatusSNAC::OutputBody(Buffer
& b
) const {
118 StatusTLV
stlv(ALLOWDIRECT_EVERYONE
, (m_web_aware
? WEBAWARE_WEBAWARE
: WEBAWARE_NORMAL
), m_status
);
123 LANDetailsTLV
ltlv(m_ip
, m_port
);
128 void SetStatusSNAC::setSendExtra(bool b
) { m_sendextra
= b
; }
130 void SetStatusSNAC::setIP(unsigned int ip
) { m_ip
= ip
; }
132 void SetStatusSNAC::setPort(unsigned short port
) { m_port
= port
; }
134 void SetIdleSNAC::OutputBody(Buffer
& b
) const {
135 /* don't know what this value means exactly */
136 b
<< (unsigned int)0x00000000;
139 void ClientReadySNAC::OutputBody(Buffer
& b
) const {
140 /* related to capabilities again
141 * - figure this out sometime
163 void PersonalInfoRequestSNAC::OutputBody(Buffer
& b
) const {
167 void UserInfoSNAC::ParseBody(Buffer
& b
) {
171 void MOTDSNAC::ParseBody(Buffer
& b
) {
174 /* as far as I know only one TLV follows,
175 * but we'll treat it as a list
178 tlvlist
.Parse(b
, TLV_ParseMode_Channel02
, (short unsigned int)-1);
179 if (tlvlist
.exists(TLV_WebAddress
)) {
180 WebAddressTLV
*t
= (WebAddressTLV
*)tlvlist
[TLV_WebAddress
];