snacs.go 106 KB

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