snacs.go 103 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900
  1. package wire
  2. import (
  3. "bytes"
  4. "encoding/binary"
  5. "errors"
  6. "fmt"
  7. "strconv"
  8. "strings"
  9. "github.com/google/uuid"
  10. )
  11. //
  12. // Food Group Codes
  13. //
  14. const (
  15. BOS uint16 = 0x0000
  16. OService uint16 = 0x0001
  17. Locate uint16 = 0x0002
  18. Buddy uint16 = 0x0003
  19. ICBM uint16 = 0x0004
  20. Advert uint16 = 0x0005
  21. Invite uint16 = 0x0006
  22. Admin uint16 = 0x0007
  23. Popup uint16 = 0x0008
  24. PermitDeny uint16 = 0x0009
  25. UserLookup uint16 = 0x000A
  26. Stats uint16 = 0x000B
  27. Translate uint16 = 0x000C
  28. ChatNav uint16 = 0x000D
  29. Chat uint16 = 0x000E
  30. ODir uint16 = 0x000F
  31. BART uint16 = 0x0010
  32. Feedbag uint16 = 0x0013
  33. ICQ uint16 = 0x0015
  34. BUCP uint16 = 0x0017
  35. Alert uint16 = 0x0018
  36. Plugin uint16 = 0x0022
  37. UnnamedFG24 uint16 = 0x0024
  38. MDir uint16 = 0x0025
  39. ARS uint16 = 0x044A
  40. Kerberos uint16 = 0x050C
  41. )
  42. //
  43. // General Error Codes
  44. //
  45. const (
  46. ErrorCodeInvalidSnac uint16 = 0x01
  47. ErrorCodeRateToHost uint16 = 0x02
  48. ErrorCodeRateToClient uint16 = 0x03
  49. ErrorCodeNotLoggedOn uint16 = 0x04
  50. ErrorCodeServiceUnavailable uint16 = 0x05
  51. ErrorCodeServiceNotDefined uint16 = 0x06
  52. ErrorCodeObsoleteSnac uint16 = 0x07
  53. ErrorCodeNotSupportedByHost uint16 = 0x08
  54. ErrorCodeNotSupportedByClient uint16 = 0x09
  55. ErrorCodeRefusedByClient uint16 = 0x0A
  56. ErrorCodeReplyTooBig uint16 = 0x0B
  57. ErrorCodeResponsesLost uint16 = 0x0C
  58. ErrorCodeRequestDenied uint16 = 0x0D
  59. ErrorCodeBustedSnacPayload uint16 = 0x0E
  60. ErrorCodeInsufficientRights uint16 = 0x0F
  61. ErrorCodeInLocalPermitDeny uint16 = 0x10
  62. ErrorCodeTooEvilSender uint16 = 0x11
  63. ErrorCodeTooEvilReceiver uint16 = 0x12
  64. ErrorCodeUserTempUnavail uint16 = 0x13
  65. ErrorCodeNoMatch uint16 = 0x14
  66. ErrorCodeListOverflow uint16 = 0x15
  67. ErrorCodeRequestAmbigous uint16 = 0x16
  68. ErrorCodeQueueFull uint16 = 0x17
  69. ErrorCodeNotWhileOnAol uint16 = 0x18
  70. ErrorCodeQueryFail uint16 = 0x19
  71. ErrorCodeTimeout uint16 = 0x1A
  72. ErrorCodeErrorText uint16 = 0x1B
  73. ErrorCodeGeneralFailure uint16 = 0x1C
  74. ErrorCodeProgress uint16 = 0x1D
  75. ErrorCodeInFreeArea uint16 = 0x1E
  76. ErrorCodeRestrictedByPc uint16 = 0x1F
  77. ErrorCodeRemoteRestrictedByPc uint16 = 0x20
  78. ErrorTLVFailURL uint16 = 0x0004 // URL with more detail
  79. ErrorTLVErrorSubcode uint16 = 0x0008 // Foodgroup-specific error code
  80. ErrorTLVErrorText uint16 = 0x001B // String error message text
  81. ErrorTLVErrorInfoCLSID uint16 = 0x0029 // UUID specifying format of ERROR_INFO_DATA data
  82. ErrorTLVErrorInfoData uint16 = 0x002A // Extra information describing error
  83. )
  84. //
  85. // Authentication
  86. //
  87. const (
  88. LoginTLVTagsScreenName uint16 = 0x01
  89. LoginTLVTagsRoastedPassword uint16 = 0x02
  90. LoginTLVTagsClientIdentity uint16 = 0x03
  91. LoginTLVTagsReconnectHere uint16 = 0x05
  92. LoginTLVTagsAuthorizationCookie uint16 = 0x06
  93. LoginTLVTagsErrorSubcode uint16 = 0x08
  94. LoginTLVTagsPasswordHash uint16 = 0x25
  95. LoginTLVTagsMultiConnFlags uint16 = 0x4A
  96. LoginTLVTagsMaxSendSize uint16 = 0x8001
  97. LoginTLVTagsMaxRecvSize uint16 = 0x8003
  98. LoginTLVTagsHostSuffix uint16 = 0x8004
  99. LoginTLVTagsRoastedKerberosPassword uint16 = 0x1335
  100. LoginTLVTagsRoastedTOCPassword uint16 = 0x1337
  101. LoginTLVTagsPlaintextKerberosPassword uint16 = 0x1338
  102. LoginTLVTagsPlaintextPassword uint16 = 0x1339
  103. // LoginTLVTagsTokenTTL is the auth cookie lifetime the client requests, a
  104. // uint32 count of seconds. Absent, the server picks its own default.
  105. LoginTLVTagsTokenTTL uint16 = 0x133A
  106. LoginTLVTagsUseBigTime uint16 = 0x2038
  107. )
  108. const (
  109. LoginErrInvalidUsernameOrPassword uint16 = 0x0001
  110. LoginErrInvalidPassword uint16 = 0x0005 // invalid password
  111. LoginErrInternalClientError uint16 = 0x0006 // client sent a malformed request
  112. LoginErrInvalidAccount uint16 = 0x0007
  113. LoginErrDeletedAccount uint16 = 0x0008
  114. LoginErrExpiredAccount uint16 = 0x0009
  115. LoginErrSuspendedAccount uint16 = 0x0011 // suspended account
  116. LoginErrTooHeavilyWarned uint16 = 0x0019
  117. LoginErrRateLimitExceeded uint16 = 0x001D
  118. LoginErrInvalidSecureID uint16 = 0x0020
  119. LoginErrSuspendedAccountAge uint16 = 0x0022 // suspended due to age (age < 13 years)
  120. LoginErrICQUserErr uint16 = 0x0008 // ICQ user doesn't exist
  121. )
  122. type MultiConnFlag uint8
  123. const (
  124. MultiConnFlagsOldClient MultiConnFlag = 0x0 // client doesn't support multi-conn
  125. MultiConnFlagsRecentClient MultiConnFlag = 0x1 // client supports multi-conn
  126. MultiConnFlagsSingleClient MultiConnFlag = 0x3 // client supports multi-conn but only wants 1 concurrent session
  127. )
  128. //
  129. // Capability IDs
  130. //
  131. var (
  132. // CapChat is the UUID that represents an OSCAR client's ability to chat
  133. CapChat = uuid.MustParse("748F2420-6287-11D1-8222-444553540000")
  134. // CapFileTransfer is the UUID that represents an OSCAR client's ability to send files
  135. CapFileTransfer = uuid.MustParse("09461343-4C7F-11D1-8222-444553540000")
  136. //
  137. // Short Caps (0946XXYY-4C7F-11D1-8222-444553540000 format)
  138. //
  139. // CapShortCaps indicates the client supports short capability format
  140. CapShortCaps = uuid.MustParse("09460000-4C7F-11D1-8222-444553540000")
  141. // CapSecureIM indicates the client supports SECURE_IM encryption
  142. CapSecureIM = uuid.MustParse("09460001-4C7F-11D1-8222-444553540000")
  143. // CapXHTMLIM indicates the client supports XHTML profile and IMs instead of AOLRTF
  144. CapXHTMLIM = uuid.MustParse("09460002-4C7F-11D1-8222-444553540000")
  145. // CapRTCVideo indicates the client supports SIP/RTP video
  146. CapRTCVideo = uuid.MustParse("09460101-4C7F-11D1-8222-444553540000")
  147. // CapHasCamera indicates the client has a camera
  148. CapHasCamera = uuid.MustParse("09460102-4C7F-11D1-8222-444553540000")
  149. // CapHasMicrophone indicates the client has a microphone
  150. CapHasMicrophone = uuid.MustParse("09460103-4C7F-11D1-8222-444553540000")
  151. // CapRTCAudio indicates the client supports RTC audio
  152. CapRTCAudio = uuid.MustParse("09460104-4C7F-11D1-8222-444553540000")
  153. // CapHostStatusTextAware indicates the client supports new status message features
  154. CapHostStatusTextAware = uuid.MustParse("0946010A-4C7F-11D1-8222-444553540000")
  155. // CapRTIM indicates the client supports "see as I type" IMs
  156. CapRTIM = uuid.MustParse("0946010B-4C7F-11D1-8222-444553540000")
  157. // CapSmartCaps indicates the client only asserts caps for services it is participating in
  158. CapSmartCaps = uuid.MustParse("094601FF-4C7F-11D1-8222-444553540000")
  159. // CapVoiceChat indicates the client supports voice chat (AIM)
  160. CapVoiceChat = uuid.MustParse("09461341-4C7F-11D1-8222-444553540000")
  161. // CapDirectPlay indicates the client supports direct play service (AIM)
  162. CapDirectPlay = uuid.MustParse("09461342-4C7F-11D1-8222-444553540000")
  163. // CapRouteFinder indicates the client supports route finder (ICQ)
  164. CapRouteFinder = uuid.MustParse("09461344-4C7F-11D1-8222-444553540000")
  165. // CapDirectICBM indicates the client supports P2P IMs
  166. CapDirectICBM = uuid.MustParse("09461345-4C7F-11D1-8222-444553540000")
  167. // CapAvatarService indicates the client supports avatar service (AIM)
  168. CapAvatarService = uuid.MustParse("09461346-4C7F-11D1-8222-444553540000")
  169. // CapStocksAddins indicates the client supports stocks/add-ins (AIM)
  170. CapStocksAddins = uuid.MustParse("09461347-4C7F-11D1-8222-444553540000")
  171. // CapFileSharing indicates the client supports file sharing
  172. CapFileSharing = uuid.MustParse("09461348-4C7F-11D1-8222-444553540000")
  173. // CapICQCh2Extended indicates the client supports channel 2 extended TLV(0x2711) messages (ICQ)
  174. CapICQCh2Extended = uuid.MustParse("09461349-4C7F-11D1-8222-444553540000")
  175. // CapGames indicates the client supports games (AIM)
  176. CapGames = uuid.MustParse("0946134A-4C7F-11D1-8222-444553540000")
  177. // CapBuddyListTransfer indicates the client supports buddy lists transfer (AIM)
  178. CapBuddyListTransfer = uuid.MustParse("0946134B-4C7F-11D1-8222-444553540000")
  179. // CapSupportICQ indicates the client supports talking to ICQ users
  180. CapSupportICQ = uuid.MustParse("0946134D-4C7F-11D1-8222-444553540000")
  181. // CapUTF8Messages indicates the client supports UTF-8 messages (AIM)
  182. CapUTF8Messages = uuid.MustParse("0946134E-4C7F-11D1-8222-444553540000")
  183. //
  184. // Full UUIDs (non-short format)
  185. //
  186. // CapRTFMessages indicates the client supports RTF messages (ICQ)
  187. CapRTFMessages = uuid.MustParse("97B12751-243C-4334-AD22-D6ABF73F1492")
  188. // CapTrillianSecureIM indicates the client supports Trillian SecureIM messages
  189. CapTrillianSecureIM = uuid.MustParse("F2E7C7F4-FEAD-4DFB-B235-36798BDF0000")
  190. // CapXtrazScript is the UUID for the ICQ Xtraz/Tzer.
  191. // Xtraz enables extended status (XStatus), greeting cards, and chat invitations.
  192. CapXtrazScript = uuid.MustParse("3B60B3EF-D82A-6C45-A4E0-9C5A5E67E865")
  193. //
  194. // Unknown/Legacy UUIDs
  195. //
  196. // CapUnknownICQ2001_2002 is an unknown capability seen in ICQ 2001/2002
  197. CapUnknownICQ2001_2002 = uuid.MustParse("A0E93F37-4C7F-11D1-8222-444553540000")
  198. // CapUnknownICQ2002 is an unknown capability seen in ICQ 2002
  199. CapUnknownICQ2002 = uuid.MustParse("10CF40D1-4C7F-11D1-8222-444553540000")
  200. // CapUnknownICQ2001 is an unknown capability seen in ICQ 2001
  201. CapUnknownICQ2001 = uuid.MustParse("2E7A6475-FADF-4DC8-886F-EA3595FDB6DF")
  202. // CapUnknownICQLite is an unknown capability seen in ICQLite/ICQ2Go
  203. CapUnknownICQLite = uuid.MustParse("563FC809-0B6F-41BD-9F79-422609DFA2F3")
  204. // CapGamesAlt is an alternate games capability with different endianness (AIM)
  205. CapGamesAlt = uuid.MustParse("0946134A-4C7F-11D1-2282-444553540000")
  206. )
  207. // ShortCapHexToUUID converts an OSCAR short capability code (1–4 hex digits, e.g. "1348", "1FF")
  208. // to the full UUID form 0946XXYY-4C7F-11D1-8222-444553540000. Returns the UUID and true if the
  209. // input is valid hex that fits in a uint16; otherwise returns zero UUID and false.
  210. func ShortCapHexToUUID(hexStr string) (uuid.UUID, bool) {
  211. hexStr = strings.TrimSpace(hexStr)
  212. if hexStr == "" || len(hexStr) > 4 {
  213. return uuid.Nil, false
  214. }
  215. val, err := strconv.ParseUint(hexStr, 16, 16)
  216. if err != nil {
  217. return uuid.Nil, false
  218. }
  219. // Format: 0946XXYY-4C7F-11D1-8222-444553540000 (XXYY = 16-bit short cap in big-endian hex)
  220. uuidStr := fmt.Sprintf("0946%04X-4C7F-11D1-8222-444553540000", val)
  221. uid, err := uuid.Parse(uuidStr)
  222. if err != nil {
  223. return uuid.Nil, false
  224. }
  225. return uid, true
  226. }
  227. //
  228. // 0x01: OService
  229. //
  230. const (
  231. OServiceErr uint16 = 0x0001
  232. OServiceClientOnline uint16 = 0x0002
  233. OServiceHostOnline uint16 = 0x0003
  234. OServiceServiceRequest uint16 = 0x0004
  235. OServiceServiceResponse uint16 = 0x0005
  236. OServiceRateParamsQuery uint16 = 0x0006
  237. OServiceRateParamsReply uint16 = 0x0007
  238. OServiceRateParamsSubAdd uint16 = 0x0008
  239. OServiceRateDelParamSub uint16 = 0x0009
  240. OServiceRateParamChange uint16 = 0x000A
  241. OServicePauseReq uint16 = 0x000B
  242. OServicePauseAck uint16 = 0x000C
  243. OServiceResume uint16 = 0x000D
  244. OServiceUserInfoQuery uint16 = 0x000E
  245. OServiceUserInfoUpdate uint16 = 0x000F
  246. OServiceEvilNotification uint16 = 0x0010
  247. OServiceIdleNotification uint16 = 0x0011
  248. OServiceMigrateGroups uint16 = 0x0012
  249. OServiceMotd uint16 = 0x0013
  250. OServiceSetPrivacyFlags uint16 = 0x0014
  251. OServiceWellKnownUrls uint16 = 0x0015
  252. OServiceNoop uint16 = 0x0016
  253. OServiceClientVersions uint16 = 0x0017
  254. OServiceHostVersions uint16 = 0x0018
  255. OServiceMaxConfigQuery uint16 = 0x0019
  256. OServiceMaxConfigReply uint16 = 0x001A
  257. OServiceStoreConfig uint16 = 0x001B
  258. OServiceConfigQuery uint16 = 0x001C
  259. OServiceConfigReply uint16 = 0x001D
  260. OServiceSetUserInfoFields uint16 = 0x001E
  261. OServiceProbeReq uint16 = 0x001F
  262. OServiceProbeAck uint16 = 0x0020
  263. OServiceBartReply uint16 = 0x0021
  264. OServiceBartQuery2 uint16 = 0x0022
  265. OServiceBartReply2 uint16 = 0x0023
  266. OServiceUserInfoUserFlags uint16 = 0x01
  267. OServiceUserInfoSignonTOD uint16 = 0x03
  268. OServiceUserInfoIdleTime uint16 = 0x04
  269. OServiceUserInfoMemberSince uint16 = 0x05
  270. OServiceUserInfoStatus uint16 = 0x06
  271. OServiceUserInfoICQDC uint16 = 0x0C
  272. OServiceUserInfoOscarCaps uint16 = 0x0D
  273. OServiceUserInfoOnlineTime uint16 = 0x0F
  274. OServiceUserInfoBARTInfo uint16 = 0x1D
  275. OServiceUserInfoMySubscriptions uint16 = 0x1E
  276. OServiceUserInfoUserFlags2 uint16 = 0x1F
  277. OServiceUserInfoMyInstanceNum uint16 = 0x14
  278. OServiceUserInfoSigTime uint16 = 0x26
  279. OServiceUserInfoPrimaryInstance uint16 = 0x28
  280. OServiceUserStatusAvailable uint32 = 0x00000000 // user is available
  281. OServiceUserStatusAway uint32 = 0x00000001 // user is away
  282. OServiceUserStatusDND uint32 = 0x00000002 // don't disturb user
  283. OServiceUserStatusOut uint32 = 0x00000004 // user is not available
  284. OServiceUserStatusBusy uint32 = 0x00000010 // user is busy
  285. OServiceUserStatusChat uint32 = 0x00000020 // user is available to chat
  286. OServiceUserStatusInvisible uint32 = 0x00000100 // user is invisible
  287. OServiceUserStatusWebAware uint32 = 0x00010000
  288. OServiceUserStatusHideIP uint32 = 0x00020000
  289. OServiceUserStatusBirthday uint32 = 0x00080000 // user is having a birthday :DDD
  290. OServiceUserStatusICQHomePage uint32 = 0x00200000
  291. OServiceUserStatusDirectRequireAuth uint32 = 0x10000000
  292. OServiceUserFlagUnconfirmed uint16 = 0x0001 // Unconfirmed account
  293. OServiceUserFlagAdministrator uint16 = 0x0002 // Server Administrator
  294. OServiceUserFlagAOL uint16 = 0x0004 // AOL (staff?) account
  295. OServiceUserFlagOSCARPay uint16 = 0x0008 // Commercial account
  296. OServiceUserFlagOSCARFree uint16 = 0x0010 // AIM (not AOL) account
  297. OServiceUserFlagUnavailable uint16 = 0x0020 // user is away
  298. OServiceUserFlagICQ uint16 = 0x0040 // ICQ user (OServiceUserFlagOSCARFree should also be set)
  299. OServiceUserFlagWireless uint16 = 0x0080 // On mobile device
  300. OServiceUserFlagInternal uint16 = 0x0100 // Internal account
  301. OServiceUserFlagFish uint16 = 0x0200 // IM forwarding enabled
  302. OServiceUserFlagBot uint16 = 0x0400 // Bot account
  303. OServiceUserFlagBeast uint16 = 0x0800 // Unknown
  304. OServiceUserFlagOneWayWireless uint16 = 0x1000 // On one way mobile device
  305. OServiceUserFlagOfficial uint16 = 0x2000 // Unknown
  306. OServiceUserFlag2BuddyMatchDirect uint32 = 0x00010000 // Unknown
  307. OServiceUserFlag2BuddyMatchIndirect uint32 = 0x00020000 // Unknown
  308. OServiceUserFlag2NoKnockKnock uint32 = 0x00040000 // Sender is safe
  309. OServiceUserFlag2ForwardMobile uint32 = 0x00080000 // Forward to mobile if no acive session
  310. OServicePrivacyFlagIdle uint32 = 0x00000001
  311. OServicePrivacyFlagMember uint32 = 0x00000002
  312. OServiceTLVTagsLinkedAccounts uint16 = 0x02
  313. OServiceTLVTagsReconnectHere uint16 = 0x05
  314. OServiceTLVTagsLoginCookie uint16 = 0x06
  315. OServiceTLVTagsGroupID uint16 = 0x0D
  316. OServiceTLVTagsSSLCertName uint16 = 0x8D
  317. OServiceTLVTagsSSLState uint16 = 0x8E
  318. OserviceTLVTagsSSLUseSSL uint16 = 0x8C
  319. OServiceTLVTagsMOTDMessage uint16 = 0x0B
  320. OServiceDiscErrNewLogin uint8 = 0x01
  321. OServiceDiscErrAccDeleted uint8 = 0x02
  322. OServiceServiceResponseSSLStateNotUsed uint8 = 0x00 // SSL is not supported or not requested for this connection
  323. OServiceServiceResponseSSLStateUse uint8 = 0x01 // SSL is being used
  324. OServiceServiceResponseSSLStateResume uint8 = 0x02 // SSL is being used and SSL resume is supported if desired
  325. )
  326. type SNAC_0x01_0x02_OServiceClientOnline struct {
  327. GroupVersions []struct {
  328. FoodGroup uint16
  329. Version uint16
  330. ToolID uint16
  331. ToolVersion uint16
  332. }
  333. }
  334. type SNAC_0x01_0x03_OServiceHostOnline struct {
  335. FoodGroups []uint16
  336. }
  337. type SNAC_0x01_0x04_OServiceServiceRequest struct {
  338. FoodGroup uint16
  339. TLVRestBlock
  340. }
  341. type SNAC_0x01_0x04_TLVRoomInfo struct {
  342. Exchange uint16
  343. Cookie string `oscar:"len_prefix=uint8"`
  344. InstanceNumber uint16
  345. }
  346. type SNAC_0x01_0x05_OServiceServiceResponse struct {
  347. TLVRestBlock
  348. }
  349. type RateParamsSNAC struct {
  350. ID uint16
  351. WindowSize uint32
  352. ClearLevel uint32
  353. AlertLevel uint32
  354. LimitLevel uint32
  355. DisconnectLevel uint32
  356. CurrentLevel uint32
  357. MaxLevel uint32
  358. V2Params *struct {
  359. LastTime uint32
  360. DroppingSNACs uint8
  361. } `oscar:"optional"`
  362. }
  363. // SNAC_0x01_0x07_OServiceRateParamsReply contains rate limits for rate classes and groups.
  364. //
  365. // Rate Classes:
  366. // - ID: Unique identifier for the rate class.
  367. // - WindowSize: The number of previously sent commands included in calculating
  368. // the current "rate average."
  369. // - ClearLevel: The threshold the average must reach to clear a rate limit.
  370. // - AlertLevel: The threshold for triggering an alert that tells the client
  371. // that it's getting close to the limit.
  372. // - LimitLevel: SNACs will be dropped if the rate falls below this value.
  373. // - DisconnectLevel: Server will disconnect if the rate falls below this value.
  374. // - CurrentLevel: The current value for the class; higher values are preferable.
  375. // Represents the current "rate average," resembling a moving average of the
  376. // times between each of the last WindowSize commands.
  377. // - MaxLevel: The maximum rate value; if the current value surpasses this,
  378. // it should be reset. The upper limit for a rate average.
  379. // - LastTime: Time elapsed since the last message was received by the server.
  380. // - CurrentStatus: Indicates whether the server is dropping SNACs for this rate class.
  381. //
  382. // Rate Groups:
  383. // - ID: Unique identifier for the rate group.
  384. // - Pairs: List of SNAC types associated with the rate group, including FoodGroup
  385. // (e.g., wire.ICBM) and SubGroup (e.g., wire.ICBMChannelMsgToHost).
  386. type SNAC_0x01_0x07_OServiceRateParamsReply struct {
  387. RateClasses []RateParamsSNAC `oscar:"count_prefix=uint16"`
  388. RateGroups []struct {
  389. ID uint16
  390. Pairs []struct {
  391. FoodGroup uint16
  392. SubGroup uint16
  393. } `oscar:"count_prefix=uint16"`
  394. }
  395. }
  396. type SNAC_0x01_0x0A_OServiceRateParamsChange struct {
  397. Code uint16
  398. Rate RateParamsSNAC
  399. }
  400. type SNAC_0x01_0x08_OServiceRateParamsSubAdd struct {
  401. ClassIDs []uint16
  402. }
  403. type SNAC_0x01_0x0F_OServiceUserInfoUpdate struct {
  404. UserInfo []TLVUserInfo
  405. }
  406. type SNAC_0x01_0x10_OServiceEvilNotification struct {
  407. NewEvil uint16
  408. // Snitcher specifies the user who sent the warning. Nil pointer indicates
  409. // an anonymous warning.
  410. Snitcher *struct {
  411. TLVUserInfo
  412. } `oscar:"optional"`
  413. }
  414. type SNAC_0x01_0x11_OServiceIdleNotification struct {
  415. IdleTime uint32
  416. }
  417. type SNAC_0x01_0x13_OServiceMOTD struct {
  418. MessageType uint16
  419. TLVRestBlock
  420. }
  421. type SNAC_0x01_0x14_OServiceSetPrivacyFlags struct {
  422. PrivacyFlags uint32
  423. }
  424. // IdleFlag returns whether other AIM users can see how long the user has been
  425. // idle.
  426. func (s SNAC_0x01_0x14_OServiceSetPrivacyFlags) IdleFlag() bool {
  427. return s.PrivacyFlags&OServicePrivacyFlagIdle == OServicePrivacyFlagIdle
  428. }
  429. // MemberFlag returns whether other AIM users can see how long the user has been
  430. // a member.
  431. func (s SNAC_0x01_0x14_OServiceSetPrivacyFlags) MemberFlag() bool {
  432. return s.PrivacyFlags&OServicePrivacyFlagMember == OServicePrivacyFlagMember
  433. }
  434. type SNAC_0x01_0x17_OServiceClientVersions struct {
  435. Versions []uint16
  436. }
  437. type SNAC_0x01_0x18_OServiceHostVersions struct {
  438. Versions []uint16
  439. }
  440. type SNAC_0x01_0x1E_OServiceSetUserInfoFields struct {
  441. TLVRestBlock
  442. }
  443. type SNAC_0x01_0x21_OServiceBARTReply struct {
  444. BARTID
  445. }
  446. type SNAC_0x01_0x23_OServiceBART2Reply struct {
  447. ReplyID []BartQueryReplyID
  448. }
  449. //
  450. // 0x02: Locate
  451. //
  452. const (
  453. LocateErr uint16 = 0x0001
  454. LocateRightsQuery uint16 = 0x0002
  455. LocateRightsReply uint16 = 0x0003
  456. LocateSetInfo uint16 = 0x0004
  457. LocateUserInfoQuery uint16 = 0x0005
  458. LocateUserInfoReply uint16 = 0x0006
  459. LocateWatcherSubRequest uint16 = 0x0007
  460. LocateWatcherNotification uint16 = 0x0008
  461. LocateSetDirInfo uint16 = 0x0009
  462. LocateSetDirReply uint16 = 0x000A
  463. LocateGetDirInfo uint16 = 0x000B
  464. LocateGetDirReply uint16 = 0x000C
  465. LocateGroupCapabilityQuery uint16 = 0x000D
  466. LocateGroupCapabilityReply uint16 = 0x000E
  467. LocateSetKeywordInfo uint16 = 0x000F
  468. LocateSetKeywordReply uint16 = 0x0010
  469. LocateGetKeywordInfo uint16 = 0x0011
  470. LocateGetKeywordReply uint16 = 0x0012
  471. LocateFindListByEmail uint16 = 0x0013
  472. LocateFindListReply uint16 = 0x0014
  473. LocateUserInfoQuery2 uint16 = 0x0015
  474. LocateTypeSig uint32 = 0x00000001
  475. LocateTypeUnavailable uint32 = 0x00000002
  476. LocateTypeCapabilities uint32 = 0x00000004
  477. LocateTypeCerts uint32 = 0x00000008
  478. LocateTypeHtmlInfo uint32 = 0x00000400
  479. LocateTLVTagsInfoSigMime uint16 = 0x01
  480. LocateTLVTagsInfoSigData uint16 = 0x02
  481. LocateTLVTagsInfoUnavailableMime uint16 = 0x03
  482. LocateTLVTagsInfoUnavailableData uint16 = 0x04
  483. LocateTLVTagsInfoCapabilities uint16 = 0x05
  484. LocateTLVTagsInfoCerts uint16 = 0x06
  485. LocateTLVTagsInfoSigTime uint16 = 0x0A
  486. LocateTLVTagsInfoUnavailableTime uint16 = 0x0B
  487. LocateTLVTagsInfoSupportHostSig uint16 = 0x0C
  488. LocateTLVTagsInfoHtmlInfoData uint16 = 0x0E
  489. LocateTLVTagsInfoHtmlInfoType uint16 = 0x0D
  490. // LocateTLVTagsRightsMaxSigLen is the max signature length
  491. LocateTLVTagsRightsMaxSigLen uint16 = 0x01
  492. // LocateTLVTagsRightsMaxCapabilitiesLen is the max allowed # of full UUID capabilities
  493. LocateTLVTagsRightsMaxCapabilitiesLen uint16 = 0x02
  494. // LocateTLVTagsRightsMaxFindByEmailList is the maximum # of email addresses to look up at once
  495. LocateTLVTagsRightsMaxFindByEmailList uint16 = 0x03
  496. // LocateTLVTagsRightsMaxCertsLen is the largest CERT length for e2e crypto
  497. LocateTLVTagsRightsMaxCertsLen uint16 = 0x04
  498. // LocateTLVTagsRightsMaxMaxShortCapabilities is the max allowed # of short UUID capabilities allowed
  499. LocateTLVTagsRightsMaxMaxShortCapabilities uint16 = 0x05
  500. LocateGetDirReplyOK uint16 = 0x01 // Directory info lookup succeeded
  501. LocateGetDirReplyUnavailable uint16 = 0x02 // Directory info lookup unavailable
  502. )
  503. type SNAC_0x02_0x03_LocateRightsReply struct {
  504. TLVRestBlock
  505. }
  506. type SNAC_0x02_0x04_LocateSetInfo struct {
  507. TLVRestBlock `oscar:"quirk=jimm_locate_set_info"`
  508. }
  509. type SNAC_0x02_0x06_LocateUserInfoReply struct {
  510. TLVUserInfo
  511. LocateInfo TLVRestBlock
  512. }
  513. type SNAC_0x02_0x09_LocateSetDirInfo struct {
  514. TLVRestBlock
  515. }
  516. type SNAC_0x02_0x0A_LocateSetDirReply struct {
  517. Result uint16
  518. }
  519. type SNAC_0x02_0x0B_LocateGetDirInfo struct {
  520. ScreenName string `oscar:"len_prefix=uint8"`
  521. }
  522. type SNAC_0x02_0x0C_LocateGetDirReply struct {
  523. Status uint16
  524. TLVBlock
  525. }
  526. type SNAC_0x02_0x0F_LocateSetKeywordInfo struct {
  527. TLVRestBlock
  528. }
  529. type SNAC_0x02_0x10_LocateSetKeywordReply struct {
  530. // Unknown is a field whose purpose is not known
  531. Unknown uint16
  532. }
  533. type SNAC_0x02_0x05_LocateUserInfoQuery struct {
  534. Type uint16
  535. ScreenName string `oscar:"len_prefix=uint8"`
  536. }
  537. func (s SNAC_0x02_0x05_LocateUserInfoQuery) RequestProfile() bool {
  538. return s.Type&uint16(LocateTypeSig) == uint16(LocateTypeSig)
  539. }
  540. func (s SNAC_0x02_0x05_LocateUserInfoQuery) RequestAwayMessage() bool {
  541. return s.Type&uint16(LocateTypeUnavailable) == uint16(LocateTypeUnavailable)
  542. }
  543. type SNAC_0x02_0x15_LocateUserInfoQuery2 struct {
  544. Type2 uint32
  545. ScreenName string `oscar:"len_prefix=uint8"`
  546. }
  547. //
  548. // 0x03: Buddy
  549. //
  550. const (
  551. BuddyErr uint16 = 0x0001
  552. BuddyRightsQuery uint16 = 0x0002
  553. BuddyRightsReply uint16 = 0x0003
  554. BuddyAddBuddies uint16 = 0x0004
  555. BuddyDelBuddies uint16 = 0x0005
  556. BuddyWatcherListQuery uint16 = 0x0006
  557. BuddyWatcherListResponse uint16 = 0x0007
  558. BuddyWatcherSubRequest uint16 = 0x0008
  559. BuddyWatcherNotification uint16 = 0x0009
  560. BuddyRejectNotification uint16 = 0x000A
  561. BuddyArrived uint16 = 0x000B
  562. BuddyDeparted uint16 = 0x000C
  563. BuddyAddTempBuddies uint16 = 0x000F
  564. BuddyDelTempBuddies uint16 = 0x0010
  565. BuddyTLVTagsParmMaxBuddies uint16 = 0x01
  566. BuddyTLVTagsParmMaxWatchers uint16 = 0x02
  567. BuddyTLVTagsParmMaxIcqBroad uint16 = 0x03
  568. BuddyTLVTagsParmMaxTempBuddies uint16 = 0x04
  569. )
  570. type SNAC_0x03_0x02_BuddyRightsQuery struct {
  571. TLVRestBlock
  572. }
  573. type SNAC_0x03_0x03_BuddyRightsReply struct {
  574. TLVRestBlock
  575. }
  576. type SNAC_0x03_0x04_BuddyAddBuddies struct {
  577. Buddies []struct {
  578. ScreenName string `oscar:"len_prefix=uint8"`
  579. }
  580. }
  581. // SNAC_0x03_0x0A_BuddyRejectNotification is SRV_NOTIFICATION_REJECTED (iserverd):
  582. // one or more length-prefixed buddy id strings for contacts not added.
  583. type SNAC_0x03_0x0A_BuddyRejectNotification struct {
  584. Buddies []struct {
  585. ScreenName string `oscar:"len_prefix=uint8"`
  586. }
  587. }
  588. type SNAC_0x03_0x05_BuddyDelBuddies struct {
  589. Buddies []struct {
  590. ScreenName string `oscar:"len_prefix=uint8"`
  591. }
  592. }
  593. type SNAC_0x03_0x0B_BuddyArrived struct {
  594. TLVUserInfo
  595. }
  596. type SNAC_0x03_0x0C_BuddyDeparted struct {
  597. TLVUserInfo
  598. }
  599. type SNAC_0x03_0x0F_BuddyAddTempBuddies struct {
  600. Buddies []struct {
  601. ScreenName string `oscar:"len_prefix=uint8"`
  602. }
  603. }
  604. type SNAC_0x03_0x10_BuddyDelTempBuddies struct {
  605. Buddies []struct {
  606. ScreenName string `oscar:"len_prefix=uint8"`
  607. }
  608. }
  609. //
  610. // 0x04: ICBM
  611. //
  612. const (
  613. ICBMErr uint16 = 0x0001
  614. ICBMAddParameters uint16 = 0x0002
  615. ICBMDelParameters uint16 = 0x0003
  616. ICBMParameterQuery uint16 = 0x0004
  617. ICBMParameterReply uint16 = 0x0005
  618. ICBMChannelMsgToHost uint16 = 0x0006
  619. ICBMChannelMsgToClient uint16 = 0x0007
  620. ICBMEvilRequest uint16 = 0x0008
  621. ICBMEvilReply uint16 = 0x0009
  622. ICBMMissedCalls uint16 = 0x000A
  623. ICBMClientErr uint16 = 0x000B
  624. ICBMHostAck uint16 = 0x000C
  625. ICBMSinStored uint16 = 0x000D
  626. ICBMSinListQuery uint16 = 0x000E
  627. ICBMSinListReply uint16 = 0x000F
  628. ICBMOfflineRetrieve uint16 = 0x0010
  629. ICBMSinDelete uint16 = 0x0011
  630. ICBMNotifyRequest uint16 = 0x0012
  631. ICBMNotifyReply uint16 = 0x0013
  632. ICBMClientEvent uint16 = 0x0014
  633. ICBMOfflineRetrieveReply uint16 = 0x0017
  634. ICBMTLVAOLIMData uint16 = 0x02
  635. ICBMTLVRequestHostAck uint16 = 0x03
  636. ICBMTLVAutoResponse uint16 = 0x04
  637. ICBMTLVData uint16 = 0x05
  638. ICBMTLVStore uint16 = 0x06
  639. ICBMTLVICQBlob uint16 = 0x07
  640. ICBMTLVAvatarInfo uint16 = 0x08
  641. ICBMTLVWantAvatar uint16 = 0x09
  642. ICBMTLVMultiUser uint16 = 0x0A
  643. ICBMTLVWantEvents uint16 = 0x0B
  644. ICBMTLVSubscriptions uint16 = 0x0C
  645. ICBMTLVBART uint16 = 0x0D
  646. ICBMTLVHostImID uint16 = 0x10
  647. ICBMTLVHostImArgs uint16 = 0x11
  648. ICBMTLVSendTime uint16 = 0x16
  649. ICBMTLVFriendlyName uint16 = 0x17
  650. ICBMTLVAnonymous uint16 = 0x18
  651. ICBMTLVWidgetName uint16 = 0x19
  652. ICBMMessageEncodingASCII uint16 = 0x00 // ANSI ASCII -- ISO 646
  653. ICBMMessageEncodingUnicode uint16 = 0x02 // ISO 10646.USC-2 Unicode
  654. ICBMMessageEncodingLatin1 uint16 = 0x03 // ISO 8859-1
  655. ICBMExtendedMsgTypePlain uint8 = 0x01 // Plain text (simple) message
  656. ICBMExtendedMsgTypeChat uint8 = 0x02 // Chat request message
  657. ICBMExtendedMsgTypeFileReq uint8 = 0x03 // File request / file ok message
  658. ICBMExtendedMsgTypeURL uint8 = 0x04 // URL message (0xFE formatted)
  659. ICBMExtendedMsgTypeAuthReq uint8 = 0x06 // Authorization request message (0xFE formatted)
  660. ICBMExtendedMsgTypeAuthDeny uint8 = 0x07 // Authorization denied message (0xFE formatted)
  661. ICBMExtendedMsgTypeAuthOK uint8 = 0x08 // Authorization given message (empty)
  662. ICBMExtendedMsgTypeServer uint8 = 0x09 // Message from OSCAR server (0xFE formatted)
  663. ICBMExtendedMsgTypeAdded uint8 = 0x0C // "You-were-added" message (0xFE formatted)
  664. ICBMExtendedMsgTypeWWP uint8 = 0x0D // Web pager message (0xFE formatted)
  665. ICBMExtendedMsgTypeExpress uint8 = 0x0E // Email express message (0xFE formatted)
  666. ICBMExtendedMsgTypeContacts uint8 = 0x13 // Contact list message
  667. ICBMExtendedMsgTypePlugin uint8 = 0x1A // Plugin message described by text string
  668. ICBMExtendedMsgTypeAutoAway uint8 = 0xE8 // Auto away message
  669. ICBMExtendedMsgTypeAutoBusy uint8 = 0xE9 // Auto occupied message
  670. ICBMExtendedMsgTypeAutoNA uint8 = 0xEA // Auto not available message
  671. ICBMExtendedMsgTypeAutoDND uint8 = 0xEB // Auto do not disturb message
  672. ICBMExtendedMsgTypeAutoFFC uint8 = 0xEC // Auto free for chat message
  673. ICBMChannelIM uint16 = 0x01
  674. ICBMChannelRendezvous uint16 = 0x02
  675. ICBMChannelMIME uint16 = 0x03
  676. ICBMChannelICQ uint16 = 0x04
  677. ICBMChannelCoBrowser uint16 = 0x05
  678. ICBMMsgTypePlain uint8 = 0x01 // Plain text (simple) message
  679. ICBMMsgTypeChat uint8 = 0x02 // Chat request message
  680. ICBMMsgTypeFileReq uint8 = 0x03 // File request / file ok message
  681. ICBMMsgTypeUrl uint8 = 0x04 // URL message (0xFE formatted)
  682. ICBMMsgTypeAuthReq uint8 = 0x06 // Authorization request message (0xFE formatted)
  683. ICBMMsgTypeAuthDeny uint8 = 0x07 // Authorization denied message (0xFE formatted)
  684. ICBMMsgTypeAuthOK uint8 = 0x08 // Authorization given message (empty)
  685. ICBMMsgTypeServer uint8 = 0x09 // Message from OSCAR server (0xFE formatted)
  686. ICBMMsgTypeAdded uint8 = 0x0C // "You-were-added" message (0xFE formatted)
  687. ICBMMsgTypeWWP uint8 = 0x0D // Web pager message (0xFE formatted)
  688. ICBMMsgTypeEExpress uint8 = 0x0E // Email express message (0xFE formatted)
  689. ICBMMsgTypeContacts uint8 = 0x13 // Contact list message
  690. ICBMMsgTypePlugin uint8 = 0x1A // Plugin message described by text string
  691. ICBMMsgTypeAutoAway uint8 = 0xE8 // Auto away message
  692. ICBMMsgTypeAutoBusy uint8 = 0xE9 // Auto occupied message
  693. ICBMMsgTypeAutoNA uint8 = 0xEA // Auto not available message
  694. ICBMMsgTypeAutoDND uint8 = 0xEB // Auto do not disturb message
  695. ICBMMsgTypeAutoFFC uint8 = 0xEC // Auto free for chat message
  696. ICBMRdvMessagePropose uint16 = 0x00 // Propose a rendezvous
  697. ICBMRdvMessageCancel uint16 = 0x01 // Cancel a proposal you generated
  698. ICBMRdvMessageAccept uint16 = 0x02 // Accept a proposal someone else generated
  699. ICBMRdvMessageNak uint16 = 0x03 // NOT CURRENTLY DOCUMENTED
  700. ICBMRdvCancelReasonsUnknown uint16 = 0x00 // Reason not specified
  701. ICBMRdvCancelReasonsUserCancel uint16 = 0x01 // Recipient user declined
  702. ICBMRdvCancelReasonsTimeout uint16 = 0x02 // Timeout
  703. ICBMRdvCancelReasonsAcceptedElsewhere uint16 = 0x03 // Proposal was accepted by a different instance of the user
  704. ICBMRdvTLVTagsRdvChan uint16 = 0x0001 // uint16 (word) ICBM channel on which the rendezvous is to occur
  705. ICBMRdvTLVTagsRdvIP uint16 = 0x0002 // uint32 (dword) IP address proposed for the rendezvous
  706. ICBMRdvTLVTagsRequesterIP uint16 = 0x0003 // uint32 (dword) IP address of the proposing client
  707. ICBMRdvTLVTagsVerifiedIP uint16 = 0x0004 // uint32 (dword) IP address of the proposing client as seen by server; NOTE - this TLV may only be added by the server
  708. ICBMRdvTLVTagsPort uint16 = 0x0005 // uint16 (word) Port value of the client for rendezvous
  709. ICBMRdvTLVTagsDownloadURL uint16 = 0x0006 // string URL for downloading software to support the service
  710. ICBMRdvTLVTagsDownloadURL2 uint16 = 0x0007 // string NOT CURRENTLY DOCUMENTED
  711. ICBMRdvTLVTagsVerifiedDownloadURL uint16 = 0x0008 // string Same as DOWNLOAD_URL, but added by server if the service is well known; Note - this TLV may only be added by the server
  712. ICBMRdvTLVTagsSeqNum uint16 = 0x000A // uint16 (word) Identifies which proposal this is in the rendezvous conversation; the initial proposal has sequence_num 1; NOTE - this tag is required in *all* rendezvous *proposal* payloads and may only occur in proposal payloads; each proposal applying to a given rendezvous cookie increments the sequence_num by one
  713. ICBMRdvTLVTagsCancelReason uint16 = 0x000B // uint16 (word) [Class: ICBM__RENDEZVOUS_CANCEL_REASONS] Reason for cancelling a rendezvous; this tag must be present in all RENDEZVOUS_CANCEL payloads.
  714. ICBMRdvTLVTagsInvitation uint16 = 0x000C // string Text inviting the other player to join
  715. ICBMRdvTLVTagsInviteMIMECharset uint16 = 0x000D // string Charset used by the data
  716. ICBMRdvTLVTagsInviteMIMELang uint16 = 0x000E // string Language used by the data
  717. ICBMRdvTLVTagsRequestHostChk uint16 = 0x000F // empty Requests that the server check caps for recipient
  718. ICBMRdvTLVTagsUseARS uint16 = 0x0010 // empty Requests that the Rendezvous Server be used as a transport for the data
  719. ICBMRdvTLVTagsRequestSecure uint16 = 0x0011 // empty Requests that SSL be used for the connection
  720. ICBMRdvTLVTagsMaxProtoVersion uint16 = 0x0012 // uint16 (word) Maximum application protocol version supported
  721. ICBMRdvTLVTagsMinProtoVersion uint16 = 0x0013 // uint16 (word) Minimum application protocol version supported
  722. ICBMRdvTLVTagsCounterReason uint16 = 0x0014 // uint16 (word) Reason for a counter proposal
  723. ICBMRdvTLVTagsInviteMIMEType uint16 = 0x0015 // string Content-type used by the data
  724. ICBMRdvTLVTagsIPXOR uint16 = 0x0016 // uint32 (dword) Contains IP_ADDR ^ 0xFFFFFFFF - Used with recent clients to ensure that the IP_ADDR tlv is not tampered with or modified by a NAT since some NATs will change the IP_ADDR tlv when the proposal is sent
  725. ICBMRdvTLVTagsPortXOR uint16 = 0x0017 // uint16 (word) PORT ^ 0xFFFF - Used with recent clients to ensure that the PORT tlv is not tampered with or modified by a NAT since some NATs will change the PORT tlv when the proposal is sent
  726. ICBMRdvTLVTagsAddrList uint16 = 0x0018 // Array of string08 List of "IP port" pairs to try
  727. ICBMRdvTLVTagsSessID uint16 = 0x0019 // string Identifier for session
  728. ICBMRdvTLVTagsRolloverID uint16 = 0x001A // string Identifier of session to rollover
  729. ICBMRdvTLVTagsSvcData uint16 = 0x2711 // blob Service specific data
  730. ICBMSubErrRemoteIMOff uint16 = 0x0001 // Used with NOT_LOGGED_ON
  731. ICBMSubErrRemoteRestrictedByPC uint16 = 0x0002 // Used with NOT_LOGGED_ON; the remote side denied because of parental controls
  732. ICBMSubErrNeedSMSLegalToSend uint16 = 0x0003 // User tried to send a message to an SMS user and is required to accept the legal text first
  733. ICBMSubErrSMSWithoutDisclaimer uint16 = 0x0004 // Client tried to send a message to an SMS user without the character counter being displayed
  734. ICBMSubErrSMSCountryNotAllowed uint16 = 0x0005 // Client tried to send a message to an SMS user but the SMS matrix said the country code combination not permitted
  735. ICBMSubErrSMSUnknownCountry uint16 = 0x0008 // Client tried to send to an SMS user but the server could not determine the country
  736. ICBMSubErrCannotInitiateIM uint16 = 0x0009 // An IM cannot be initiated by a BOT
  737. ICBMSubErrIMNotAllowed uint16 = 0x000A // An IM is not allowed by a consumer BOT to a user
  738. ICBMSubErrCannotIMUsageLimited uint16 = 0x000B // An IM is not allowed by a consumer BOT due to reaching a generic usage limit
  739. ICBMSubErrCannotIMDailyLimited uint16 = 0x000C // An IM is not allowed by a consumer BOT due to reaching the daily usage limit
  740. ICBMSubErrCannotIMMonthlyLimited uint16 = 0x000D // An IM is not allowed by a consumer BOT due to reaching the monthly usage limit
  741. ICBMSubErrOfflineIMNotAccepted uint16 = 0x000E // User does not accept offline IMs
  742. ICBMSubErrOfflineIMExceedMax uint16 = 0x000F // Exceeded max storage limit
  743. )
  744. // ICBMCh1Fragment represents an ICBM channel 1 (instant message) message
  745. // component.
  746. type ICBMCh1Fragment struct {
  747. ID uint8
  748. Version uint8
  749. Payload []byte `oscar:"len_prefix=uint16"`
  750. }
  751. type ICBMCh2Fragment struct {
  752. Type uint16
  753. Cookie [8]byte
  754. Capability [16]byte
  755. TLVRestBlock
  756. }
  757. type ICBMRoomInfo struct {
  758. Exchange uint16
  759. Cookie string `oscar:"len_prefix=uint8"`
  760. Instance uint16
  761. }
  762. // ICBMCh1Message represents the text component of an ICBM channel 1 (instant
  763. // message) message.
  764. type ICBMCh1Message struct {
  765. Charset uint16
  766. Language uint16
  767. Text []byte
  768. }
  769. // ICBMCh4Message represents an ICBM channel 4 (ICQ) message component.
  770. type ICBMCh4Message struct {
  771. UIN uint32
  772. MessageType uint8
  773. Flags uint8
  774. Message string `oscar:"len_prefix=uint16,nullterm"`
  775. }
  776. type SNAC_0x04_0x02_ICBMAddParameters struct {
  777. Channel uint16
  778. ICBMFlags uint32
  779. MaxIncomingICBMLen uint16
  780. MaxSourceEvil uint16
  781. MaxDestinationEvil uint16
  782. MinInterICBMInterval uint32
  783. }
  784. type SNAC_0x04_0x05_ICBMParameterReply struct {
  785. MaxSlots uint16
  786. ICBMFlags uint32
  787. MaxIncomingICBMLen uint16
  788. MaxSourceEvil uint16
  789. MaxDestinationEvil uint16
  790. MinInterICBMInterval uint32
  791. }
  792. type SNAC_0x04_0x06_ICBMChannelMsgToHost struct {
  793. Cookie uint64
  794. ChannelID uint16
  795. ScreenName string `oscar:"len_prefix=uint8"`
  796. TLVRestBlock
  797. }
  798. type SNAC_0x04_0x07_ICBMChannelMsgToClient struct {
  799. Cookie uint64
  800. ChannelID uint16
  801. TLVUserInfo
  802. TLVRestBlock
  803. }
  804. // ICBMFragmentList creates an ICBM fragment list for an instant message
  805. // payload.
  806. func ICBMFragmentList(text string) ([]ICBMCh1Fragment, error) {
  807. msg := ICBMCh1Message{
  808. Charset: ICBMMessageEncodingASCII,
  809. Language: 0, // not clear what this means, but it works
  810. Text: []byte(text),
  811. }
  812. msgBuf := bytes.Buffer{}
  813. if err := MarshalBE(msg, &msgBuf); err != nil {
  814. return nil, fmt.Errorf("unable to marshal ICBM message: %w", err)
  815. }
  816. return []ICBMCh1Fragment{
  817. {
  818. ID: 5, // 5 = capabilities
  819. Version: 1,
  820. Payload: []byte{1, 1, 2}, // 1 = text
  821. },
  822. {
  823. ID: 1, // 1 = message text
  824. Version: 1,
  825. Payload: msgBuf.Bytes(),
  826. },
  827. }, nil
  828. }
  829. // UnmarshalICBMMessageText extracts message text from an ICBM fragment list.
  830. // Param b is a slice from TLV wire.ICBMTLVAOLIMData.
  831. //
  832. // The message charset is respected: UCS-2 BE (0x0002) is decoded to UTF-8,
  833. // while ASCII (0x0000) and Latin-1 (0x0003) are returned as-is since they are
  834. // valid subsets of UTF-8 for the 7-bit range and Go handles Latin-1 bytes
  835. // transparently.
  836. func UnmarshalICBMMessageText(b []byte) (string, error) {
  837. var frags []ICBMCh1Fragment
  838. if err := UnmarshalBE(&frags, bytes.NewBuffer(b)); err != nil {
  839. return "", fmt.Errorf("unable to unmarshal ICBM fragment: %w", err)
  840. }
  841. for _, frag := range frags {
  842. if frag.ID == 1 { // 1 = message text
  843. msg := ICBMCh1Message{}
  844. err := UnmarshalBE(&msg, bytes.NewBuffer(frag.Payload))
  845. if err != nil {
  846. return "", fmt.Errorf("unable to unmarshal ICBM message: %w", err)
  847. }
  848. if msg.Charset == ICBMMessageEncodingUnicode {
  849. return decodeUCS2BE(msg.Text), nil
  850. }
  851. return string(msg.Text), nil
  852. }
  853. }
  854. return "", errors.New("unable to find message fragment")
  855. }
  856. // decodeUCS2BE converts UCS-2 big-endian encoded bytes to a Go UTF-8 string.
  857. func decodeUCS2BE(data []byte) string {
  858. if len(data) < 2 {
  859. return ""
  860. }
  861. runes := make([]rune, 0, len(data)/2)
  862. for i := 0; i+1 < len(data); i += 2 {
  863. r := rune(binary.BigEndian.Uint16(data[i : i+2]))
  864. if r == 0 {
  865. continue
  866. }
  867. runes = append(runes, r)
  868. }
  869. return string(runes)
  870. }
  871. // MarshalICBMFragmentList serializes an ICBM fragment list for an ICBM channel 1
  872. // message. This is the inverse of UnmarshalICBMMessageText's internal unmarshaling.
  873. func MarshalICBMFragmentList(frags []ICBMCh1Fragment) ([]byte, error) {
  874. buf := bytes.Buffer{}
  875. if err := MarshalBE(frags, &buf); err != nil {
  876. return nil, fmt.Errorf("unable to marshal ICBM fragments: %w", err)
  877. }
  878. return buf.Bytes(), nil
  879. }
  880. type SNAC_0x04_0x08_ICBMEvilRequest struct {
  881. SendAs uint16
  882. ScreenName string `oscar:"len_prefix=uint8"`
  883. }
  884. type SNAC_0x04_0x09_ICBMEvilReply struct {
  885. EvilDeltaApplied uint16
  886. UpdatedEvilValue uint16
  887. }
  888. type SNAC_0x04_0x0B_ICBMClientErr struct {
  889. Cookie uint64
  890. ChannelID uint16
  891. ScreenName string `oscar:"len_prefix=uint8"`
  892. Code uint16
  893. ErrInfo []byte
  894. }
  895. type SNAC_0x04_0x0C_ICBMHostAck struct {
  896. Cookie uint64
  897. ChannelID uint16
  898. ScreenName string `oscar:"len_prefix=uint8"`
  899. }
  900. type SNAC_0x04_0x14_ICBMClientEvent struct {
  901. Cookie uint64
  902. ChannelID uint16
  903. ScreenName string `oscar:"len_prefix=uint8"`
  904. Event uint16
  905. }
  906. type SNAC_0x04_0x0A_ICBMOfflineRetrieve struct{}
  907. type SNAC_0x04_0x17_ICBMOfflineRetrieveReply struct{}
  908. //
  909. // 0x05: Advert
  910. //
  911. const (
  912. AdvertErr uint16 = 0x0001
  913. AdvertAdsQuery uint16 = 0x0002
  914. AdvertAdsReply uint16 = 0x0003
  915. )
  916. //
  917. // 0x06: Invite
  918. //
  919. const (
  920. InviteErr uint16 = 0x0001
  921. InviteRequestQuery uint16 = 0x0002
  922. InviteRequestReply uint16 = 0x0003
  923. )
  924. //
  925. // 0x07: Admin
  926. //
  927. const (
  928. AdminErr uint16 = 0x0001
  929. AdminInfoQuery uint16 = 0x0002
  930. AdminInfoReply uint16 = 0x0003
  931. AdminInfoChangeRequest uint16 = 0x0004
  932. AdminInfoChangeReply uint16 = 0x0005
  933. AdminAcctConfirmRequest uint16 = 0x0006
  934. AdminAcctConfirmReply uint16 = 0x0007
  935. AdminAcctDeleteRequest uint16 = 0x0008
  936. AdminAcctDeleteReply uint16 = 0x0009
  937. AdminInfoErrorValidateNickName uint16 = 0x0001
  938. AdminInfoErrorValidatePassword uint16 = 0x0002
  939. AdminInfoErrorValidateEmail uint16 = 0x0003
  940. AdminInfoErrorServiceTempUnavailable uint16 = 0x0004
  941. AdminInfoErrorFieldChangeTempUnavailable uint16 = 0x0005
  942. AdminInfoErrorInvalidNickName uint16 = 0x0006
  943. AdminInfoErrorInvalidPassword uint16 = 0x0007
  944. AdminInfoErrorInvalidEmail uint16 = 0x0008
  945. AdminInfoErrorInvalidRegistrationPreference uint16 = 0x0009
  946. AdminInfoErrorInvalidOldPassword uint16 = 0x000A
  947. AdminInfoErrorInvalidNickNameLength uint16 = 0x000B
  948. AdminInfoErrorInvalidPasswordLength uint16 = 0x000C
  949. AdminInfoErrorInvalidEmailLength uint16 = 0x000D
  950. AdminInfoErrorInvalidOldPasswordLength uint16 = 0x000E
  951. AdminInfoErrorNeedOldPassword uint16 = 0x000F
  952. AdminInfoErrorReadOnlyField uint16 = 0x0010
  953. AdminInfoErrorWriteOnlyField uint16 = 0x0011
  954. AdminInfoErrorUnsupportedType uint16 = 0x0012
  955. AdminInfoErrorAllOtherErrors uint16 = 0x0013
  956. AdminInfoErrorBadSnac uint16 = 0x0014
  957. AdminInfoErrorInvalidAccount uint16 = 0x0015
  958. AdminInfoErrorDeletedAccount uint16 = 0x0016
  959. AdminInfoErrorExpiredAccount uint16 = 0x0017
  960. AdminInfoErrorNoDatabaseAccess uint16 = 0x0018
  961. AdminInfoErrorInvalidDatabaseFields uint16 = 0x0019
  962. AdminInfoErrorBadDatabaseStatus uint16 = 0x001A
  963. AdminInfoErrorMigrationCancel uint16 = 0x001B
  964. AdminInfoErrorInternalError uint16 = 0x001C
  965. AdminInfoErrorPendingRequest uint16 = 0x001D
  966. AdminInfoErrorNotDTStatus uint16 = 0x001E
  967. AdminInfoErrorOutstandingConfirm uint16 = 0x001F
  968. AdminInfoErrorNoEmailAddress uint16 = 0x0020
  969. AdminInfoErrorOverLimit uint16 = 0x0021
  970. AdminInfoErrorEmailHostFail uint16 = 0x0022
  971. AdminInfoErrorDNSFail uint16 = 0x0023
  972. AdminInfoRegStatusNoDisclosure uint16 = 0x01
  973. AdminInfoRegStatusLimitDisclosure uint16 = 0x02
  974. AdminInfoRegStatusFullDisclosure uint16 = 0x03
  975. AdminInfoPermissionsReadOnly1 uint16 = 0x01
  976. AdminInfoPermissionsReadOnly2 uint16 = 0x02
  977. AdminInfoPermissionsReadWrite uint16 = 0x03
  978. AdminAcctConfirmStatusEmailSent uint16 = 0x00
  979. AdminAcctConfirmStatusAlreadyConfirmed uint16 = 0x1E
  980. AdminAcctConfirmStatusServerError uint16 = 0x23
  981. AdminTLVScreenNameFormatted uint16 = 0x01
  982. AdminTLVNewPassword uint16 = 0x02
  983. AdminTLVUrl uint16 = 0x04
  984. AdminTLVErrorCode uint16 = 0x08
  985. AdminTLVEmailAddress uint16 = 0x11
  986. AdminTLVOldPassword uint16 = 0x12
  987. AdminTLVRegistrationStatus uint16 = 0x13
  988. )
  989. // Used when client wants to get its account information
  990. // - AdminTLVScreenNameFormatted
  991. // - AdminTLVEmailAddress
  992. // - AdminTLVRegistrationStatus
  993. type SNAC_0x07_0x02_AdminInfoQuery struct {
  994. TLVRestBlock
  995. }
  996. type SNAC_0x07_0x03_AdminInfoReply struct {
  997. Permissions uint16
  998. TLVBlock
  999. }
  1000. // AdminTLVScreenNameFormatted - change screenname formatting
  1001. // AdminTLVEmailAddress - change account email
  1002. // AdminTLVRegistrationStatus - change registration status
  1003. // AdminTLVNewPassword, AdminTLVOldPassword - change password
  1004. type SNAC_0x07_0x04_AdminInfoChangeRequest struct {
  1005. TLVRestBlock
  1006. }
  1007. type SNAC_0x07_0x05_AdminChangeReply struct {
  1008. Permissions uint16
  1009. TLVBlock
  1010. }
  1011. type SNAC_0x07_0x06_AdminConfirmRequest struct{}
  1012. type SNAC_0x07_0x07_AdminConfirmReply struct {
  1013. Status uint16
  1014. TLV
  1015. }
  1016. //
  1017. // 0x08: Popup
  1018. //
  1019. const (
  1020. PopupErr uint16 = 0x0001
  1021. PopupDisplay uint16 = 0x0002
  1022. )
  1023. //
  1024. // 0x09: PermitDeny
  1025. //
  1026. const (
  1027. PermitDenyErr uint16 = 0x0001
  1028. PermitDenyRightsQuery uint16 = 0x0002
  1029. PermitDenyRightsReply uint16 = 0x0003
  1030. PermitDenySetGroupPermitMask uint16 = 0x0004
  1031. PermitDenyAddPermListEntries uint16 = 0x0005
  1032. PermitDenyDelPermListEntries uint16 = 0x0006
  1033. PermitDenyAddDenyListEntries uint16 = 0x0007
  1034. PermitDenyDelDenyListEntries uint16 = 0x0008
  1035. PermitDenyBosErr uint16 = 0x0009
  1036. PermitDenyAddTempPermitListEntries uint16 = 0x000A
  1037. PermitDenyDelTempPermitListEntries uint16 = 0x000B
  1038. PermitDenyTLVMaxPermits uint16 = 0x01
  1039. PermitDenyTLVMaxDenies uint16 = 0x02
  1040. PermitDenyTLVMaxTempPermits uint16 = 0x03
  1041. )
  1042. type SNAC_0x09_0x03_PermitDenyRightsReply struct {
  1043. TLVRestBlock
  1044. }
  1045. type SNAC_0x09_0x05_PermitDenyAddPermListEntries struct {
  1046. Users []struct {
  1047. ScreenName string `oscar:"len_prefix=uint8"`
  1048. }
  1049. }
  1050. type SNAC_0x09_0x06_PermitDenyDelPermListEntries struct {
  1051. Users []struct {
  1052. ScreenName string `oscar:"len_prefix=uint8"`
  1053. }
  1054. }
  1055. type SNAC_0x09_0x07_PermitDenyAddDenyListEntries struct {
  1056. Users []struct {
  1057. ScreenName string `oscar:"len_prefix=uint8"`
  1058. }
  1059. }
  1060. type SNAC_0x09_0x08_PermitDenyDelDenyListEntries struct {
  1061. Users []struct {
  1062. ScreenName string `oscar:"len_prefix=uint8"`
  1063. }
  1064. }
  1065. type SNAC_0x09_0x04_PermitDenySetGroupPermitMask struct {
  1066. PermMask uint32
  1067. }
  1068. func (s SNAC_0x09_0x04_PermitDenySetGroupPermitMask) IsFlagSet(flag uint16) bool {
  1069. return flag&uint16(s.PermMask) == flag
  1070. }
  1071. //
  1072. // 0x0A: UserLookup
  1073. //
  1074. const (
  1075. UserLookupErr uint16 = 0x0001
  1076. UserLookupFindByEmail uint16 = 0x0002
  1077. UserLookupFindReply uint16 = 0x0003
  1078. UserLookupErrNoUserFound uint16 = 0x0014
  1079. UserLookupTLVEmailAddress uint16 = 0x0001
  1080. )
  1081. type SNAC_0x0A_0x02_UserLookupFindByEmail struct {
  1082. Email []byte
  1083. }
  1084. type SNAC_0x0A_0x03_UserLookupFindReply struct {
  1085. TLVRestBlock
  1086. }
  1087. //
  1088. // 0x0B: Stats
  1089. //
  1090. const (
  1091. StatsErr uint16 = 0x0001
  1092. StatsSetMinReportInterval uint16 = 0x0002
  1093. StatsReportEvents uint16 = 0x0003
  1094. StatsReportAck uint16 = 0x0004
  1095. )
  1096. type SNAC_0x0B_0x02_StatsSetMinReportInterval struct {
  1097. MinReportInterval uint16
  1098. }
  1099. type SNAC_0x0B_0x03_StatsReportEvents struct {
  1100. TLVRestBlock
  1101. }
  1102. type SNAC_0x0B_0x04_StatsReportAck struct {
  1103. }
  1104. //
  1105. // 0x0C: Translate
  1106. //
  1107. const (
  1108. TranslateErr uint16 = 0x0001
  1109. TranslateRequest uint16 = 0x0002
  1110. TranslateReply uint16 = 0x0003
  1111. )
  1112. //
  1113. // 0x0D: ChatNav
  1114. //
  1115. const (
  1116. ChatNavErr uint16 = 0x0001
  1117. ChatNavRequestChatRights uint16 = 0x0002
  1118. ChatNavRequestExchangeInfo uint16 = 0x0003
  1119. ChatNavRequestRoomInfo uint16 = 0x0004
  1120. ChatNavRequestMoreRoomInfo uint16 = 0x0005
  1121. ChatNavRequestOccupantList uint16 = 0x0006
  1122. ChatNavSearchForRoom uint16 = 0x0007
  1123. ChatNavCreateRoom uint16 = 0x0008
  1124. ChatNavNavInfo uint16 = 0x0009
  1125. ChatNavTLVMaxConcurrentRooms uint16 = 0x0002
  1126. ChatNavTLVExchangeInfo uint16 = 0x0003
  1127. ChatNavTLVRoomInfo uint16 = 0x0004
  1128. )
  1129. type SNAC_0x0D_0x03_ChatNavRequestExchangeInfo struct {
  1130. Exchange uint16
  1131. }
  1132. type SNAC_0x0D_0x04_ChatNavRequestRoomInfo struct {
  1133. Exchange uint16
  1134. Cookie string `oscar:"len_prefix=uint8"`
  1135. InstanceNumber uint16
  1136. DetailLevel uint8
  1137. }
  1138. type SNAC_0x0D_0x09_ChatNavNavInfo struct {
  1139. TLVRestBlock
  1140. }
  1141. type SNAC_0x0D_0x09_TLVExchangeInfo struct {
  1142. Identifier uint16
  1143. TLVBlock
  1144. }
  1145. //
  1146. // 0x0E: Chat
  1147. //
  1148. const (
  1149. ChatErr uint16 = 0x0001
  1150. ChatRoomInfoUpdate uint16 = 0x0002
  1151. ChatUsersJoined uint16 = 0x0003
  1152. ChatUsersLeft uint16 = 0x0004
  1153. ChatChannelMsgToHost uint16 = 0x0005
  1154. ChatChannelMsgToClient uint16 = 0x0006
  1155. ChatEvilRequest uint16 = 0x0007
  1156. ChatEvilReply uint16 = 0x0008
  1157. ChatClientErr uint16 = 0x0009
  1158. ChatPauseRoomReq uint16 = 0x000A
  1159. ChatPauseRoomAck uint16 = 0x000B
  1160. ChatResumeRoom uint16 = 0x000C
  1161. ChatShowMyRow uint16 = 0x000D
  1162. ChatShowRowByUsername uint16 = 0x000E
  1163. ChatShowRowByNumber uint16 = 0x000F
  1164. ChatShowRowByName uint16 = 0x0010
  1165. ChatRowInfo uint16 = 0x0011
  1166. ChatListRows uint16 = 0x0012
  1167. ChatRowListInfo uint16 = 0x0013
  1168. ChatMoreRows uint16 = 0x0014
  1169. ChatMoveToRow uint16 = 0x0015
  1170. ChatToggleChat uint16 = 0x0016
  1171. ChatSendQuestion uint16 = 0x0017
  1172. ChatSendComment uint16 = 0x0018
  1173. ChatTallyVote uint16 = 0x0019
  1174. ChatAcceptBid uint16 = 0x001A
  1175. ChatSendInvite uint16 = 0x001B
  1176. ChatDeclineInvite uint16 = 0x001C
  1177. ChatAcceptInvite uint16 = 0x001D
  1178. ChatNotifyMessage uint16 = 0x001E
  1179. ChatGotoRow uint16 = 0x001F
  1180. ChatStageUserJoin uint16 = 0x0020
  1181. ChatStageUserLeft uint16 = 0x0021
  1182. ChatUnnamedSnac22 uint16 = 0x0022
  1183. ChatClose uint16 = 0x0023
  1184. ChatUserBan uint16 = 0x0024
  1185. ChatUserUnban uint16 = 0x0025
  1186. ChatJoined uint16 = 0x0026
  1187. ChatUnnamedSnac27 uint16 = 0x0027
  1188. ChatUnnamedSnac28 uint16 = 0x0028
  1189. ChatUnnamedSnac29 uint16 = 0x0029
  1190. ChatRoomInfoOwner uint16 = 0x0030
  1191. ChatTLVPublicWhisperFlag uint16 = 0x01
  1192. ChatTLVWhisperToUser uint16 = 0x02
  1193. ChatTLVSenderInformation uint16 = 0x03
  1194. ChatTLVMessageInfo uint16 = 0x05
  1195. ChatTLVEnableReflectionFlag uint16 = 0x06
  1196. ChatTLVMessageInfoEncoding uint16 = 0x02
  1197. ChatTLVMessageInfoLang uint16 = 0x03
  1198. ChatTLVMessageInfoText uint16 = 0x01
  1199. // referenced from protocols/oscar/family_chatnav.c in lib purple
  1200. ChatRoomTLVClassPerms uint16 = 0x02
  1201. ChatRoomTLVMaxConcurrentRooms uint16 = 0x03 // required by aim 2.x-3.x
  1202. ChatRoomTLVMaxNameLen uint16 = 0x04
  1203. ChatRoomTLVFullyQualifiedName uint16 = 0x6A
  1204. ChatRoomTLVCreateTime uint16 = 0xCA
  1205. ChatRoomTLVFlags uint16 = 0xC9
  1206. ChatRoomTLVMaxMsgLen uint16 = 0xD1
  1207. ChatRoomTLVMaxOccupancy uint16 = 0xD2
  1208. ChatRoomTLVRoomName uint16 = 0xD3
  1209. ChatRoomTLVNavCreatePerms uint16 = 0xD5
  1210. ChatRoomTLVCharSet1 uint16 = 0xD6
  1211. ChatRoomTLVLang1 uint16 = 0xD7
  1212. ChatRoomTLVCharSet2 uint16 = 0xD8
  1213. ChatRoomTLVLang2 uint16 = 0xD9
  1214. ChatRoomTLVMaxMsgVisLen uint16 = 0xDA
  1215. )
  1216. type SNAC_0x0E_0x02_ChatRoomInfoUpdate struct {
  1217. Exchange uint16
  1218. Cookie string `oscar:"len_prefix=uint8"`
  1219. InstanceNumber uint16
  1220. DetailLevel uint8
  1221. TLVBlock
  1222. }
  1223. type SNAC_0x0E_0x03_ChatUsersJoined struct {
  1224. Users []TLVUserInfo
  1225. }
  1226. type SNAC_0x0E_0x04_ChatUsersLeft struct {
  1227. Users []TLVUserInfo
  1228. }
  1229. type SNAC_0x0E_0x05_ChatChannelMsgToHost struct {
  1230. Cookie uint64
  1231. Channel uint16
  1232. TLVRestBlock
  1233. }
  1234. type SNAC_0x0E_0x06_ChatChannelMsgToClient struct {
  1235. Cookie uint64
  1236. Channel uint16
  1237. TLVRestBlock
  1238. }
  1239. // UnmarshalChatMessageText extracts message text from a chat message. Param b
  1240. // is a slice from TLV wire.ChatTLVMessageInfo.
  1241. func UnmarshalChatMessageText(b []byte) (string, error) {
  1242. block := TLVRestBlock{}
  1243. if err := UnmarshalBE(&block, bytes.NewReader(b)); err != nil {
  1244. return "", fmt.Errorf("UnmarshalBE: %w", err)
  1245. }
  1246. b, hasMsg := block.Bytes(ChatTLVMessageInfoText)
  1247. if !hasMsg {
  1248. return "", errors.New("SNAC(0x0E,0x05) has no chat msg text TLV")
  1249. }
  1250. return string(b), nil
  1251. }
  1252. //
  1253. // 0x0F: ODir
  1254. //
  1255. const (
  1256. ODirErr uint16 = 0x0001
  1257. ODirInfoQuery uint16 = 0x0002
  1258. ODirInfoReply uint16 = 0x0003
  1259. ODirKeywordListQuery uint16 = 0x0004
  1260. ODirKeywordListReply uint16 = 0x0005
  1261. ODirTLVFirstName uint16 = 0x0001 // The first name of the individual being searched.
  1262. ODirTLVLastName uint16 = 0x0002 // The last name of the individual being searched.
  1263. ODirTLVMiddleName uint16 = 0x0003 // The middle name of the individual being searched.
  1264. ODirTLVMaidenName uint16 = 0x0004 // The maiden name of the individual being searched.
  1265. ODirTLVEmailAddress uint16 = 0x0005 // The email address you're searching for.
  1266. ODirTLVCountry uint16 = 0x0006 // The country where the individual resides.
  1267. ODirTLVState uint16 = 0x0007 // The state where the individual resides.
  1268. ODirTLVCity uint16 = 0x0008 // The city where the individual resides.
  1269. ODirTLVScreenName uint16 = 0x0009 // The screen name of the individual being searched.
  1270. ODirTLVSearchType uint16 = 0x000a // Likely denotes the search type: 0x0000 for "name and other criteria" search, 0x0001 for "email address" or "interest" search.
  1271. ODirTLVInterest uint16 = 0x000b // The interest or hobby of the individual being searched.
  1272. ODirTLVNickName uint16 = 0x000c // The nickname of the individual being searched.
  1273. ODirTLVZIP uint16 = 0x000d // The ZIP code where the individual resides.
  1274. ODirTLVRegion uint16 = 0x001c // Encodes region information, possibly as 8 bytes in "us-ascii."
  1275. ODirTLVAddress uint16 = 0x0021 // The street address where the individual resides.
  1276. ODirKeywordCategory uint8 = 0x01
  1277. ODirKeyword uint8 = 0x02
  1278. ODirSearchByNameAndAddress uint16 = 0x0000
  1279. ODirSearchByEmailOrInterest uint16 = 0x0001
  1280. ODirSearchResponseUnavailable1 uint16 = 0x01 // Search is unavailable
  1281. ODirSearchResponseUnavailable2 uint16 = 0x02 // Search is unavailable (same as above)
  1282. ODirSearchResponseTooManyResults uint16 = 0x03 // Too many results returned, narrow search
  1283. ODirSearchResponseNameMissing uint16 = 0x04 // Missing first or last name
  1284. ODirSearchResponseOK uint16 = 0x05 // Successful search
  1285. )
  1286. type SNAC_0x0F_0x02_InfoQuery struct {
  1287. TLVRestBlock
  1288. }
  1289. type SNAC_0x0F_0x03_InfoReply struct {
  1290. Status uint16
  1291. Unknown uint16
  1292. Results struct {
  1293. List []TLVBlock `oscar:"count_prefix=uint16"`
  1294. } `oscar:"count_prefix=uint16"`
  1295. }
  1296. type SNAC_0x0F_0x04_KeywordListQuery struct{}
  1297. type SNAC_0x0F_0x04_KeywordListReply struct {
  1298. Status uint16
  1299. Interests []ODirKeywordListItem `oscar:"count_prefix=uint16"`
  1300. }
  1301. type ODirKeywordListItem struct {
  1302. // Type is the item type (parent category = 1, keyword = 2).
  1303. Type uint8
  1304. // ID is the ID of the keyword or category. If item type is category, then
  1305. // it's the category ID. If item type is keyword, then it's the parent
  1306. // category ID. If it's a top-level keyword, value is 0.
  1307. ID uint8
  1308. // Name is the keyword or category name.
  1309. Name string `oscar:"len_prefix=uint16"`
  1310. }
  1311. //
  1312. // 0x10: BART
  1313. //
  1314. //
  1315. const (
  1316. BARTTypesBuddyIconSmall uint16 = 0x00
  1317. BARTTypesBuddyIcon uint16 = 0x01
  1318. BARTTypesStatusStr uint16 = 0x02
  1319. BARTTypesArriveSound uint16 = 0x03
  1320. BARTTypesRichName uint16 = 0x04
  1321. BARTTypesSuperIcon uint16 = 0x05
  1322. BARTTypesRadioStation uint16 = 0x06
  1323. BARTTypesSuperIconTrigger uint16 = 0x07
  1324. BARTTypesStatusTextLink uint16 = 0x09
  1325. BARTTypesLocation uint16 = 0x0B
  1326. BARTTypesBuddyIconBig uint16 = 0x0C
  1327. BARTTypesStatusTextTimestamp uint16 = 0x0D
  1328. BARTTypesCurrentAvtrack uint16 = 0x0F
  1329. BARTTypesDepartSound uint16 = 0x60
  1330. BARTTypesImBackground uint16 = 0x80
  1331. BARTTypesImChrome uint16 = 0x81
  1332. BARTTypesImSkin uint16 = 0x82
  1333. BARTTypesImSound uint16 = 0x83
  1334. BARTTypesBadge uint16 = 0x84
  1335. BARTTypesBadgeUrl uint16 = 0x85
  1336. BARTTypesImInitialSound uint16 = 0x86
  1337. BARTTypesFlashWallpaper uint16 = 0x88
  1338. BARTTypesImmersiveWallpaper uint16 = 0x89
  1339. BARTTypesBuddylistBackground uint16 = 0x100
  1340. BARTTypesBuddylistImage uint16 = 0x101
  1341. BARTTypesBuddylistSkin uint16 = 0x102
  1342. BARTTypesSmileySet uint16 = 0x400
  1343. BARTTypesEncrCertChain uint16 = 0x402
  1344. BARTTypesSignCertChain uint16 = 0x403
  1345. BARTTypesGatewayCert uint16 = 0x404
  1346. )
  1347. const (
  1348. BARTErr uint16 = 0x0001
  1349. BARTUploadQuery uint16 = 0x0002
  1350. BARTUploadReply uint16 = 0x0003
  1351. BARTDownloadQuery uint16 = 0x0004
  1352. BARTDownloadReply uint16 = 0x0005
  1353. BARTDownload2Query uint16 = 0x0006
  1354. BARTDownload2Reply uint16 = 0x0007
  1355. )
  1356. const (
  1357. BARTFlagsKnown uint8 = 0x00
  1358. BARTFlagsCustom uint8 = 0x01
  1359. BARTFlagsUrl uint8 = 0x02
  1360. BARTFlagsData uint8 = 0x04
  1361. BARTFlagsUnknown uint8 = 0x40
  1362. BARTFlagsRedirect uint8 = 0x80
  1363. BARTFlagsBanned uint8 = 0xC0
  1364. )
  1365. const (
  1366. BARTReplyCodesSuccess uint8 = 0x00
  1367. BARTReplyCodesInvalid uint8 = 0x01
  1368. BARTReplyCodesNoCustom uint8 = 0x02
  1369. BARTReplyCodesTooSmall uint8 = 0x03
  1370. BARTReplyCodesTooBig uint8 = 0x04
  1371. BARTReplyCodesInvalidType uint8 = 0x05
  1372. BARTReplyCodesBanned uint8 = 0x06
  1373. BARTReplyCodesNotfound uint8 = 0x07
  1374. )
  1375. // GetClearIconHash returns an opaque value set in BARTID hash that indicates
  1376. // the user wants to clear their buddy icon.
  1377. func GetClearIconHash() []byte {
  1378. return []byte{0x02, 0x01, 0xd2, 0x04, 0x72}
  1379. }
  1380. // BARTInfo represents a BART feedbag item
  1381. type BARTInfo struct {
  1382. Flags uint8
  1383. Hash []byte `oscar:"len_prefix=uint8"`
  1384. }
  1385. // HasClearIconHash reports whether the BART ID hash contains the
  1386. // ClearIconHash sentinel value.
  1387. func (h BARTInfo) HasClearIconHash() bool {
  1388. return bytes.Equal(h.Hash, GetClearIconHash())
  1389. }
  1390. type BARTID struct {
  1391. Type uint16
  1392. BARTInfo
  1393. }
  1394. type BartIDsWName struct {
  1395. ScreenName string `oscar:"len_prefix=uint8"`
  1396. IDs []BARTID `oscar:"len_prefix=uint8"`
  1397. }
  1398. type BartQueryReplyID struct {
  1399. QueryID BARTID
  1400. Code uint8
  1401. ReplyID BARTID
  1402. }
  1403. type SNAC_0x10_0x02_BARTUploadQuery struct {
  1404. Type uint16
  1405. Data []byte `oscar:"len_prefix=uint16"`
  1406. }
  1407. type SNAC_0x10_0x03_BARTUploadReply struct {
  1408. Code uint8
  1409. ID BARTID
  1410. }
  1411. type SNAC_0x10_0x04_BARTDownloadQuery struct {
  1412. ScreenName string `oscar:"len_prefix=uint8"`
  1413. Command uint8
  1414. BARTID
  1415. }
  1416. type SNAC_0x10_0x05_BARTDownloadReply struct {
  1417. ScreenName string `oscar:"len_prefix=uint8"`
  1418. BARTID BARTID
  1419. Data []byte `oscar:"len_prefix=uint16"`
  1420. }
  1421. type SNAC_0x10_0x06_BARTDownload2Query struct {
  1422. ScreenName string `oscar:"len_prefix=uint8"`
  1423. IDs []BARTID `oscar:"count_prefix=uint8"`
  1424. }
  1425. type SNAC_0x10_0x07_BARTDownload2Reply struct {
  1426. ScreenName string `oscar:"len_prefix=uint8"`
  1427. ReplyID BartQueryReplyID
  1428. Data []byte `oscar:"len_prefix=uint16"`
  1429. }
  1430. //
  1431. // 0x13: Feedbag
  1432. //
  1433. const (
  1434. FeedbagTLVVersion uint16 = 1 // indicates SSI/Feedbag version in SNAC TLVLBlock
  1435. FeedbagClassIdBuddy uint16 = 0x0000
  1436. FeedbagClassIdGroup uint16 = 0x0001
  1437. FeedbagClassIDPermit uint16 = 0x0002
  1438. FeedbagClassIDDeny uint16 = 0x0003
  1439. FeedbagClassIdPdinfo uint16 = 0x0004
  1440. FeedbagClassIdBuddyPrefs uint16 = 0x0005
  1441. FeedbagClassIdNonbuddy uint16 = 0x0006
  1442. FeedbagClassIdTpaProvider uint16 = 0x0007
  1443. FeedbagClassIdTpaSubscription uint16 = 0x0008
  1444. FeedbagClassIdClientPrefs uint16 = 0x0009
  1445. FeedbagClassIdStock uint16 = 0x000A
  1446. FeedbagClassIdWeather uint16 = 0x000B
  1447. FeedbagClassIdWatchList uint16 = 0x000D
  1448. FeedbagClassIdIgnoreList uint16 = 0x000E
  1449. FeedbagClassIdDateTime uint16 = 0x000F
  1450. FeedbagClassIdExternalUser uint16 = 0x0010
  1451. FeedbagClassIdRootCreator uint16 = 0x0011
  1452. FeedbagClassIdFish uint16 = 0x0012
  1453. FeedbagClassIdImportTimestamp uint16 = 0x0013
  1454. FeedbagClassIdBart uint16 = 0x0014
  1455. FeedbagClassIdRbOrder uint16 = 0x0015
  1456. FeedbagClassIdPersonality uint16 = 0x0016
  1457. FeedbagClassIdAlProf uint16 = 0x0017
  1458. FeedbagClassIdAlInfo uint16 = 0x0018
  1459. FeedbagClassIdInteraction uint16 = 0x0019
  1460. FeedbagClassIdVanityInfo uint16 = 0x001D
  1461. FeedbagClassIdFavoriteLocation uint16 = 0x001E
  1462. FeedbagClassIdBartPdinfo uint16 = 0x001F
  1463. FeedbagClassIdCustomEmoticons uint16 = 0x0024
  1464. FeedbagClassIdMaxPredefined uint16 = 0x0024
  1465. FeedbagClassIdXIcqStatusNote uint16 = 0x015C
  1466. FeedbagClassIdMin uint16 = 0x0400
  1467. FeedbagAttributesShared uint16 = 0x0064
  1468. FeedbagAttributesInvited uint16 = 0x0065
  1469. FeedbagAttributesPending uint16 = 0x0066
  1470. FeedbagAttributesTimeT uint16 = 0x0067
  1471. FeedbagAttributesDenied uint16 = 0x0068
  1472. FeedbagAttributesSwimIndex uint16 = 0x0069
  1473. FeedbagAttributesRecentBuddy uint16 = 0x006A
  1474. FeedbagAttributesAutoBot uint16 = 0x006B
  1475. FeedbagAttributesInteraction uint16 = 0x006D
  1476. FeedbagAttributesMegaBot uint16 = 0x006F
  1477. FeedbagAttributesOrder uint16 = 0x00C8
  1478. FeedbagAttributesBuddyPrefs uint16 = 0x00C9
  1479. FeedbagAttributesPdMode uint16 = 0x00CA
  1480. FeedbagAttributesPdMask uint16 = 0x00CB
  1481. FeedbagAttributesPdFlags uint16 = 0x00CC
  1482. FeedbagAttributesClientPrefs uint16 = 0x00CD
  1483. FeedbagAttributesLanguage uint16 = 0x00CE
  1484. FeedbagAttributesFishUri uint16 = 0x00CF
  1485. FeedbagAttributesWirelessPdMode uint16 = 0x00D0
  1486. FeedbagAttributesWirelessIgnoreMode uint16 = 0x00D1
  1487. FeedbagAttributesFishPdMode uint16 = 0x00D2
  1488. FeedbagAttributesFishIgnoreMode uint16 = 0x00D3
  1489. FeedbagAttributesCreateTime uint16 = 0x00D4
  1490. FeedbagAttributesBartInfo uint16 = 0x00D5
  1491. FeedbagAttributesAlPassword uint16 = 0x00D5 // roasted password in FeedbagClassIdAlInfo items
  1492. FeedbagAttributesBuddyPrefsValid uint16 = 0x00D6
  1493. FeedbagAttributesBuddyPrefs2 uint16 = 0x00D7
  1494. FeedbagAttributesBuddyPrefs2Valid uint16 = 0x00D8
  1495. FeedbagAttributesBartList uint16 = 0x00D9
  1496. FeedbagAttributesArriveSound uint16 = 0x012C
  1497. FeedbagAttributesLeaveSound uint16 = 0x012D
  1498. FeedbagAttributesImage uint16 = 0x012E
  1499. FeedbagAttributesColorBg uint16 = 0x012F
  1500. FeedbagAttributesColorFg uint16 = 0x0130
  1501. FeedbagAttributesAlias uint16 = 0x0131
  1502. FeedbagAttributesPassword uint16 = 0x0132
  1503. FeedbagAttributesDisabled uint16 = 0x0133
  1504. FeedbagAttributesCollapsed uint16 = 0x0134
  1505. FeedbagAttributesUrl uint16 = 0x0135
  1506. FeedbagAttributesActiveList uint16 = 0x0136
  1507. FeedbagAttributesEmailAddr uint16 = 0x0137
  1508. FeedbagAttributesPhoneNumber uint16 = 0x0138
  1509. FeedbagAttributesCellPhoneNumber uint16 = 0x0139
  1510. FeedbagAttributesSmsPhoneNumber uint16 = 0x013A
  1511. FeedbagAttributesWireless uint16 = 0x013B
  1512. FeedbagAttributesNote uint16 = 0x013C
  1513. FeedbagAttributesAlertPrefs uint16 = 0x013D
  1514. FeedbagAttributesBudalertSound uint16 = 0x013E
  1515. FeedbagAttributesStockalertValue uint16 = 0x013F
  1516. FeedbagAttributesTpalertEditUrl uint16 = 0x0140
  1517. FeedbagAttributesTpalertDeleteUrl uint16 = 0x0141
  1518. FeedbagAttributesTpprovMorealertsUrl uint16 = 0x0142
  1519. FeedbagAttributesFish uint16 = 0x0143
  1520. FeedbagAttributesXunconfirmedxLastAccess uint16 = 0x0145
  1521. FeedbagAttributesImSent uint16 = 0x0150
  1522. FeedbagAttributesOnlineTime uint16 = 0x0151
  1523. FeedbagAttributesAwayMsg uint16 = 0x0152
  1524. FeedbagAttributesImReceived uint16 = 0x0153
  1525. FeedbagAttributesBuddyfeedView uint16 = 0x0154
  1526. FeedbagAttributesWorkPhoneNumber uint16 = 0x0158
  1527. FeedbagAttributesOtherPhoneNumber uint16 = 0x0159
  1528. FeedbagAttributesWebPdMode uint16 = 0x015F
  1529. FeedbagAttributesFirstCreationTimeXc uint16 = 0x0167
  1530. FeedbagAttributesPdModeXc uint16 = 0x016E
  1531. FeedbagRightsMaxClassAttrs uint16 = 0x02
  1532. FeedbagRightsMaxItemAttrs uint16 = 0x03
  1533. FeedbagRightsMaxItemsByClass uint16 = 0x04
  1534. FeedbagRightsMaxClientItems uint16 = 0x05
  1535. FeedbagRightsMaxItemNameLen uint16 = 0x06
  1536. FeedbagRightsMaxRecentBuddies uint16 = 0x07
  1537. FeedbagRightsInteractionBuddies uint16 = 0x08
  1538. FeedbagRightsInteractionHalfLife uint16 = 0x09
  1539. FeedbagRightsInteractionMaxScore uint16 = 0x0A
  1540. FeedbagRightsMaxUnknown0b uint16 = 0x0B
  1541. FeedbagRightsMaxBuddiesPerGroup uint16 = 0x0C
  1542. FeedbagRightsMaxMegaBots uint16 = 0x0D
  1543. FeedbagRightsMaxSmartGroups uint16 = 0x0E
  1544. FeedbagErr uint16 = 0x0001
  1545. FeedbagRightsQuery uint16 = 0x0002
  1546. FeedbagRightsReply uint16 = 0x0003
  1547. FeedbagQuery uint16 = 0x0004
  1548. FeedbagQueryIfModified uint16 = 0x0005
  1549. FeedbagReply uint16 = 0x0006
  1550. FeedbagUse uint16 = 0x0007
  1551. FeedbagInsertItem uint16 = 0x0008
  1552. FeedbagUpdateItem uint16 = 0x0009
  1553. FeedbagDeleteItem uint16 = 0x000A
  1554. FeedbagInsertClass uint16 = 0x000B
  1555. FeedbagUpdateClass uint16 = 0x000C
  1556. FeedbagDeleteClass uint16 = 0x000D
  1557. FeedbagStatus uint16 = 0x000E
  1558. FeedbagReplyNotModified uint16 = 0x000F
  1559. FeedbagDeleteUser uint16 = 0x0010
  1560. FeedbagStartCluster uint16 = 0x0011
  1561. FeedbagEndCluster uint16 = 0x0012
  1562. FeedbagAuthorizeBuddy uint16 = 0x0013
  1563. FeedbagPreAuthorizeBuddy uint16 = 0x0014
  1564. FeedbagPreAuthorizedBuddy uint16 = 0x0015
  1565. FeedbagRemoveMe uint16 = 0x0016
  1566. FeedbagRemoveMe2 uint16 = 0x0017
  1567. FeedbagRequestAuthorizeToHost uint16 = 0x0018
  1568. FeedbagRequestAuthorizeToClient uint16 = 0x0019
  1569. FeedbagRespondAuthorizeToHost uint16 = 0x001A
  1570. FeedbagRespondAuthorizeToClient uint16 = 0x001B
  1571. FeedbagBuddyAdded uint16 = 0x001C
  1572. FeedbagRequestAuthorizeToBadog uint16 = 0x001D
  1573. FeedbagRespondAuthorizeToBadog uint16 = 0x001E
  1574. FeedbagBuddyAddedToBadog uint16 = 0x001F
  1575. FeedbagTestSnac uint16 = 0x0021
  1576. FeedbagForwardMsg uint16 = 0x0022
  1577. FeedbagIsAuthRequiredQuery uint16 = 0x0023
  1578. FeedbagIsAuthRequiredReply uint16 = 0x0024
  1579. FeedbagRecentBuddyUpdate uint16 = 0x0025
  1580. )
  1581. // FeedbagPDMode represents a buddy list permit/deny mode setting that
  1582. // determines who can interact with a user.
  1583. type FeedbagPDMode uint8
  1584. const (
  1585. // FeedbagPDModePermitAll allows all users to see and talk to user. This is
  1586. // the session default.
  1587. FeedbagPDModePermitAll FeedbagPDMode = 0x01
  1588. // FeedbagPDModeDenyAll blocks all users from communicating with user.
  1589. FeedbagPDModeDenyAll FeedbagPDMode = 0x02
  1590. // FeedbagPDModePermitSome only allows a specified list of users to see and
  1591. // talk to user and blocks all others from communicating.
  1592. FeedbagPDModePermitSome FeedbagPDMode = 0x03
  1593. // FeedbagPDModeDenySome blocks a list of users from seeing and talking to
  1594. // user and allows all others to communicate.
  1595. FeedbagPDModeDenySome FeedbagPDMode = 0x04
  1596. // FeedbagPDModePermitOnList only allows communication with users on buddy
  1597. // list and blocks all others from communicating.
  1598. FeedbagPDModePermitOnList FeedbagPDMode = 0x05
  1599. )
  1600. type SNAC_0x13_0x02_FeedbagRightsQuery struct {
  1601. TLVRestBlock
  1602. }
  1603. type SNAC_0x13_0x03_FeedbagRightsReply struct {
  1604. TLVRestBlock
  1605. }
  1606. type SNAC_0x13_0x05_FeedbagQueryIfModified struct {
  1607. LastUpdate uint32
  1608. Count uint8
  1609. }
  1610. type SNAC_0x13_0x06_FeedbagReply struct {
  1611. Version uint8
  1612. Items []FeedbagItem `oscar:"count_prefix=uint16"`
  1613. LastUpdate uint32
  1614. }
  1615. type SNAC_0x13_0x08_FeedbagInsertItem struct {
  1616. Items []FeedbagItem
  1617. }
  1618. type SNAC_0x13_0x09_FeedbagUpdateItem struct {
  1619. Items []FeedbagItem
  1620. }
  1621. type SNAC_0x13_0x0A_FeedbagDeleteItem struct {
  1622. Items []FeedbagItem
  1623. }
  1624. type SNAC_0x13_0x0E_FeedbagStatus struct {
  1625. Results []uint16
  1626. }
  1627. type SNAC_0x13_0x11_FeedbagStartCluster struct {
  1628. TLVRestBlock
  1629. }
  1630. type SNAC_0x13_0x12_FeedbagEndCluster struct {
  1631. }
  1632. type SNAC_0x13_0x18_FeedbagRequestAuthorizationToHost struct {
  1633. ScreenName string `oscar:"len_prefix=uint8"`
  1634. Reason string `oscar:"len_prefix=uint16"`
  1635. Unknown uint16
  1636. }
  1637. type FeedbagExtendedInfo struct {
  1638. // arpack << (unsigned short)0x0006 /* extinfo size */
  1639. // << (unsigned short)0x0001 /* TLV(1) */
  1640. // << (unsigned short)0x0002 /* tlv size */
  1641. // << (unsigned short)user->ssi_version;
  1642. }
  1643. type SNAC_0x13_0x19_FeedbagRequestAuthorizeToClient struct {
  1644. // TLVLBlock contains the feedbag extended info for compatibility with
  1645. // clients that require extended info
  1646. TLVLBlock
  1647. ScreenName string `oscar:"len_prefix=uint8"`
  1648. Reason string `oscar:"len_prefix=uint16"`
  1649. Unknown uint16
  1650. }
  1651. type SNAC_0x13_0x1A_FeedbagRespondAuthorizeToHost struct {
  1652. ScreenName string `oscar:"len_prefix=uint8"`
  1653. Accepted uint8
  1654. Reason string `oscar:"len_prefix=uint16"`
  1655. }
  1656. type SNAC_0x13_0x1B_FeedbagRespondAuthorizeToClient struct {
  1657. // TLVLBlock contains the feedbag extended info for compatibility with
  1658. // clients that require extended info
  1659. TLVLBlock
  1660. ScreenName string `oscar:"len_prefix=uint8"`
  1661. Accepted uint8
  1662. Reason string `oscar:"len_prefix=uint16"`
  1663. Nullterm uint16
  1664. }
  1665. type SNAC_0x13_0x1C_FeedbagBuddyAdded struct {
  1666. // TLVLBlock contains the feedbag extended info for compatibility with
  1667. // clients that require extended info
  1668. TLVLBlock
  1669. ScreenName string `oscar:"len_prefix=uint8"`
  1670. Nullterm uint16
  1671. }
  1672. // SNAC_0x13_0x14_FeedbagPreAuthorizeBuddy is the client request for
  1673. // FEEDBAG__PRE_AUTHORIZE_BUDDY.
  1674. type SNAC_0x13_0x14_FeedbagPreAuthorizeBuddy struct {
  1675. ScreenName string `oscar:"len_prefix=uint8"`
  1676. Message string `oscar:"len_prefix=uint16"`
  1677. Flags uint16
  1678. }
  1679. // SNAC_0x13_0x15_FeedbagPreAuthorizedBuddy is the server notification
  1680. // FEEDBAG__PRE_AUTHORIZED_BUDDY.
  1681. type SNAC_0x13_0x15_FeedbagPreAuthorizedBuddy struct {
  1682. ScreenName string `oscar:"len_prefix=uint8"`
  1683. Message string `oscar:"len_prefix=uint16"`
  1684. Flags uint16
  1685. }
  1686. //
  1687. // 0x15: ICQ
  1688. //
  1689. const (
  1690. ICQErr uint16 = 0x0001
  1691. ICQDBQuery uint16 = 0x0002
  1692. ICQDBReply uint16 = 0x0003
  1693. ICQTLVTagsMetadata uint16 = 0x0001
  1694. ICQTLVTagsUIN uint16 = 0x0136 // User UIN (search)
  1695. ICQTLVTagsFirstName uint16 = 0x0140 // User first name
  1696. ICQTLVTagsLastName uint16 = 0x014A // User last name
  1697. ICQTLVTagsNickname uint16 = 0x0154 // User nickname
  1698. ICQTLVTagsEmail uint16 = 0x015E // User email
  1699. ICQTLVTagsAgeRangeSearch uint16 = 0x0168 // Age range to search (search)
  1700. ICQTLVTagsAge uint16 = 0x0172 // User age
  1701. ICQTLVTagsGender uint16 = 0x017C // User gender
  1702. ICQTLVTagsSpokenLanguage uint16 = 0x0186 // User spoken language
  1703. ICQTLVTagsHomeCityName uint16 = 0x0190 // User home city name
  1704. ICQTLVTagsHomeStateAbbr uint16 = 0x019A // User home state abbreviation
  1705. ICQTLVTagsHomeCountryCode uint16 = 0x01A4 // User home country code
  1706. ICQTLVTagsWorkCompanyName uint16 = 0x01AE // User work company name
  1707. ICQTLVTagsWorkDepartmentName uint16 = 0x01B8 // User work department name
  1708. ICQTLVTagsWorkPositionTitle uint16 = 0x01C2 // User work position (title)
  1709. ICQTLVTagsWorkOccupationCode uint16 = 0x01CC // User work occupation code
  1710. ICQTLVTagsAffiliationsNode uint16 = 0x01FE // User affiliations node
  1711. ICQTLVTagsInterestsNode uint16 = 0x01EA // User interests node
  1712. ICQTLVTagsPastInfoNode uint16 = 0x01D6 // User past info node
  1713. ICQTLVTagsHomepageCategoryKeywords uint16 = 0x0212 // User homepage category/keywords
  1714. ICQTLVTagsHomepageURL uint16 = 0x0213 // User homepage URL
  1715. ICQTLVTagsWhitepagesSearchKeywords uint16 = 0x0226 // Whitepages search keywords string (search)
  1716. ICQTLVTagsSearchOnlineUsersFlag uint16 = 0x0230 // Search only online users flag (search)
  1717. ICQTLVTagsBirthdayInfo uint16 = 0x023A // User birthday info (year, month, day)
  1718. ICQTLVTagsNotesText uint16 = 0x0258 // User notes (about) text
  1719. ICQTLVTagsHomeStreetAddress uint16 = 0x0262 // User home street address
  1720. ICQTLVTagsHomeZipCode uint16 = 0x026C // User home zip code
  1721. ICQTLVTagsHomePhoneNumber uint16 = 0x0276 // User home phone number
  1722. ICQTLVTagsHomeFaxNumber uint16 = 0x0280 // User home fax number
  1723. ICQTLVTagsHomeCellularPhoneNumber uint16 = 0x028A // User home cellular phone number
  1724. ICQTLVTagsWorkStreetAddress uint16 = 0x0294 // User work street address
  1725. ICQTLVTagsWorkCityName uint16 = 0x029E // User work city name
  1726. ICQTLVTagsWorkStateName uint16 = 0x02A8 // User work state name
  1727. ICQTLVTagsWorkCountryCode uint16 = 0x02B2 // User work country code
  1728. ICQTLVTagsWorkZipCode uint16 = 0x02BC // User work zip code
  1729. ICQTLVTagsWorkPhoneNumber uint16 = 0x02C6 // User work phone number
  1730. ICQTLVTagsWorkFaxNumber uint16 = 0x02D0 // User work fax number
  1731. ICQTLVTagsWorkWebpageURL uint16 = 0x02DA // User work webpage URL
  1732. ICQTLVTagsAuthorizationPermissions uint16 = 0x02F8 // User authorization permissions
  1733. ICQTLVTagsShowWebStatusPermissions uint16 = 0x030C // User 'show web status' permissions
  1734. ICQTLVTagsGMTOffset uint16 = 0x0316 // User GMT offset
  1735. ICQTLVTagsOriginallyFromCity uint16 = 0x0320 // User originally from city
  1736. ICQTLVTagsOriginallyFromState uint16 = 0x032A // User originally from state
  1737. ICQTLVTagsOriginallyFromCountryCode uint16 = 0x0334 // User originally from country (code)
  1738. ICQDirTLVTagsPrivacyToken uint16 = 0x003C // Privacy token (16 bytes)
  1739. ICQDirTLVTagsVerifiedEmail uint16 = 0x0050 // Verified email address
  1740. ICQDirTLVTagsPendingEmail uint16 = 0x0055 // Pending email address
  1741. ICQDirTLVTagsFirstName uint16 = 0x0064 // First name
  1742. ICQDirTLVTagsLastName uint16 = 0x006E // Last name
  1743. ICQDirTLVTagsNickname uint16 = 0x0078 // Nickname
  1744. ICQDirTLVTagsGender uint16 = 0x0082 // Gender (1=Female, 2=Male)
  1745. ICQDirTLVTagsEmailAddresses uint16 = 0x008C // Email addresses (record list)
  1746. ICQDirTLVTagsHomeAddress uint16 = 0x0096 // Home address
  1747. ICQDirTLVTagsOriginAddress uint16 = 0x00A0 // Origin/birth address
  1748. ICQDirTLVTagsLanguage1 uint16 = 0x00AA // Primary language
  1749. ICQDirTLVTagsLanguage2 uint16 = 0x00B4 // Secondary language
  1750. ICQDirTLVTagsLanguage3 uint16 = 0x00BE // Tertiary language
  1751. ICQDirTLVTagsPhoneNumbers uint16 = 0x00C8 // Phone numbers (record list)
  1752. ICQDirTLVTagsHomepage uint16 = 0x00FA // Homepage URL
  1753. ICQDirTLVTagsEducation uint16 = 0x010E // Education info
  1754. ICQDirTLVTagsCompanyInfo uint16 = 0x0118 // Company/work info
  1755. ICQDirTLVTagsInterests uint16 = 0x0122 // Interests
  1756. ICQDirTLVTagsMaritalStatus uint16 = 0x012C // Marital status
  1757. ICQDirTLVTagsTimezone uint16 = 0x017C // Timezone
  1758. ICQDirTLVTagsAboutBio uint16 = 0x0186 // About/biography text
  1759. ICQDirTLVTagsAuthRequired uint16 = 0x019A // Authorization required flag
  1760. ICQDirTLVTagsBirthDate uint16 = 0x01A4 // Birth date
  1761. ICQDirTLVTagsCodePage uint16 = 0x01C2 // Code page
  1762. ICQDirTLVTagsMetadataTime uint16 = 0x01CC // Metadata update time
  1763. ICQDirTLVTagsAllowSpam uint16 = 0x01EA // Allow spam/messages from non-contacts flag
  1764. ICQDirTLVTagsPrivacyLevel uint16 = 0x01F9 // Privacy level
  1765. ICQDirTLVTagsWebAware uint16 = 0x0212 // Web aware flag (online visibility via web)
  1766. ICQDirTLVTagsStatusNote uint16 = 0x0226 // Status note/message
  1767. ICQStatusCodeOK uint8 = 0x0A
  1768. ICQStatusCodeFail uint8 = 0x32
  1769. ICQStatusCodeErr uint8 = 0x14
  1770. ICQDBQueryOfflineMsgReq uint16 = 0x003C
  1771. ICQDBQueryOfflineMsgReply uint16 = 0x0041
  1772. ICQDBQueryOfflineMsgReplyLast uint16 = 0x0042
  1773. ICQDBQueryDeleteMsgReq uint16 = 0x003E
  1774. ICQDBQueryMetaReq uint16 = 0x07D0
  1775. ICQDBQueryMetaReply uint16 = 0x07DA
  1776. )
  1777. const (
  1778. ICQUserFlagPublishEmailYes uint8 = 0
  1779. ICQUserFlagPublishEmailNo uint8 = 1
  1780. )
  1781. const (
  1782. ICQDBQueryMetaReqSetBasicInfo uint16 = 0x03EA
  1783. ICQDBQueryMetaReqSetWorkInfo uint16 = 0x03F3
  1784. ICQDBQueryMetaReqSetMoreInfo uint16 = 0x03FD
  1785. ICQDBQueryMetaReqSetNotes uint16 = 0x0406
  1786. ICQDBQueryMetaReqSetEmails uint16 = 0x040B
  1787. ICQDBQueryMetaReqSetInterests uint16 = 0x0410
  1788. ICQDBQueryMetaReqSetAffiliations uint16 = 0x041A
  1789. ICQDBQueryMetaReqSetPermissions uint16 = 0x0424
  1790. ICQDBQueryMetaReqSetICQPhone uint16 = 0x0654
  1791. ICQDBQueryMetaReqSetFullInfo uint16 = 0x0C3A
  1792. ICQDBQueryMetaReqShortInfo uint16 = 0x04BA
  1793. ICQDBQueryMetaReqFullInfo uint16 = 0x04B2
  1794. ICQDBQueryMetaReqFullInfo2 uint16 = 0x04D0
  1795. ICQDBQueryMetaReqSearchByDetails uint16 = 0x0515
  1796. ICQDBQueryMetaReqSearchByUIN uint16 = 0x051F
  1797. ICQDBQueryMetaReqSearchByEmail uint16 = 0x0529
  1798. ICQDBQueryMetaReqSearchWhitePages uint16 = 0x0533
  1799. ICQDBQueryMetaReqSearchWhitePages2 uint16 = 0x055F
  1800. ICQDBQueryMetaReqSearchByUIN2 uint16 = 0x0569
  1801. ICQDBQueryMetaReqSearchByEmail3 uint16 = 0x0573
  1802. ICQDBQueryMetaReqStat0758 uint16 = 0x0758
  1803. ICQDBQueryMetaReqXMLReq uint16 = 0x0898
  1804. ICQDBQueryMetaReqStat0a8c uint16 = 0x0A8C
  1805. ICQDBQueryMetaReqStat0a96 uint16 = 0x0A96
  1806. ICQDBQueryMetaReqStat0aaa uint16 = 0x0AAA
  1807. ICQDBQueryMetaReqStat0ab4 uint16 = 0x0AB4
  1808. ICQDBQueryMetaReqStat0ab9 uint16 = 0x0AB9
  1809. ICQDBQueryMetaReqStat0abe uint16 = 0x0ABE
  1810. ICQDBQueryMetaReqStat0ac8 uint16 = 0x0AC8
  1811. ICQDBQueryMetaReqStat0acd uint16 = 0x0ACD
  1812. ICQDBQueryMetaReqStat0ad2 uint16 = 0x0AD2
  1813. ICQDBQueryMetaReqStat0ad7 uint16 = 0x0AD7
  1814. ICQDBQueryMetaReqDirectoryQuery uint16 = 0x0FA0
  1815. ICQDBQueryMetaReqDirectoryUpdate uint16 = 0x0FD2
  1816. ICQDBQueryMetaReplySetBasicInfo uint16 = 0x0064
  1817. ICQDBQueryMetaReplySetWorkInfo uint16 = 0x006E
  1818. ICQDBQueryMetaReplySetMoreInfo uint16 = 0x0078
  1819. ICQDBQueryMetaReplySetNotes uint16 = 0x0082
  1820. ICQDBQueryMetaReplySetEmails uint16 = 0x0087
  1821. ICQDBQueryMetaReplySetInterests uint16 = 0x008C
  1822. ICQDBQueryMetaReplySetAffiliations uint16 = 0x0096
  1823. ICQDBQueryMetaReplySetPermissions uint16 = 0x00A0
  1824. ICQDBQueryMetaReplySetICQPhone uint16 = 0x031E
  1825. ICQDBQueryMetaReplySetFullInfo uint16 = 0x0C3F
  1826. ICQDBQueryMetaReplyBasicInfo uint16 = 0x00C8
  1827. ICQDBQueryMetaReplyWorkInfo uint16 = 0x00D2
  1828. ICQDBQueryMetaReplyMoreInfo uint16 = 0x00DC
  1829. ICQDBQueryMetaReplyNotes uint16 = 0x00E6
  1830. ICQDBQueryMetaReplyExtEmailInfo uint16 = 0x00EB
  1831. ICQDBQueryMetaReplyInterests uint16 = 0x00F0
  1832. ICQDBQueryMetaReplyAffiliations uint16 = 0x00FA
  1833. ICQDBQueryMetaReplyShortInfo uint16 = 0x0104
  1834. ICQDBQueryMetaReplyHomePageCat uint16 = 0x010E
  1835. ICQDBQueryMetaReplyUserFound uint16 = 0x01A4
  1836. ICQDBQueryMetaReplyLastUserFound uint16 = 0x01AE
  1837. ICQDBQueryMetaReplyXMLData uint16 = 0x08A2
  1838. )
  1839. type SNAC_0x15_0x02_BQuery struct {
  1840. TLVRestBlock
  1841. }
  1842. type ICQ_0x07D0_0x04BA_DBQueryMetaReqShortInfo struct {
  1843. UIN uint32
  1844. }
  1845. type ICQ_0x07D0_0x0898_DBQueryMetaReqXMLReq struct {
  1846. XMLRequest string `oscar:"len_prefix=uint16,nullterm"`
  1847. }
  1848. type ICQ_0x07D0_0x0424_DBQueryMetaReqSetPermissions struct {
  1849. Authorization uint8 // (1-required, 0-not required)
  1850. WebAware uint8 // webaware (0-no, 1-yes)
  1851. DCPerms uint8 // dc_perms (0-any, 1-contact, 2-authorization)
  1852. Unknown uint8
  1853. }
  1854. // ICQ_0x07D0_0x0654_DBQueryMetaReqSetICQPhone represents a request to set
  1855. // ICQPhone information.
  1856. type ICQ_0x07D0_0x0654_DBQueryMetaReqSetICQPhone struct {
  1857. // acknowledge the data, do nothing
  1858. }
  1859. type ICQ_0x07D0_0x051F_DBQueryMetaReqSearchByUIN struct {
  1860. UIN uint32
  1861. }
  1862. type ICQ_0x07D0_0x0569_DBQueryMetaReqSearchByUIN2 struct {
  1863. TLVRestBlock `oscar:"quirk=qip_2005_search_by_uin2"`
  1864. }
  1865. type ICQ_0x07D0_0x0529_DBQueryMetaReqSearchByEmail struct {
  1866. Email string `oscar:"len_prefix=uint16,nullterm"`
  1867. }
  1868. type ICQ_0x07D0_0x0573_DBQueryMetaReqSearchByEmail3 struct {
  1869. TLVRestBlock
  1870. }
  1871. type ICQ_0x07D0_0x0515_DBQueryMetaReqSearchByDetails struct {
  1872. FirstName string `oscar:"len_prefix=uint16,nullterm"`
  1873. LastName string `oscar:"len_prefix=uint16,nullterm"`
  1874. NickName string `oscar:"len_prefix=uint16,nullterm"`
  1875. }
  1876. type ICQInterests struct {
  1877. Code uint16
  1878. Keyword string `oscar:"len_prefix=uint16,nullterm"`
  1879. }
  1880. type ICQEmail struct {
  1881. Email string `oscar:"len_prefix=uint16,nullterm"`
  1882. }
  1883. type ICQ_0x07D0_0x0533_DBQueryMetaReqSearchWhitePages struct {
  1884. FirstName string `oscar:"len_prefix=uint16,nullterm"`
  1885. LastName string `oscar:"len_prefix=uint16,nullterm"`
  1886. Nickname string `oscar:"len_prefix=uint16,nullterm"`
  1887. Email string `oscar:"len_prefix=uint16,nullterm"`
  1888. MinAge uint16
  1889. MaxAge uint16
  1890. Gender uint8
  1891. SpeakingLang uint8
  1892. City string `oscar:"len_prefix=uint16,nullterm"`
  1893. State string `oscar:"len_prefix=uint16,nullterm"`
  1894. CountryCode uint16
  1895. Company string `oscar:"len_prefix=uint16,nullterm"`
  1896. Department string `oscar:"len_prefix=uint16,nullterm"`
  1897. Position string `oscar:"len_prefix=uint16,nullterm"`
  1898. OccupationCode uint16
  1899. PastCode uint16
  1900. PastKeywords string `oscar:"len_prefix=uint16,nullterm"`
  1901. InterestsCode uint16
  1902. InterestsKeyword string `oscar:"len_prefix=uint16,nullterm"`
  1903. AffiliationsCode uint16
  1904. AffiliationsKeyword string `oscar:"len_prefix=uint16,nullterm"`
  1905. HomePageCode uint16
  1906. HomePageKeywords string `oscar:"len_prefix=uint16,nullterm"`
  1907. SearchScope uint8
  1908. }
  1909. type ICQ_0x07D0_0x055F_DBQueryMetaReqSearchWhitePages2 struct {
  1910. TLVRestBlock
  1911. }
  1912. // ICQ_0x07D0_0x0C3A_DBQueryMetaReqSetFullInfo represents the TLV-based
  1913. // CLI_SET_FULLINFO request used by ICQLite to update profile information in
  1914. // a single packet. The TLV chain may contain any subset of the tags in the
  1915. // ICQTLVTags* group; tags omitted by the client should leave the
  1916. // corresponding profile fields unchanged. Some tags (e.g.
  1917. // ICQTLVTagsSpokenLanguage, ICQTLVTagsAffiliationsNode) may appear multiple
  1918. // times in the chain.
  1919. type ICQ_0x07D0_0x0C3A_DBQueryMetaReqSetFullInfo struct {
  1920. TLVRestBlock `oscar:"quirk=icq2003b_set_fullinfo"`
  1921. }
  1922. type ICQ_0x07D0_0x03FD_DBQueryMetaReqSetMoreInfo struct {
  1923. Age uint8 // not used because age is calculated from birthdate
  1924. Gender uint16
  1925. HomePageAddr string `oscar:"len_prefix=uint16,nullterm"`
  1926. BirthYear uint16
  1927. BirthMonth uint8
  1928. BirthDay uint8
  1929. Lang1 uint8
  1930. Lang2 uint8
  1931. Lang3 uint8
  1932. }
  1933. type ICQ_0x07D0_0x03F3_DBQueryMetaReqSetWorkInfo struct {
  1934. City string `oscar:"len_prefix=uint16,nullterm"`
  1935. State string `oscar:"len_prefix=uint16,nullterm"`
  1936. Phone string `oscar:"len_prefix=uint16,nullterm"`
  1937. Fax string `oscar:"len_prefix=uint16,nullterm"`
  1938. Address string `oscar:"len_prefix=uint16,nullterm"`
  1939. ZIP string `oscar:"len_prefix=uint16,nullterm"`
  1940. CountryCode uint16
  1941. Company string `oscar:"len_prefix=uint16,nullterm"`
  1942. Department string `oscar:"len_prefix=uint16,nullterm"`
  1943. Position string `oscar:"len_prefix=uint16,nullterm"`
  1944. OccupationCode uint16
  1945. WebPage string `oscar:"len_prefix=uint16,nullterm"`
  1946. }
  1947. type ICQ_0x07D0_0x040B_DBQueryMetaReqSetEmails struct {
  1948. Emails []struct {
  1949. Publish uint8
  1950. Email string `oscar:"len_prefix=uint16,nullterm"`
  1951. } `oscar:"count_prefix=uint8"`
  1952. }
  1953. type ICQ_0x07D0_0x0406_DBQueryMetaReqSetNotes struct {
  1954. Notes string `oscar:"len_prefix=uint16,nullterm"`
  1955. }
  1956. type ICQ_0x07D0_0x0410_DBQueryMetaReqSetInterests struct {
  1957. Interests []struct {
  1958. Code uint16
  1959. Keyword string `oscar:"len_prefix=uint16,nullterm"`
  1960. } `oscar:"count_prefix=uint8"`
  1961. }
  1962. type ICQ_0x07D0_0x041A_DBQueryMetaReqSetAffiliations struct {
  1963. PastAffiliations []struct {
  1964. Code uint16
  1965. Keyword string `oscar:"len_prefix=uint16,nullterm"`
  1966. } `oscar:"count_prefix=uint8"`
  1967. Affiliations []struct {
  1968. Code uint16
  1969. Keyword string `oscar:"len_prefix=uint16,nullterm"`
  1970. } `oscar:"count_prefix=uint8"`
  1971. }
  1972. type ICQ_0x07D0_0x03EA_DBQueryMetaReqSetBasicInfo struct {
  1973. Nickname string `oscar:"len_prefix=uint16,nullterm"`
  1974. FirstName string `oscar:"len_prefix=uint16,nullterm"`
  1975. LastName string `oscar:"len_prefix=uint16,nullterm"`
  1976. EmailAddress string `oscar:"len_prefix=uint16,nullterm"`
  1977. City string `oscar:"len_prefix=uint16,nullterm"`
  1978. State string `oscar:"len_prefix=uint16,nullterm"`
  1979. Phone string `oscar:"len_prefix=uint16,nullterm"`
  1980. Fax string `oscar:"len_prefix=uint16,nullterm"`
  1981. HomeAddress string `oscar:"len_prefix=uint16,nullterm"`
  1982. CellPhone string `oscar:"len_prefix=uint16,nullterm"`
  1983. ZIP string `oscar:"len_prefix=uint16,nullterm"`
  1984. CountryCode uint16
  1985. GMTOffset uint8
  1986. PublishEmail uint8
  1987. }
  1988. type SNAC_0x15_0x02_DBReply struct {
  1989. TLVRestBlock
  1990. }
  1991. type ICQ_0x07DA_0x010E_DBQueryMetaReplyHomePageCat struct {
  1992. ICQMetadata
  1993. ReqSubType uint16
  1994. Success uint8
  1995. Enabled uint8
  1996. CatCode uint16
  1997. Keywords string `oscar:"len_prefix=uint16,nullterm"`
  1998. Unknown uint8
  1999. }
  2000. type ICQ_0x07DA_0x08A2_DBQueryMetaReplyXMLData struct {
  2001. ICQMetadata
  2002. ReqSubType uint16
  2003. Success uint8
  2004. XML string `oscar:"len_prefix=uint16,nullterm"`
  2005. }
  2006. type ICQ_0x07DA_0x00DC_DBQueryMetaReplyMoreInfo struct {
  2007. ICQMetadata
  2008. ReqSubType uint16
  2009. Success uint8
  2010. Age uint16
  2011. Gender uint8
  2012. HomePageAddr string `oscar:"len_prefix=uint16,nullterm"`
  2013. BirthYear uint16
  2014. BirthMonth uint8
  2015. BirthDay uint8
  2016. Lang1 uint8
  2017. Lang2 uint8
  2018. Lang3 uint8
  2019. Unknown uint16
  2020. City string `oscar:"len_prefix=uint16,nullterm"`
  2021. State string `oscar:"len_prefix=uint16,nullterm"`
  2022. CountryCode uint16
  2023. TimeZone uint8
  2024. // Buffer fixes ICQ 5 user info request "error 117"
  2025. Buffer [4]byte
  2026. }
  2027. type ICQ_0x07DA_0x00EB_DBQueryMetaReplyExtEmailInfo struct {
  2028. ICQMetadata
  2029. ReqSubType uint16
  2030. Success uint8
  2031. Emails []struct {
  2032. Flag uint8 // (0-publish, 1-don't)
  2033. Email string `oscar:"len_prefix=uint16,nullterm"`
  2034. } `oscar:"count_prefix=uint8"`
  2035. }
  2036. type ICQ_0x07DA_0x00D2_DBQueryMetaReplyWorkInfo struct {
  2037. ICQMetadata
  2038. ReqSubType uint16
  2039. Success uint8
  2040. ICQ_0x07D0_0x03F3_DBQueryMetaReqSetWorkInfo
  2041. }
  2042. type ICQ_0x07DA_0x00F0_DBQueryMetaReplyInterests struct {
  2043. ICQMetadata
  2044. ReqSubType uint16
  2045. Success uint8
  2046. Interests []struct {
  2047. Code uint16
  2048. Keyword string `oscar:"len_prefix=uint16,nullterm"`
  2049. } `oscar:"count_prefix=uint8"`
  2050. }
  2051. type ICQ_0x07DA_0x00E6_DBQueryMetaReplyNotes struct {
  2052. ICQMetadata
  2053. ReqSubType uint16
  2054. Success uint8
  2055. ICQ_0x07D0_0x0406_DBQueryMetaReqSetNotes
  2056. }
  2057. type ICQ_0x07DA_0x00FA_DBQueryMetaReplyAffiliations struct {
  2058. ICQMetadata
  2059. ReqSubType uint16
  2060. Success uint8
  2061. ICQ_0x07D0_0x041A_DBQueryMetaReqSetAffiliations
  2062. }
  2063. type ICQ_0x07DA_0x00C8_DBQueryMetaReplyBasicInfo struct {
  2064. ICQMetadata
  2065. ReqSubType uint16
  2066. Success uint8
  2067. Nickname string `oscar:"len_prefix=uint16,nullterm"`
  2068. FirstName string `oscar:"len_prefix=uint16,nullterm"`
  2069. LastName string `oscar:"len_prefix=uint16,nullterm"`
  2070. Email string `oscar:"len_prefix=uint16,nullterm"`
  2071. City string `oscar:"len_prefix=uint16,nullterm"`
  2072. State string `oscar:"len_prefix=uint16,nullterm"`
  2073. Phone string `oscar:"len_prefix=uint16,nullterm"`
  2074. Fax string `oscar:"len_prefix=uint16,nullterm"`
  2075. Address string `oscar:"len_prefix=uint16,nullterm"`
  2076. CellPhone string `oscar:"len_prefix=uint16,nullterm"`
  2077. ZIP string `oscar:"len_prefix=uint16,nullterm"`
  2078. CountryCode uint16
  2079. GMTOffset uint8
  2080. AuthFlag uint8
  2081. WebAware uint8
  2082. DCPerms uint8
  2083. PublishEmail uint8
  2084. }
  2085. type ICQ_0x07DA_0x01A4_DBQueryMetaReplyUserFound struct {
  2086. ICQMetadata
  2087. ReqSubType uint16
  2088. Success uint8
  2089. Details ICQUserSearchRecord `oscar:"len_prefix=uint16"`
  2090. // Buffer allows intermediate search results to appear in ICQ 5
  2091. Buffer [12]byte
  2092. }
  2093. type ICQ_0x07DA_0x01AE_DBQueryMetaReplyLastUserFound struct {
  2094. ICQMetadata
  2095. ReqSubType uint16
  2096. Success uint8
  2097. Details ICQUserSearchRecord `oscar:"len_prefix=uint16"`
  2098. UsersLeft uint32
  2099. // Buffer fixes ICQ 5 search hanging
  2100. Buffer [8]byte
  2101. }
  2102. type ICQ_0x07DA_0x0104_DBQueryMetaReplyShortInfo struct {
  2103. ICQMetadata
  2104. ReqSubType uint16
  2105. Success uint8
  2106. Nickname string `oscar:"len_prefix=uint16,nullterm"`
  2107. FirstName string `oscar:"len_prefix=uint16,nullterm"`
  2108. LastName string `oscar:"len_prefix=uint16,nullterm"`
  2109. Email string `oscar:"len_prefix=uint16,nullterm"`
  2110. Authorization uint8
  2111. Unknown uint8
  2112. Gender uint8
  2113. }
  2114. type ICQ_0x0041_DBQueryOfflineMsgReply struct {
  2115. ICQMetadata
  2116. SenderUIN uint32
  2117. Year uint16
  2118. Month uint8
  2119. Day uint8
  2120. Hour uint8
  2121. Minute uint8
  2122. MsgType uint8
  2123. Flags uint8
  2124. Message string `oscar:"len_prefix=uint16,nullterm"`
  2125. }
  2126. type ICQ_0x0042_DBQueryOfflineMsgReplyLast struct {
  2127. ICQMetadata
  2128. DroppedMessages uint8
  2129. }
  2130. type ICQMetadataWithSubType struct {
  2131. ICQMetadata
  2132. Optional *struct {
  2133. ReqSubType uint16
  2134. } `oscar:"optional"`
  2135. }
  2136. type ICQMetadata struct {
  2137. UIN uint32
  2138. ReqType uint16
  2139. Seq uint16
  2140. }
  2141. // ICQMessageRequestEnvelope is a helper struct that provides syntactic sugar for
  2142. // unmarshaling an ICQ message into a little-endian byte array.
  2143. type ICQMessageRequestEnvelope struct {
  2144. Body []byte `oscar:"len_prefix=uint16"`
  2145. }
  2146. // ICQMessageReplyEnvelope is a helper struct that provides syntactic sugar for
  2147. // marshaling an ICQ message into a little-endian byte array.
  2148. type ICQMessageReplyEnvelope struct {
  2149. Message any `oscar:"len_prefix=uint16"`
  2150. }
  2151. type ICQUserSearchRecord struct {
  2152. UIN uint32
  2153. Nickname string `oscar:"len_prefix=uint16,nullterm"`
  2154. FirstName string `oscar:"len_prefix=uint16,nullterm"`
  2155. LastName string `oscar:"len_prefix=uint16,nullterm"`
  2156. Email string `oscar:"len_prefix=uint16,nullterm"`
  2157. Authorization uint8
  2158. OnlineStatus uint16
  2159. Gender uint8
  2160. Age uint16
  2161. }
  2162. //
  2163. // 0x17: BUCP
  2164. //
  2165. const (
  2166. BUCPErr uint16 = 0x0001
  2167. BUCPLoginRequest uint16 = 0x0002
  2168. BUCPLoginResponse uint16 = 0x0003
  2169. BUCPRegisterRequest uint16 = 0x0004
  2170. BUCPChallengeRequest uint16 = 0x0006
  2171. BUCPChallengeResponse uint16 = 0x0007
  2172. BUCPAsasnRequest uint16 = 0x0008
  2173. BUCPSecuridRequest uint16 = 0x000A
  2174. BUCPRegistrationImageRequest uint16 = 0x000C
  2175. )
  2176. type SNAC_0x17_0x02_BUCPLoginRequest struct {
  2177. TLVRestBlock
  2178. }
  2179. type SNAC_0x17_0x03_BUCPLoginResponse struct {
  2180. TLVRestBlock
  2181. }
  2182. type SNAC_0x17_0x06_BUCPChallengeRequest struct {
  2183. TLVRestBlock
  2184. }
  2185. type SNAC_0x17_0x07_BUCPChallengeResponse struct {
  2186. AuthKey string `oscar:"len_prefix=uint16"`
  2187. }
  2188. //
  2189. // 0x18: Alert
  2190. //
  2191. const (
  2192. AlertErr uint16 = 0x0001
  2193. AlertSetAlertRequest uint16 = 0x0002
  2194. AlertSetAlertReply uint16 = 0x0003
  2195. AlertGetSubsRequest uint16 = 0x0004
  2196. AlertGetSubsResponse uint16 = 0x0005
  2197. AlertNotifyCapabilities uint16 = 0x0006
  2198. AlertNotify uint16 = 0x0007
  2199. AlertGetRuleRequest uint16 = 0x0008
  2200. AlertGetRuleReply uint16 = 0x0009
  2201. AlertGetFeedRequest uint16 = 0x000A
  2202. AlertGetFeedReply uint16 = 0x000B
  2203. AlertRefreshFeed uint16 = 0x000D
  2204. AlertEvent uint16 = 0x000E
  2205. AlertQogSnac uint16 = 0x000F
  2206. AlertRefreshFeedStock uint16 = 0x0010
  2207. AlertNotifyTransport uint16 = 0x0011
  2208. AlertSetAlertRequestV2 uint16 = 0x0012
  2209. AlertSetAlertReplyV2 uint16 = 0x0013
  2210. AlertTransitReply uint16 = 0x0014
  2211. AlertNotifyAck uint16 = 0x0015
  2212. AlertNotifyDisplayCapabilities uint16 = 0x0016
  2213. AlertUserOnline uint16 = 0x0017
  2214. )
  2215. //
  2216. // Kerberos Auth (AIM 6+)
  2217. //
  2218. const (
  2219. KerberosLoginRequest uint16 = 0x0002
  2220. KerberosLoginSuccessResponse uint16 = 0x0003
  2221. KerberosKerberosLoginErrResponse uint16 = 0x0004
  2222. KerberosTLVTicketRequest uint16 = 0x0002
  2223. KerberosTLVBOSServerInfo uint16 = 0x0003
  2224. KerberosTLVHostname uint16 = 0x0005
  2225. KerberosTLVCookie uint16 = 0x0006
  2226. KerberosTLVTLSCertName uint16 = 0x008D
  2227. KerberosTLVConnSettings uint16 = 0x008E
  2228. KerberosConnUseSSL uint16 = 0x0002
  2229. KerberosErrAuthFailure uint16 = 0x0401
  2230. )
  2231. // SNAC_0x050C_0x0002_KerberosLoginRequest represents a Kerberos-like login request
  2232. // sent by the AIM client as part of the OSCAR authentication handshake using SNAC(0x050C, 0x0002).
  2233. type SNAC_0x050C_0x0002_KerberosLoginRequest struct {
  2234. // RequestID is a client-generated identifier that matches the one echoed in the server response.
  2235. RequestID uint32
  2236. // ClientIP is the client's IPv4 address in network byte order.
  2237. ClientIP uint32
  2238. // ClientCOOLVersionMajor is the major version of the AIM client "COOL" protocol.
  2239. ClientCOOLVersionMajor uint32
  2240. // ClientCOOLVersionMinor is the minor version of the AIM client "COOL" protocol.
  2241. ClientCOOLVersionMinor uint32
  2242. // PaddingOrZero is always observed as 0x00000000 and may be reserved/padding.
  2243. PaddingOrZero uint32
  2244. // KerberosPayload contains TLV-encoded data, typically including the AP-REQ (TLV 0x0005).
  2245. KerberosPayload TLVBlock
  2246. // LocaleFlags1 appears to contain locale or encoding hints, possibly bitflags.
  2247. LocaleFlags1 uint32
  2248. // LocaleFlags2 is another locale- or feature-related field, typically zero.
  2249. LocaleFlags2 uint32
  2250. // CountryCode is the user's ISO 3166-1 alpha-2 country code (e.g., "US").
  2251. CountryCode string `oscar:"len_prefix=uint16"`
  2252. // LanguageCode is the user's ISO 639-1 language code (e.g., "en").
  2253. LanguageCode string `oscar:"len_prefix=uint16"`
  2254. // ServiceContextBlock is a TLV block containing client realm and service info.
  2255. ServiceContextBlock TLVBlock
  2256. // VersionOrFlags is likely a protocol feature version or flag mask (exact meaning unknown).
  2257. VersionOrFlags uint32
  2258. // AuthType is a 1-byte value (usually 0x00 or 0x01), possibly denoting password type or encoding.
  2259. AuthType byte
  2260. // ClientPrincipal is the Kerberos principal name (username).
  2261. ClientPrincipal string `oscar:"len_prefix=uint16"`
  2262. // ServicePrincipal is the Kerberos service string (e.g., "im/boss").
  2263. ServicePrincipal string `oscar:"len_prefix=uint16"`
  2264. // Reserved1 is typically zero; possibly a padding or reserved field.
  2265. Reserved1 uint32
  2266. // RealmCount is typically 0x0002; may indicate how many realms or tickets are requested.
  2267. RealmCount uint16
  2268. // TicketRequestMetadata is a TLV block describing requested tickets (e.g., realm, lifetime, enctype).
  2269. TicketRequestMetadata TLVBlock
  2270. }
  2271. // SNAC_0x050C_0x0003_KerberosLoginSuccessResponse represents the server's response to a successful
  2272. // Kerberos-like login request in AIM's OSCAR protocol. It includes the client identity and issued tickets.
  2273. type SNAC_0x050C_0x0003_KerberosLoginSuccessResponse struct {
  2274. // RequestID matches the KerberosRequestID from the original client request (for correlation).
  2275. RequestID uint32
  2276. // Epoch is a server-issued timestamp indicating when the client was authenticated.
  2277. // This is often used as the start time for ticket validity.
  2278. Epoch uint32
  2279. // Reserved is a 4-byte field, usually zero. Possibly reserved for future use or alignment.
  2280. Reserved uint32
  2281. // ClientPrincipal is the Kerberos principal name of the authenticated client.
  2282. ClientPrincipal string `oscar:"len_prefix=uint16"`
  2283. // ClientRealm is the Kerberos realm in which the client was authenticated (e.g., "AOL").
  2284. ClientRealm string `oscar:"len_prefix=uint16"`
  2285. // Tickets contains one or more issued Kerberos tickets, including service tickets and/or a TGT.
  2286. // These are encoded in ASN.1 DER and include session keys, expiration, and encrypted blobs.
  2287. Tickets []KerberosTicket `oscar:"count_prefix=uint16"`
  2288. // Extensions is a TLVBlock containing optional metadata. May include:
  2289. // - Client capabilities
  2290. // - Locales or language tags
  2291. // - Echoed usernames
  2292. // - Additional authentication hints
  2293. Extensions TLVBlock
  2294. }
  2295. // SNAC_0x050C_0x0004_KerberosLoginErrResponse represents a login failure response
  2296. // sent by the AIM server in reply to a Kerberos-style login attempt (SNAC 0x050C/0x0002).
  2297. //
  2298. // This SNAC is typically sent when authentication fails due to an invalid password,
  2299. // unknown screen name, or protocol-level issues. It includes a human-readable message
  2300. // and an error code, along with optional TLV metadata.
  2301. type SNAC_0x050C_0x0004_KerberosLoginErrResponse struct {
  2302. // KerbRequestID matches the KerberosRequestID from the original login request,
  2303. // allowing the client to correlate the response to the appropriate attempt.
  2304. KerbRequestID uint32
  2305. // ScreenName is the screen name the client attempted to authenticate as.
  2306. // This is echoed back by the server for clarity/debugging.
  2307. ScreenName string `oscar:"len_prefix=uint16"`
  2308. // ErrCode is a 2-byte error code indicating the reason for login failure.
  2309. // The only supported value is 0x0401, which indicates an invalid username
  2310. // or password.
  2311. ErrCode uint16
  2312. // Message is a UTF-8 string providing a user-facing explanation of the error
  2313. // (e.g., "Invalid screen name or password").
  2314. Message string `oscar:"len_prefix=uint16"`
  2315. // Unknown1 is an unknown flag.
  2316. Unknown1 uint32
  2317. // Metadata is a TLVBlock that may contain additional metadata about the failure.
  2318. Metadata TLVBlock
  2319. }
  2320. // KerberosLoginRequestTicket appears inside TLV 0x0002 of the
  2321. // Ticket-Request Metadata block that the AIM client bundles into
  2322. // its "Kerberos Login Request" (SNAC 0x050C/0x0002).
  2323. type KerberosLoginRequestTicket struct {
  2324. // Marker might indicate the payload type.
  2325. Marker uint32
  2326. // Version might indicate the internal structure version.
  2327. Version uint16
  2328. // Flags contains unknown flags.
  2329. Flags uint32
  2330. // Unknown is an unknown field.
  2331. Unknown uint16
  2332. // Password holds the user's password.
  2333. Password []byte `oscar:"len_prefix=uint16"`
  2334. // PasswordMetadata may hold additional metadata about the password.
  2335. PasswordMetadata TLVBlock
  2336. }
  2337. // KerberosTicket represents one service ticket returned inside the
  2338. // SNAC(0x050C, 0x0003) "Kerberos Login Success" response.
  2339. //
  2340. // TicketBlob follows the general layout of an RFC 4120 Ticket,
  2341. // but is delivered in AIM's TLV wrapper rather than a full KRB-TGS-REP.
  2342. type KerberosTicket struct {
  2343. // PVNO is the Kerberos protocol-version number carried
  2344. // in the ticket header. In Kerberos V5 this is always 0x0005.
  2345. PVNO uint16
  2346. // EncTicket is the raw ASN.1 DER-encoded Ticket structure
  2347. // (encrypted to the service key). Length is given by the preceding
  2348. // uint16 in the OSCAR stream.
  2349. EncTicket []byte `oscar:"len_prefix=uint16"`
  2350. // TicketRealm is the realm to which the service principal belongs
  2351. // (e.g. "AOL").
  2352. TicketRealm string `oscar:"len_prefix=uint16"`
  2353. // ServicePrincipal is the complete service-principal name for which
  2354. // the ticket is valid (e.g. "im/boss").
  2355. ServicePrincipal string `oscar:"len_prefix=uint16"`
  2356. // ClientRealm is the Kerberos realm of the authenticated user.
  2357. ClientRealm string `oscar:"len_prefix=uint16"`
  2358. // ClientPrincipal is the principal name inside that realm.
  2359. ClientPrincipal string `oscar:"len_prefix=uint16"`
  2360. // KVNO (Key Version Number) tells the service which
  2361. // long-term key to use when decrypting EncTicket.
  2362. KVNO uint8
  2363. // SessionKey is the clear-text session key that the KDC also placed,
  2364. // encrypted, inside EncTicket. Provided here for the client's
  2365. // convenience so it doesn't have to decrypt the ticket itself.
  2366. SessionKey []byte `oscar:"len_prefix=uint16"`
  2367. // Unknown1 is typically zero. Possibly reserved or unused.
  2368. Unknown1 uint32
  2369. // Unknown2 is a possible bitfield.
  2370. Unknown2 uint32
  2371. // AuthTime is the time when the initial authentication occurred (UNIX epoch).
  2372. AuthTime uint32
  2373. // StartTime is when the ticket becomes valid (UNIX epoch).
  2374. StartTime uint32
  2375. // EndTime is when the ticket expires (UNIX epoch).
  2376. EndTime uint32
  2377. // RenewTill is likely the latest time the ticket can be renewed (UNIX epoch).
  2378. RenewTill uint32
  2379. // Unknown5 is a possible bitfield.
  2380. Unknown4 uint32
  2381. // Unknown5 is a possible bitfield.
  2382. Unknown5 uint32
  2383. // Unknown6 is a possible bitfield.
  2384. Unknown6 uint32
  2385. // ConnectionMetadata holds metadata used for the next connection (IP address, cookie, etc).
  2386. ConnectionMetadata TLVBlock
  2387. }
  2388. // KerberosBOSServerInfo provides the client with connection parameters for contacting
  2389. // the BOS (Basic OSCAR Service) server.
  2390. //
  2391. // This TLV is typically returned by the server inside a successful Kerberos login response
  2392. // (SNAC 0x050C/0x0003).
  2393. type KerberosBOSServerInfo struct {
  2394. // Unknown may signify a version or feature flag block.
  2395. Unknown uint16
  2396. // ConnectionInfo is a TLV block defining the next server to contact (BOS).
  2397. // Includes IP address, port, session cookie, and other required fields for login.
  2398. ConnectionInfo TLVBlock
  2399. }
  2400. //
  2401. // Misc
  2402. //
  2403. type TLVUserInfo struct {
  2404. ScreenName string `oscar:"len_prefix=uint8"`
  2405. WarningLevel uint16
  2406. TLVBlock
  2407. }
  2408. func (t TLVUserInfo) IsAway() bool {
  2409. flags, _ := t.Uint16BE(OServiceUserInfoUserFlags)
  2410. return flags&OServiceUserFlagUnavailable == OServiceUserFlagUnavailable
  2411. }
  2412. func (t TLVUserInfo) IsInvisible() bool {
  2413. mask, _ := t.Uint32BE(OServiceUserInfoStatus)
  2414. return mask&OServiceUserStatusInvisible == OServiceUserStatusInvisible
  2415. }
  2416. type FeedbagItem struct {
  2417. Name string `oscar:"len_prefix=uint16"`
  2418. GroupID uint16
  2419. ItemID uint16
  2420. ClassID uint16
  2421. TLVLBlock
  2422. }
  2423. // IsEqual reports whether f and other have identical field values, including
  2424. // the same TLVs in the same order with the same data.
  2425. func (f *FeedbagItem) IsEqual(other FeedbagItem) bool {
  2426. if f.Name != other.Name || f.GroupID != other.GroupID || f.ClassID != other.ClassID {
  2427. return false
  2428. }
  2429. if len(f.TLVList) != len(other.TLVList) {
  2430. return false
  2431. }
  2432. for i, tlv := range f.TLVList {
  2433. o := other.TLVList[i]
  2434. if tlv.Tag != o.Tag || !bytes.Equal(tlv.Value, o.Value) {
  2435. return false
  2436. }
  2437. }
  2438. return true
  2439. }
  2440. // AppendOrderMembers adds member IDs to the item's order attribute TLV. If
  2441. // the order TLV already exists, the new IDs are appended to it. Otherwise a
  2442. // new order TLV is created.
  2443. func (f *FeedbagItem) AppendOrderMembers(memberIDs ...uint16) {
  2444. existing, _ := f.Uint16SliceBE(FeedbagAttributesOrder)
  2445. f.Set(NewTLVBE(FeedbagAttributesOrder, append(existing, memberIDs...)))
  2446. }
  2447. // RemoveOrderMembers removes the specified member IDs from the item's order
  2448. // attribute TLV. IDs not present in the order are ignored.
  2449. func (f *FeedbagItem) RemoveOrderMembers(memberIDs ...uint16) {
  2450. existing, ok := f.Uint16SliceBE(FeedbagAttributesOrder)
  2451. if !ok {
  2452. return
  2453. }
  2454. remove := make(map[uint16]struct{}, len(memberIDs))
  2455. for _, id := range memberIDs {
  2456. remove[id] = struct{}{}
  2457. }
  2458. filtered := make([]uint16, 0, len(existing))
  2459. for _, id := range existing {
  2460. if _, found := remove[id]; !found {
  2461. filtered = append(filtered, id)
  2462. }
  2463. }
  2464. f.Set(NewTLVBE(FeedbagAttributesOrder, filtered))
  2465. }
  2466. // ICQDCInfo represents ICQ direct connect settings.
  2467. type ICQDCInfo struct {
  2468. IP uint32
  2469. Port uint32
  2470. DCType uint8
  2471. ProtoVersion uint16
  2472. AuthCookie uint32
  2473. WebPort uint32
  2474. ClientFutures uint32
  2475. LastUpdateTime uint32
  2476. LastExtInfoUpdateTime uint32
  2477. LastExtStatusUpdateTime uint32
  2478. Unknown uint16
  2479. }
  2480. //
  2481. // TOC Error Codes
  2482. //
  2483. const (
  2484. // General Errors
  2485. TOCErrorGeneralUserNotAvailable = "901" // followed by screenname
  2486. TOCErrorGeneralWarningUserNotAvailable = "902" // followed by screenname
  2487. TOCErrorGeneralRateLimitHit = "903"
  2488. // Admin Errors
  2489. TOCErrorAdminInvalidInput = "911"
  2490. TOCErrorAdminInvalidAccount = "912"
  2491. TOCErrorAdminProcessingRequest = "913"
  2492. TOCErrorAdminServiceUnavailable = "914"
  2493. // Chat Errors
  2494. TOCErrorChatInChatroomUnavailble = "950" // followed by chatroom
  2495. // IM & Info Errors
  2496. TOCErrorIMSendingMessagesTooFast = "960" // followed by screenname
  2497. TOCErrorIMMissedMessageTooBig = "961" // followed by screenname
  2498. TOCErrorIMMissedMessageTooFast = "962" // followed by screenname
  2499. // DirErrors
  2500. TOCErrorDirFailure = "970"
  2501. TOCErrorDirTooManyMatches = "971"
  2502. TOCErrorDirNeedMoreQualifiers = "972"
  2503. TOCErrorDirServiceUnavailable = "973"
  2504. TOCErrorDirEmailLookupRestricted = "974"
  2505. TOCErrorDirKeywordIgnored = "975"
  2506. TOCErrorDirNoKeywords = "976"
  2507. TOCErrorDirLanguageNotSupported = "977"
  2508. TOCErrorDirCountryNotSupported = "978"
  2509. TOCErrorDirFailureUnknown = "979" // followed by error msg (or a SubErrorCode?)
  2510. // Auth Errors
  2511. TOCErrorAuthIncorrectNickOrPassword = "980"
  2512. TOCErrorAuthServiceUnavailable = "981"
  2513. TOCErrorAuthWarningTooHigh = "982"
  2514. TOCErrorAuthRatedFromLogin = "983"
  2515. TOCErrorAuthUnknownError = "989" // followed by SubErrorCode
  2516. TOCErrorAuthUnknownSubErrorSignOnTooSoon = "0"
  2517. TOCErrorAuthUnknownSubErrorInvalidScreennameOrPassword = "7"
  2518. TOCErrorAuthUnknownSubErrorSuspendedAccount = "17"
  2519. )
  2520. //
  2521. // TOC2 Error Codes
  2522. //
  2523. const (
  2524. // Chat Error Codes
  2525. TO2CErrorChatJoinError = "951" // followed by chatroom:SubErrorCode
  2526. TOC2ErrorChatJoinSubErrorReset = "-1"
  2527. TOC2ErrorChatJoinSubErrorChatFull = "24"
  2528. TOC2ErrorChatJoinSubErrorRated = "48"
  2529. TOC2ErrorChatJoinSubErrorEjected = "74"
  2530. )