snacs.go 88 KB

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