snacs.go 75 KB

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