snacs.go 103 KB

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