snacs.go 37 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189
  1. package wire
  2. import (
  3. "bytes"
  4. "errors"
  5. "fmt"
  6. )
  7. // ErrUnsupportedFoodGroup indicates that a foodgroup value is either invalid
  8. // or unsupported by a method.
  9. var ErrUnsupportedFoodGroup = errors.New("foodgroup is unsupported")
  10. //
  11. // Food Group Codes
  12. //
  13. const (
  14. OService uint16 = 0x0001
  15. Locate uint16 = 0x0002
  16. Buddy uint16 = 0x0003
  17. ICBM uint16 = 0x0004
  18. Advert uint16 = 0x0005
  19. Invite uint16 = 0x0006
  20. Admin uint16 = 0x0007
  21. Popup uint16 = 0x0008
  22. PermitDeny uint16 = 0x0009
  23. UserLookup uint16 = 0x000A
  24. Stats uint16 = 0x000B
  25. Translate uint16 = 0x000C
  26. ChatNav uint16 = 0x000D
  27. Chat uint16 = 0x000E
  28. ODir uint16 = 0x000F
  29. BART uint16 = 0x0010
  30. Feedbag uint16 = 0x0013
  31. ICQ uint16 = 0x0015
  32. BUCP uint16 = 0x0017
  33. Alert uint16 = 0x0018
  34. Plugin uint16 = 0x0022
  35. UnnamedFG24 uint16 = 0x0024
  36. MDir uint16 = 0x0025
  37. ARS uint16 = 0x044A
  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. )
  76. //
  77. // Authentication
  78. //
  79. const (
  80. LoginTLVTagsScreenName uint16 = 0x01
  81. LoginTLVTagsRoastedPassword uint16 = 0x02
  82. LoginTLVTagsReconnectHere uint16 = 0x05
  83. LoginTLVTagsAuthorizationCookie uint16 = 0x06
  84. LoginTLVTagsErrorSubcode uint16 = 0x08
  85. LoginTLVTagsPasswordHash uint16 = 0x25
  86. )
  87. const (
  88. LoginErrInvalidUsernameOrPassword uint16 = 0x01
  89. )
  90. //
  91. // 0x01: OService
  92. //
  93. const (
  94. OServiceErr uint16 = 0x0001
  95. OServiceClientOnline uint16 = 0x0002
  96. OServiceHostOnline uint16 = 0x0003
  97. OServiceServiceRequest uint16 = 0x0004
  98. OServiceServiceResponse uint16 = 0x0005
  99. OServiceRateParamsQuery uint16 = 0x0006
  100. OServiceRateParamsReply uint16 = 0x0007
  101. OServiceRateParamsSubAdd uint16 = 0x0008
  102. OServiceRateDelParamSub uint16 = 0x0009
  103. OServiceRateParamChange uint16 = 0x000A
  104. OServicePauseReq uint16 = 0x000B
  105. OServicePauseAck uint16 = 0x000C
  106. OServiceResume uint16 = 0x000D
  107. OServiceUserInfoQuery uint16 = 0x000E
  108. OServiceUserInfoUpdate uint16 = 0x000F
  109. OServiceEvilNotification uint16 = 0x0010
  110. OServiceIdleNotification uint16 = 0x0011
  111. OServiceMigrateGroups uint16 = 0x0012
  112. OServiceMotd uint16 = 0x0013
  113. OServiceSetPrivacyFlags uint16 = 0x0014
  114. OServiceWellKnownUrls uint16 = 0x0015
  115. OServiceNoop uint16 = 0x0016
  116. OServiceClientVersions uint16 = 0x0017
  117. OServiceHostVersions uint16 = 0x0018
  118. OServiceMaxConfigQuery uint16 = 0x0019
  119. OServiceMaxConfigReply uint16 = 0x001A
  120. OServiceStoreConfig uint16 = 0x001B
  121. OServiceConfigQuery uint16 = 0x001C
  122. OServiceConfigReply uint16 = 0x001D
  123. OServiceSetUserInfoFields uint16 = 0x001E
  124. OServiceProbeReq uint16 = 0x001F
  125. OServiceProbeAck uint16 = 0x0020
  126. OServiceBartReply uint16 = 0x0021
  127. OServiceBartQuery2 uint16 = 0x0022
  128. OServiceBartReply2 uint16 = 0x0023
  129. OServiceUserInfoUserFlags uint16 = 0x01
  130. OServiceUserInfoSignonTOD uint16 = 0x03
  131. OServiceUserInfoIdleTime uint16 = 0x04
  132. OServiceUserInfoStatus uint16 = 0x06
  133. OServiceUserInfoOscarCaps uint16 = 0x0D
  134. OServiceUserInfoBARTInfo uint16 = 0x1D
  135. OServiceUserStatusAvailable uint32 = 0x00000000 // user is available
  136. OServiceUserStatusAway uint32 = 0x00000001 // user is away
  137. OServiceUserStatusDND uint32 = 0x00000002 // don't disturb user
  138. OServiceUserStatusOut uint32 = 0x00000004 // user is not available
  139. OServiceUserStatusBusy uint32 = 0x00000010 // user is busy
  140. OServiceUserStatusChat uint32 = 0x00000020 // user is available to chat
  141. OServiceUserStatusInvisible uint32 = 0x00000100 // user is invisible
  142. OServiceUserStatusWebAware uint32 = 0x00010000
  143. OServiceUserStatusHideIP uint32 = 0x00020000
  144. OServiceUserStatusBirthday uint32 = 0x00080000 // user is having a birthday :DDD
  145. OServiceUserStatusICQHomePage uint32 = 0x00200000
  146. OServiceUserStatusDirectRequireAuth uint32 = 0x10000000
  147. OServiceUserFlagOSCARFree uint16 = 0x0010 // AIM (not AOL) account
  148. OServiceUserFlagUnavailable uint16 = 0x0020 // user is away
  149. OServicePrivacyFlagIdle uint32 = 0x00000001
  150. OServicePrivacyFlagMember uint32 = 0x00000002
  151. OServiceTLVTagsReconnectHere uint16 = 0x05
  152. OServiceTLVTagsLoginCookie uint16 = 0x06
  153. OServiceTLVTagsGroupID uint16 = 0x0D
  154. OServiceTLVTagsSSLCertName uint16 = 0x8D
  155. OServiceTLVTagsSSLState uint16 = 0x8E
  156. )
  157. type SNAC_0x01_0x02_OServiceClientOnline struct {
  158. GroupVersions []struct {
  159. FoodGroup uint16
  160. Version uint16
  161. ToolID uint16
  162. ToolVersion uint16
  163. }
  164. }
  165. type SNAC_0x01_0x03_OServiceHostOnline struct {
  166. FoodGroups []uint16
  167. }
  168. type SNAC_0x01_0x04_OServiceServiceRequest struct {
  169. FoodGroup uint16
  170. TLVRestBlock
  171. }
  172. type SNAC_0x01_0x04_TLVRoomInfo struct {
  173. Exchange uint16
  174. Cookie string `len_prefix:"uint8"`
  175. InstanceNumber uint16
  176. }
  177. type SNAC_0x01_0x05_OServiceServiceResponse struct {
  178. TLVRestBlock
  179. }
  180. // SNAC_0x01_0x07_OServiceRateParamsReply contains rate limits for rate classes and groups.
  181. //
  182. // Rate Classes:
  183. // - ID: Unique identifier for the rate class.
  184. // - WindowSize: The number of previously sent commands included in calculating
  185. // the current "rate average."
  186. // - ClearLevel: The threshold the average must reach to clear a rate limit.
  187. // - AlertLevel: The threshold for triggering an alert that tells the client
  188. // that it's getting close to the limit.
  189. // - LimitLevel: SNACs will be dropped if the rate falls below this value.
  190. // - DisconnectLevel: Server will disconnect if the rate falls below this value.
  191. // - CurrentLevel: The current value for the class; higher values are preferable.
  192. // Represents the current "rate average," resembling a moving average of the
  193. // times between each of the last WindowSize commands.
  194. // - MaxLevel: The maximum rate value; if the current value surpasses this,
  195. // it should be reset. The upper limit for a rate average.
  196. // - LastTime: Time elapsed since the last message was received by the server.
  197. // - CurrentState: Indicates whether the server is dropping SNACs for this rate class.
  198. //
  199. // Rate Groups:
  200. // - ID: Unique identifier for the rate group.
  201. // - Pairs: List of SNAC types associated with the rate group, including FoodGroup
  202. // (e.g., wire.ICBM) and SubGroup (e.g., wire.ICBMChannelMsgToHost).
  203. type SNAC_0x01_0x07_OServiceRateParamsReply struct {
  204. RateClasses []struct {
  205. ID uint16
  206. WindowSize uint32
  207. ClearLevel uint32
  208. AlertLevel uint32
  209. LimitLevel uint32
  210. DisconnectLevel uint32
  211. CurrentLevel uint32
  212. MaxLevel uint32
  213. LastTime uint32
  214. CurrentState uint8
  215. } `count_prefix:"uint16"`
  216. RateGroups []struct {
  217. ID uint16
  218. Pairs []struct {
  219. FoodGroup uint16
  220. SubGroup uint16
  221. } `count_prefix:"uint16"`
  222. }
  223. }
  224. type SNAC_0x01_0x08_OServiceRateParamsSubAdd struct {
  225. TLVRestBlock
  226. }
  227. type SNAC_0x01_0x0F_OServiceUserInfoUpdate struct {
  228. TLVUserInfo
  229. }
  230. type SNAC_0x01_0x10_OServiceEvilNotification struct {
  231. NewEvil uint16
  232. TLVUserInfo
  233. }
  234. type SNAC_0x01_0x10_OServiceEvilNotificationAnon struct {
  235. NewEvil uint16
  236. }
  237. type SNAC_0x01_0x11_OServiceIdleNotification struct {
  238. IdleTime uint32
  239. }
  240. type SNAC_0x01_0x14_OServiceSetPrivacyFlags struct {
  241. PrivacyFlags uint32
  242. }
  243. // IdleFlag returns whether other AIM users can see how long the user has been
  244. // idle.
  245. func (s SNAC_0x01_0x14_OServiceSetPrivacyFlags) IdleFlag() bool {
  246. return s.PrivacyFlags&OServicePrivacyFlagIdle == OServicePrivacyFlagIdle
  247. }
  248. // MemberFlag returns whether other AIM users can see how long the user has been
  249. // a member.
  250. func (s SNAC_0x01_0x14_OServiceSetPrivacyFlags) MemberFlag() bool {
  251. return s.PrivacyFlags&OServicePrivacyFlagMember == OServicePrivacyFlagMember
  252. }
  253. type SNAC_0x01_0x17_OServiceClientVersions struct {
  254. Versions []uint16
  255. }
  256. type SNAC_0x01_0x18_OServiceHostVersions struct {
  257. Versions []uint16
  258. }
  259. type SNAC_0x01_0x1E_OServiceSetUserInfoFields struct {
  260. TLVRestBlock
  261. }
  262. type SNAC_0x01_0x21_OServiceBARTReply struct {
  263. BARTID
  264. }
  265. //
  266. // 0x02: Locate
  267. //
  268. const (
  269. LocateErr uint16 = 0x0001
  270. LocateRightsQuery uint16 = 0x0002
  271. LocateRightsReply uint16 = 0x0003
  272. LocateSetInfo uint16 = 0x0004
  273. LocateUserInfoQuery uint16 = 0x0005
  274. LocateUserInfoReply uint16 = 0x0006
  275. LocateWatcherSubRequest uint16 = 0x0007
  276. LocateWatcherNotification uint16 = 0x0008
  277. LocateSetDirInfo uint16 = 0x0009
  278. LocateSetDirReply uint16 = 0x000A
  279. LocateGetDirInfo uint16 = 0x000B
  280. LocateGetDirReply uint16 = 0x000C
  281. LocateGroupCapabilityQuery uint16 = 0x000D
  282. LocateGroupCapabilityReply uint16 = 0x000E
  283. LocateSetKeywordInfo uint16 = 0x000F
  284. LocateSetKeywordReply uint16 = 0x0010
  285. LocateGetKeywordInfo uint16 = 0x0011
  286. LocateGetKeywordReply uint16 = 0x0012
  287. LocateFindListByEmail uint16 = 0x0013
  288. LocateFindListReply uint16 = 0x0014
  289. LocateUserInfoQuery2 uint16 = 0x0015
  290. LocateTypeSig uint32 = 0x00000001
  291. LocateTypeUnavailable uint32 = 0x00000002
  292. LocateTypeCapabilities uint32 = 0x00000004
  293. LocateTypeCerts uint32 = 0x00000008
  294. LocateTypeHtmlInfo uint32 = 0x00000400
  295. LocateTLVTagsInfoSigMime uint16 = 0x01
  296. LocateTLVTagsInfoSigData uint16 = 0x02
  297. LocateTLVTagsInfoUnavailableMime uint16 = 0x03
  298. LocateTLVTagsInfoUnavailableData uint16 = 0x04
  299. LocateTLVTagsInfoCapabilities uint16 = 0x05
  300. LocateTLVTagsInfoCerts uint16 = 0x06
  301. LocateTLVTagsInfoSigTime uint16 = 0x0A
  302. LocateTLVTagsInfoUnavailableTime uint16 = 0x0B
  303. LocateTLVTagsInfoSupportHostSig uint16 = 0x0C
  304. LocateTLVTagsInfoHtmlInfoData uint16 = 0x0E
  305. LocateTLVTagsInfoHtmlInfoType uint16 = 0x0D
  306. // LocateTLVTagsRightsMaxSigLen is the max signature length
  307. LocateTLVTagsRightsMaxSigLen uint16 = 0x01
  308. // LocateTLVTagsRightsMaxCapabilitiesLen is the max allowed # of full UUID capabilities
  309. LocateTLVTagsRightsMaxCapabilitiesLen uint16 = 0x02
  310. // LocateTLVTagsRightsMaxFindByEmailList is the maximum # of email addresses to look up at once
  311. LocateTLVTagsRightsMaxFindByEmailList uint16 = 0x03
  312. // LocateTLVTagsRightsMaxCertsLen is the largest CERT length for e2e crypto
  313. LocateTLVTagsRightsMaxCertsLen uint16 = 0x04
  314. // LocateTLVTagsRightsMaxMaxShortCapabilities is the max allowed # of short UUID capabilities allowed
  315. LocateTLVTagsRightsMaxMaxShortCapabilities uint16 = 0x05
  316. )
  317. type SNAC_0x02_0x03_LocateRightsReply struct {
  318. TLVRestBlock
  319. }
  320. type SNAC_0x02_0x04_LocateSetInfo struct {
  321. TLVRestBlock
  322. }
  323. type SNAC_0x02_0x06_LocateUserInfoReply struct {
  324. TLVUserInfo
  325. LocateInfo TLVRestBlock
  326. }
  327. type SNAC_0x02_0x09_LocateSetDirInfo struct {
  328. TLVRestBlock
  329. }
  330. type SNAC_0x02_0x0A_LocateSetDirReply struct {
  331. Result uint16
  332. }
  333. type SNAC_0x02_0x0B_LocateGetDirInfo struct {
  334. WatcherScreenNames string `len_prefix:"uint8"`
  335. }
  336. type SNAC_0x02_0x0F_LocateSetKeywordInfo struct {
  337. TLVRestBlock
  338. }
  339. type SNAC_0x02_0x10_LocateSetKeywordReply struct {
  340. // Unknown is a field whose purpose is not known
  341. Unknown uint16
  342. }
  343. type SNAC_0x02_0x05_LocateUserInfoQuery struct {
  344. Type uint16
  345. ScreenName string `len_prefix:"uint8"`
  346. }
  347. func (s SNAC_0x02_0x05_LocateUserInfoQuery) RequestProfile() bool {
  348. return s.Type&uint16(LocateTypeSig) == uint16(LocateTypeSig)
  349. }
  350. func (s SNAC_0x02_0x05_LocateUserInfoQuery) RequestAwayMessage() bool {
  351. return s.Type&uint16(LocateTypeUnavailable) == uint16(LocateTypeUnavailable)
  352. }
  353. type SNAC_0x02_0x15_LocateUserInfoQuery2 struct {
  354. Type2 uint32
  355. ScreenName string `len_prefix:"uint8"`
  356. }
  357. //
  358. // 0x03: Buddy
  359. //
  360. const (
  361. BuddyErr uint16 = 0x0001
  362. BuddyRightsQuery uint16 = 0x0002
  363. BuddyRightsReply uint16 = 0x0003
  364. BuddyAddBuddies uint16 = 0x0004
  365. BuddyDelBuddies uint16 = 0x0005
  366. BuddyWatcherListQuery uint16 = 0x0006
  367. BuddyWatcherListResponse uint16 = 0x0007
  368. BuddyWatcherSubRequest uint16 = 0x0008
  369. BuddyWatcherNotification uint16 = 0x0009
  370. BuddyRejectNotification uint16 = 0x000A
  371. BuddyArrived uint16 = 0x000B
  372. BuddyDeparted uint16 = 0x000C
  373. BuddyAddTempBuddies uint16 = 0x000F
  374. BuddyDelTempBuddies uint16 = 0x0010
  375. BuddyTLVTagsParmMaxBuddies uint16 = 0x01
  376. BuddyTLVTagsParmMaxWatchers uint16 = 0x02
  377. BuddyTLVTagsParmMaxIcqBroad uint16 = 0x03
  378. BuddyTLVTagsParmMaxTempBuddies uint16 = 0x04
  379. )
  380. type SNAC_0x03_0x02_BuddyRightsQuery struct {
  381. TLVRestBlock
  382. }
  383. type SNAC_0x03_0x03_BuddyRightsReply struct {
  384. TLVRestBlock
  385. }
  386. type SNAC_0x03_0x04_BuddyAddBuddies struct {
  387. Buddies []struct {
  388. ScreenName string `len_prefix:"uint8"`
  389. }
  390. }
  391. type SNAC_0x03_0x05_BuddyDelBuddies struct {
  392. Buddies []struct {
  393. ScreenName string `len_prefix:"uint8"`
  394. }
  395. }
  396. type SNAC_0x03_0x0B_BuddyArrived struct {
  397. TLVUserInfo
  398. }
  399. type SNAC_0x03_0x0C_BuddyDeparted struct {
  400. TLVUserInfo
  401. }
  402. //
  403. // 0x04: ICBM
  404. //
  405. const (
  406. ICBMErr uint16 = 0x0001
  407. ICBMAddParameters uint16 = 0x0002
  408. ICBMDelParameters uint16 = 0x0003
  409. ICBMParameterQuery uint16 = 0x0004
  410. ICBMParameterReply uint16 = 0x0005
  411. ICBMChannelMsgToHost uint16 = 0x0006
  412. ICBMChannelMsgToClient uint16 = 0x0007
  413. ICBMEvilRequest uint16 = 0x0008
  414. ICBMEvilReply uint16 = 0x0009
  415. ICBMMissedCalls uint16 = 0x000A
  416. ICBMClientErr uint16 = 0x000B
  417. ICBMHostAck uint16 = 0x000C
  418. ICBMSinStored uint16 = 0x000D
  419. ICBMSinListQuery uint16 = 0x000E
  420. ICBMSinListReply uint16 = 0x000F
  421. ICBMSinRetrieve uint16 = 0x0010
  422. ICBMSinDelete uint16 = 0x0011
  423. ICBMNotifyRequest uint16 = 0x0012
  424. ICBMNotifyReply uint16 = 0x0013
  425. ICBMClientEvent uint16 = 0x0014
  426. ICBMSinReply uint16 = 0x0017
  427. ICBMTLVAOLIMData uint16 = 0x02
  428. ICBMTLVRequestHostAck uint16 = 0x03
  429. ICBMTLVAutoResponse uint16 = 0x04
  430. ICBMTLVData uint16 = 0x05
  431. ICBMTLVStore uint16 = 0x06
  432. ICBMTLVICQblob uint16 = 0x07
  433. ICBMTLVAvatarInfo uint16 = 0x08
  434. ICBMTLVWantAvatar uint16 = 0x09
  435. ICBMTLVMultiUser uint16 = 0x0A
  436. ICBMTLVWantEvents uint16 = 0x0B
  437. ICBMTLVSubscriptions uint16 = 0x0C
  438. ICBMTLVBART uint16 = 0x0D
  439. ICBMTLVHostImID uint16 = 0x10
  440. ICBMTLVHostImArgs uint16 = 0x11
  441. ICBMTLVSendTime uint16 = 0x16
  442. ICBMTLVFriendlyName uint16 = 0x17
  443. ICBMTLVAnonymous uint16 = 0x18
  444. ICBMTLVWidgetName uint16 = 0x19
  445. ICBMMessageEncodingASCII uint16 = 0x00 // ANSI ASCII -- ISO 646
  446. ICBMMessageEncodingUnicode uint16 = 0x02 // ISO 10646.USC-2 Unicode
  447. ICBMMessageEncodingLatin1 uint16 = 0x03 // ISO 8859-1
  448. )
  449. // ICBMFragment represents an ICBM message component.
  450. type ICBMFragment struct {
  451. ID uint8
  452. Version uint8
  453. Payload []byte `len_prefix:"uint16"`
  454. }
  455. // ICBMMessage represents the text component of an ICBM message.
  456. type ICBMMessage struct {
  457. Charset uint16
  458. Language uint16
  459. Text []byte
  460. }
  461. type SNAC_0x04_0x02_ICBMAddParameters struct {
  462. Channel uint16
  463. ICBMFlags uint32
  464. MaxIncomingICBMLen uint16
  465. MaxSourceEvil uint16
  466. MaxDestinationEvil uint16
  467. MinInterICBMInterval uint32
  468. }
  469. type SNAC_0x04_0x05_ICBMParameterReply struct {
  470. MaxSlots uint16
  471. ICBMFlags uint32
  472. MaxIncomingICBMLen uint16
  473. MaxSourceEvil uint16
  474. MaxDestinationEvil uint16
  475. MinInterICBMInterval uint32
  476. }
  477. type SNAC_0x04_0x06_ICBMChannelMsgToHost struct {
  478. Cookie uint64
  479. ChannelID uint16
  480. ScreenName string `len_prefix:"uint8"`
  481. TLVRestBlock
  482. }
  483. // ComposeMessage inserts message text into SNAC(0x04,0x06). It populates TLV
  484. // 0x02 with fragments that contain the message text and requisite metadata.
  485. func (m *SNAC_0x04_0x06_ICBMChannelMsgToHost) ComposeMessage(text string) error {
  486. msg := ICBMMessage{
  487. Charset: ICBMMessageEncodingASCII,
  488. Language: 0, // not clear what this means, but it works
  489. Text: []byte(text),
  490. }
  491. msgBuf := bytes.Buffer{}
  492. if err := Marshal(msg, &msgBuf); err != nil {
  493. return fmt.Errorf("unable to marshal ICBM message: %w", err)
  494. }
  495. m.Append(NewTLV(ICBMTLVAOLIMData, []ICBMFragment{
  496. {
  497. ID: 5, // 5 = capabilities
  498. Version: 1,
  499. Payload: []byte{1, 1, 2}, // 1 = text
  500. },
  501. {
  502. ID: 1, // 1 = message text
  503. Version: 1,
  504. Payload: msgBuf.Bytes(),
  505. },
  506. }))
  507. return nil
  508. }
  509. type SNAC_0x04_0x07_ICBMChannelMsgToClient struct {
  510. Cookie uint64
  511. ChannelID uint16
  512. TLVUserInfo
  513. TLVRestBlock
  514. }
  515. // ExtractMessageText extracts the message text from SNAC(0x04,0x07).
  516. func (s SNAC_0x04_0x07_ICBMChannelMsgToClient) ExtractMessageText() (string, error) {
  517. fragment, ok := s.Slice(ICBMTLVAOLIMData)
  518. if !ok {
  519. return "", errors.New("ICBM message does not contain a fragment")
  520. }
  521. var frags []ICBMFragment
  522. if err := Unmarshal(&frags, bytes.NewBuffer(fragment)); err != nil {
  523. return "", fmt.Errorf("unable to unmarshal ICBM fragment: %w", err)
  524. }
  525. for _, frag := range frags {
  526. if frag.ID == 1 { // 1 = message text
  527. msg := ICBMMessage{}
  528. err := Unmarshal(&msg, bytes.NewBuffer(frag.Payload))
  529. if err != nil {
  530. err = fmt.Errorf("unable to unmarshal ICBM message: %w", err)
  531. }
  532. return string(msg.Text), err
  533. }
  534. }
  535. return "", errors.New("unable to find message fragment")
  536. }
  537. type SNAC_0x04_0x08_ICBMEvilRequest struct {
  538. SendAs uint16
  539. ScreenName string `len_prefix:"uint8"`
  540. }
  541. type SNAC_0x04_0x09_ICBMEvilReply struct {
  542. EvilDeltaApplied uint16
  543. UpdatedEvilValue uint16
  544. }
  545. type SNAC_0x04_0x0B_ICBMClientErr struct {
  546. Cookie uint64
  547. ChannelID uint16
  548. ScreenName string `len_prefix:"uint8"`
  549. Code uint16
  550. ErrInfo []byte
  551. }
  552. type SNAC_0x04_0x0C_ICBMHostAck struct {
  553. Cookie uint64
  554. ChannelID uint16
  555. ScreenName string `len_prefix:"uint8"`
  556. }
  557. type SNAC_0x04_0x14_ICBMClientEvent struct {
  558. Cookie uint64
  559. ChannelID uint16
  560. ScreenName string `len_prefix:"uint8"`
  561. Event uint16
  562. }
  563. //
  564. // 0x09: PermitDeny
  565. //
  566. const (
  567. PermitDenyErr uint16 = 0x0001
  568. PermitDenyRightsQuery uint16 = 0x0002
  569. PermitDenyRightsReply uint16 = 0x0003
  570. PermitDenySetGroupPermitMask uint16 = 0x0004
  571. PermitDenyAddPermListEntries uint16 = 0x0005
  572. PermitDenyDelPermListEntries uint16 = 0x0006
  573. PermitDenyAddDenyListEntries uint16 = 0x0007
  574. PermitDenyDelDenyListEntries uint16 = 0x0008
  575. PermitDenyBosErr uint16 = 0x0009
  576. PermitDenyAddTempPermitListEntries uint16 = 0x000A
  577. PermitDenyDelTempPermitListEntries uint16 = 0x000B
  578. PermitDenyTLVMaxPermits uint16 = 0x01
  579. PermitDenyTLVMaxDenies uint16 = 0x02
  580. PermitDenyTLVMaxTempPermits uint16 = 0x03
  581. )
  582. type SNAC_0x09_0x03_PermitDenyRightsReply struct {
  583. TLVRestBlock
  584. }
  585. //
  586. // 0x0D: ChatNav
  587. //
  588. const (
  589. ChatNavErr uint16 = 0x0001
  590. ChatNavRequestChatRights uint16 = 0x0002
  591. ChatNavRequestExchangeInfo uint16 = 0x0003
  592. ChatNavRequestRoomInfo uint16 = 0x0004
  593. ChatNavRequestMoreRoomInfo uint16 = 0x0005
  594. ChatNavRequestOccupantList uint16 = 0x0006
  595. ChatNavSearchForRoom uint16 = 0x0007
  596. ChatNavCreateRoom uint16 = 0x0008
  597. ChatNavNavInfo uint16 = 0x0009
  598. ChatNavTLVMaxConcurrentRooms uint16 = 0x0002
  599. ChatNavTLVExchangeInfo uint16 = 0x0003
  600. ChatNavTLVRoomInfo uint16 = 0x0004
  601. )
  602. type SNAC_0x0D_0x03_ChatNavRequestExchangeInfo struct {
  603. Exchange uint16
  604. }
  605. type SNAC_0x0D_0x04_ChatNavRequestRoomInfo struct {
  606. Exchange uint16
  607. Cookie string `len_prefix:"uint8"`
  608. InstanceNumber uint16
  609. DetailLevel uint8
  610. }
  611. type SNAC_0x0D_0x09_ChatNavNavInfo struct {
  612. TLVRestBlock
  613. }
  614. type SNAC_0x0D_0x09_TLVExchangeInfo struct {
  615. Identifier uint16
  616. TLVBlock
  617. }
  618. //
  619. // 0x0E: Chat
  620. //
  621. const (
  622. ChatErr uint16 = 0x0001
  623. ChatRoomInfoUpdate uint16 = 0x0002
  624. ChatUsersJoined uint16 = 0x0003
  625. ChatUsersLeft uint16 = 0x0004
  626. ChatChannelMsgToHost uint16 = 0x0005
  627. ChatChannelMsgToClient uint16 = 0x0006
  628. ChatEvilRequest uint16 = 0x0007
  629. ChatEvilReply uint16 = 0x0008
  630. ChatClientErr uint16 = 0x0009
  631. ChatPauseRoomReq uint16 = 0x000A
  632. ChatPauseRoomAck uint16 = 0x000B
  633. ChatResumeRoom uint16 = 0x000C
  634. ChatShowMyRow uint16 = 0x000D
  635. ChatShowRowByUsername uint16 = 0x000E
  636. ChatShowRowByNumber uint16 = 0x000F
  637. ChatShowRowByName uint16 = 0x0010
  638. ChatRowInfo uint16 = 0x0011
  639. ChatListRows uint16 = 0x0012
  640. ChatRowListInfo uint16 = 0x0013
  641. ChatMoreRows uint16 = 0x0014
  642. ChatMoveToRow uint16 = 0x0015
  643. ChatToggleChat uint16 = 0x0016
  644. ChatSendQuestion uint16 = 0x0017
  645. ChatSendComment uint16 = 0x0018
  646. ChatTallyVote uint16 = 0x0019
  647. ChatAcceptBid uint16 = 0x001A
  648. ChatSendInvite uint16 = 0x001B
  649. ChatDeclineInvite uint16 = 0x001C
  650. ChatAcceptInvite uint16 = 0x001D
  651. ChatNotifyMessage uint16 = 0x001E
  652. ChatGotoRow uint16 = 0x001F
  653. ChatStageUserJoin uint16 = 0x0020
  654. ChatStageUserLeft uint16 = 0x0021
  655. ChatUnnamedSnac22 uint16 = 0x0022
  656. ChatClose uint16 = 0x0023
  657. ChatUserBan uint16 = 0x0024
  658. ChatUserUnban uint16 = 0x0025
  659. ChatJoined uint16 = 0x0026
  660. ChatUnnamedSnac27 uint16 = 0x0027
  661. ChatUnnamedSnac28 uint16 = 0x0028
  662. ChatUnnamedSnac29 uint16 = 0x0029
  663. ChatRoomInfoOwner uint16 = 0x0030
  664. ChatTLVPublicWhisperFlag uint16 = 0x01
  665. ChatTLVSenderInformation uint16 = 0x03
  666. ChatTLVMessageInformation uint16 = 0x05
  667. ChatTLVEnableReflectionFlag uint16 = 0x06
  668. // referenced from protocols/oscar/family_chatnav.c in lib purple
  669. ChatRoomTLVClassPerms uint16 = 0x02
  670. ChatRoomTLVMaxConcurrentRooms uint16 = 0x03 // required by aim 2.x-3.x
  671. ChatRoomTLVMaxNameLen uint16 = 0x04
  672. ChatRoomTLVFullyQualifiedName uint16 = 0x6A
  673. ChatRoomTLVCreateTime uint16 = 0xCA
  674. ChatRoomTLVFlags uint16 = 0xC9
  675. ChatRoomTLVMaxMsgLen uint16 = 0xD1
  676. ChatRoomTLVMaxOccupancy uint16 = 0xD2
  677. ChatRoomTLVRoomName uint16 = 0xD3
  678. ChatRoomTLVNavCreatePerms uint16 = 0xD5
  679. ChatRoomTLVCharSet1 uint16 = 0xD6
  680. ChatRoomTLVLang1 uint16 = 0xD7
  681. ChatRoomTLVCharSet2 uint16 = 0xD8
  682. ChatRoomTLVLang2 uint16 = 0xD9
  683. )
  684. type SNAC_0x0E_0x02_ChatRoomInfoUpdate struct {
  685. Exchange uint16
  686. Cookie string `len_prefix:"uint8"`
  687. InstanceNumber uint16
  688. DetailLevel uint8
  689. TLVBlock
  690. }
  691. type SNAC_0x0E_0x03_ChatUsersJoined struct {
  692. Users []TLVUserInfo
  693. }
  694. type SNAC_0x0E_0x04_ChatUsersLeft struct {
  695. Users []TLVUserInfo
  696. }
  697. type SNAC_0x0E_0x05_ChatChannelMsgToHost struct {
  698. Cookie uint64
  699. Channel uint16
  700. TLVRestBlock
  701. }
  702. type SNAC_0x0E_0x06_ChatChannelMsgToClient struct {
  703. Cookie uint64
  704. Channel uint16
  705. TLVRestBlock
  706. }
  707. //
  708. // 0x10: BART
  709. //
  710. //
  711. const (
  712. BARTTypesBuddyIconSmall uint16 = 0x00
  713. BARTTypesBuddyIcon uint16 = 0x01
  714. BARTTypesStatusStr uint16 = 0x02
  715. BARTTypesArriveSound uint16 = 0x03
  716. BARTTypesRichName uint16 = 0x04
  717. BARTTypesSuperIcon uint16 = 0x05
  718. BARTTypesRadioStation uint16 = 0x06
  719. BARTTypesSuperIconTrigger uint16 = 0x07
  720. BARTTypesStatusTextLink uint16 = 0x09
  721. BARTTypesLocation uint16 = 0x0B
  722. BARTTypesBuddyIconBig uint16 = 0x0C
  723. BARTTypesStatusTextTimestamp uint16 = 0x0D
  724. BARTTypesCurrentAvtrack uint16 = 0x0F
  725. BARTTypesDepartSound uint16 = 0x60
  726. BARTTypesImBackground uint16 = 0x80
  727. BARTTypesImChrome uint16 = 0x81
  728. BARTTypesImSkin uint16 = 0x82
  729. BARTTypesImSound uint16 = 0x83
  730. BARTTypesBadge uint16 = 0x84
  731. BARTTypesBadgeUrl uint16 = 0x85
  732. BARTTypesImInitialSound uint16 = 0x86
  733. BARTTypesFlashWallpaper uint16 = 0x88
  734. BARTTypesImmersiveWallpaper uint16 = 0x89
  735. BARTTypesBuddylistBackground uint16 = 0x100
  736. BARTTypesBuddylistImage uint16 = 0x101
  737. BARTTypesBuddylistSkin uint16 = 0x102
  738. BARTTypesSmileySet uint16 = 0x400
  739. BARTTypesEncrCertChain uint16 = 0x402
  740. BARTTypesSignCertChain uint16 = 0x403
  741. BARTTypesGatewayCert uint16 = 0x404
  742. )
  743. const (
  744. BARTErr uint16 = 0x0001
  745. BARTUploadQuery uint16 = 0x0002
  746. BARTUploadReply uint16 = 0x0003
  747. BARTDownloadQuery uint16 = 0x0004
  748. BARTDownloadReply uint16 = 0x0005
  749. BARTDownload2Query uint16 = 0x0006
  750. BARTDownload2Reply uint16 = 0x0007
  751. )
  752. const (
  753. BARTFlagsKnown uint8 = 0x00
  754. BARTFlagsCustom uint8 = 0x01
  755. BARTFlagsUrl uint8 = 0x02
  756. BARTFlagsData uint8 = 0x04
  757. BARTFlagsUnknown uint8 = 0x40
  758. BARTFlagsRedirect uint8 = 0x80
  759. BARTFlagsBanned uint8 = 0xC0
  760. )
  761. const (
  762. BARTReplyCodesSuccess uint8 = 0x00
  763. BARTReplyCodesInvalid uint8 = 0x01
  764. BARTReplyCodesNoCustom uint8 = 0x02
  765. BARTReplyCodesTooSmall uint8 = 0x03
  766. BARTReplyCodesTooBig uint8 = 0x04
  767. BARTReplyCodesInvalidType uint8 = 0x05
  768. BARTReplyCodesBanned uint8 = 0x06
  769. BARTReplyCodesNotfound uint8 = 0x07
  770. )
  771. // GetClearIconHash returns an opaque value set in BARTID hash that indicates
  772. // the user wants to clear their buddy icon.
  773. func GetClearIconHash() []byte {
  774. return []byte{0x02, 0x01, 0xd2, 0x04, 0x72}
  775. }
  776. // BARTInfo represents a BART feedbag item
  777. type BARTInfo struct {
  778. Flags uint8
  779. Hash []byte `len_prefix:"uint8"`
  780. }
  781. // HasClearIconHash reports whether the BART ID hash contains the
  782. // ClearIconHash sentinel value.
  783. func (h BARTInfo) HasClearIconHash() bool {
  784. return bytes.Equal(h.Hash, GetClearIconHash())
  785. }
  786. type BARTID struct {
  787. Type uint16
  788. BARTInfo
  789. }
  790. type SNAC_0x10_0x02_BARTUploadQuery struct {
  791. Type uint16
  792. Data []byte `len_prefix:"uint16"`
  793. }
  794. type SNAC_0x10_0x03_BARTUploadReply struct {
  795. Code uint8
  796. ID BARTID
  797. }
  798. type SNAC_0x10_0x04_BARTDownloadQuery struct {
  799. ScreenName string `len_prefix:"uint8"`
  800. Command uint8
  801. BARTID
  802. }
  803. type SNAC_0x10_0x05_BARTDownloadReply struct {
  804. ScreenName string `len_prefix:"uint8"`
  805. BARTID BARTID
  806. Data []byte `len_prefix:"uint16"`
  807. }
  808. // 0x13: Feedbag
  809. //
  810. const (
  811. FeedbagClassIdBuddy uint16 = 0x0000
  812. FeedbagClassIdGroup uint16 = 0x0001
  813. FeedbagClassIDPermit uint16 = 0x0002
  814. FeedbagClassIDDeny uint16 = 0x0003
  815. FeedbagClassIdPdinfo uint16 = 0x0004
  816. FeedbagClassIdBuddyPrefs uint16 = 0x0005
  817. FeedbagClassIdNonbuddy uint16 = 0x0006
  818. FeedbagClassIdTpaProvider uint16 = 0x0007
  819. FeedbagClassIdTpaSubscription uint16 = 0x0008
  820. FeedbagClassIdClientPrefs uint16 = 0x0009
  821. FeedbagClassIdStock uint16 = 0x000A
  822. FeedbagClassIdWeather uint16 = 0x000B
  823. FeedbagClassIdWatchList uint16 = 0x000D
  824. FeedbagClassIdIgnoreList uint16 = 0x000E
  825. FeedbagClassIdDateTime uint16 = 0x000F
  826. FeedbagClassIdExternalUser uint16 = 0x0010
  827. FeedbagClassIdRootCreator uint16 = 0x0011
  828. FeedbagClassIdFish uint16 = 0x0012
  829. FeedbagClassIdImportTimestamp uint16 = 0x0013
  830. FeedbagClassIdBart uint16 = 0x0014
  831. FeedbagClassIdRbOrder uint16 = 0x0015
  832. FeedbagClassIdPersonality uint16 = 0x0016
  833. FeedbagClassIdAlProf uint16 = 0x0017
  834. FeedbagClassIdAlInfo uint16 = 0x0018
  835. FeedbagClassIdInteraction uint16 = 0x0019
  836. FeedbagClassIdVanityInfo uint16 = 0x001D
  837. FeedbagClassIdFavoriteLocation uint16 = 0x001E
  838. FeedbagClassIdBartPdinfo uint16 = 0x001F
  839. FeedbagClassIdCustomEmoticons uint16 = 0x0024
  840. FeedbagClassIdMaxPredefined uint16 = 0x0024
  841. FeedbagClassIdXIcqStatusNote uint16 = 0x015C
  842. FeedbagClassIdMin uint16 = 0x0400
  843. FeedbagAttributesShared uint16 = 0x0064
  844. FeedbagAttributesInvited uint16 = 0x0065
  845. FeedbagAttributesPending uint16 = 0x0066
  846. FeedbagAttributesTimeT uint16 = 0x0067
  847. FeedbagAttributesDenied uint16 = 0x0068
  848. FeedbagAttributesSwimIndex uint16 = 0x0069
  849. FeedbagAttributesRecentBuddy uint16 = 0x006A
  850. FeedbagAttributesAutoBot uint16 = 0x006B
  851. FeedbagAttributesInteraction uint16 = 0x006D
  852. FeedbagAttributesMegaBot uint16 = 0x006F
  853. FeedbagAttributesOrder uint16 = 0x00C8
  854. FeedbagAttributesBuddyPrefs uint16 = 0x00C9
  855. FeedbagAttributesPdMode uint16 = 0x00CA
  856. FeedbagAttributesPdMask uint16 = 0x00CB
  857. FeedbagAttributesPdFlags uint16 = 0x00CC
  858. FeedbagAttributesClientPrefs uint16 = 0x00CD
  859. FeedbagAttributesLanguage uint16 = 0x00CE
  860. FeedbagAttributesFishUri uint16 = 0x00CF
  861. FeedbagAttributesWirelessPdMode uint16 = 0x00D0
  862. FeedbagAttributesWirelessIgnoreMode uint16 = 0x00D1
  863. FeedbagAttributesFishPdMode uint16 = 0x00D2
  864. FeedbagAttributesFishIgnoreMode uint16 = 0x00D3
  865. FeedbagAttributesCreateTime uint16 = 0x00D4
  866. FeedbagAttributesBartInfo uint16 = 0x00D5
  867. FeedbagAttributesBuddyPrefsValid uint16 = 0x00D6
  868. FeedbagAttributesBuddyPrefs2 uint16 = 0x00D7
  869. FeedbagAttributesBuddyPrefs2Valid uint16 = 0x00D8
  870. FeedbagAttributesBartList uint16 = 0x00D9
  871. FeedbagAttributesArriveSound uint16 = 0x012C
  872. FeedbagAttributesLeaveSound uint16 = 0x012D
  873. FeedbagAttributesImage uint16 = 0x012E
  874. FeedbagAttributesColorBg uint16 = 0x012F
  875. FeedbagAttributesColorFg uint16 = 0x0130
  876. FeedbagAttributesAlias uint16 = 0x0131
  877. FeedbagAttributesPassword uint16 = 0x0132
  878. FeedbagAttributesDisabled uint16 = 0x0133
  879. FeedbagAttributesCollapsed uint16 = 0x0134
  880. FeedbagAttributesUrl uint16 = 0x0135
  881. FeedbagAttributesActiveList uint16 = 0x0136
  882. FeedbagAttributesEmailAddr uint16 = 0x0137
  883. FeedbagAttributesPhoneNumber uint16 = 0x0138
  884. FeedbagAttributesCellPhoneNumber uint16 = 0x0139
  885. FeedbagAttributesSmsPhoneNumber uint16 = 0x013A
  886. FeedbagAttributesWireless uint16 = 0x013B
  887. FeedbagAttributesNote uint16 = 0x013C
  888. FeedbagAttributesAlertPrefs uint16 = 0x013D
  889. FeedbagAttributesBudalertSound uint16 = 0x013E
  890. FeedbagAttributesStockalertValue uint16 = 0x013F
  891. FeedbagAttributesTpalertEditUrl uint16 = 0x0140
  892. FeedbagAttributesTpalertDeleteUrl uint16 = 0x0141
  893. FeedbagAttributesTpprovMorealertsUrl uint16 = 0x0142
  894. FeedbagAttributesFish uint16 = 0x0143
  895. FeedbagAttributesXunconfirmedxLastAccess uint16 = 0x0145
  896. FeedbagAttributesImSent uint16 = 0x0150
  897. FeedbagAttributesOnlineTime uint16 = 0x0151
  898. FeedbagAttributesAwayMsg uint16 = 0x0152
  899. FeedbagAttributesImReceived uint16 = 0x0153
  900. FeedbagAttributesBuddyfeedView uint16 = 0x0154
  901. FeedbagAttributesWorkPhoneNumber uint16 = 0x0158
  902. FeedbagAttributesOtherPhoneNumber uint16 = 0x0159
  903. FeedbagAttributesWebPdMode uint16 = 0x015F
  904. FeedbagAttributesFirstCreationTimeXc uint16 = 0x0167
  905. FeedbagAttributesPdModeXc uint16 = 0x016E
  906. FeedbagRightsMaxClassAttrs uint16 = 0x02
  907. FeedbagRightsMaxItemAttrs uint16 = 0x03
  908. FeedbagRightsMaxItemsByClass uint16 = 0x04
  909. FeedbagRightsMaxClientItems uint16 = 0x05
  910. FeedbagRightsMaxItemNameLen uint16 = 0x06
  911. FeedbagRightsMaxRecentBuddies uint16 = 0x07
  912. FeedbagRightsInteractionBuddies uint16 = 0x08
  913. FeedbagRightsInteractionHalfLife uint16 = 0x09
  914. FeedbagRightsInteractionMaxScore uint16 = 0x0A
  915. FeedbagRightsMaxUnknown0b uint16 = 0x0B
  916. FeedbagRightsMaxBuddiesPerGroup uint16 = 0x0C
  917. FeedbagRightsMaxMegaBots uint16 = 0x0D
  918. FeedbagRightsMaxSmartGroups uint16 = 0x0E
  919. FeedbagErr uint16 = 0x0001
  920. FeedbagRightsQuery uint16 = 0x0002
  921. FeedbagRightsReply uint16 = 0x0003
  922. FeedbagQuery uint16 = 0x0004
  923. FeedbagQueryIfModified uint16 = 0x0005
  924. FeedbagReply uint16 = 0x0006
  925. FeedbagUse uint16 = 0x0007
  926. FeedbagInsertItem uint16 = 0x0008
  927. FeedbagUpdateItem uint16 = 0x0009
  928. FeedbagDeleteItem uint16 = 0x000A
  929. FeedbagInsertClass uint16 = 0x000B
  930. FeedbagUpdateClass uint16 = 0x000C
  931. FeedbagDeleteClass uint16 = 0x000D
  932. FeedbagStatus uint16 = 0x000E
  933. FeedbagReplyNotModified uint16 = 0x000F
  934. FeedbagDeleteUser uint16 = 0x0010
  935. FeedbagStartCluster uint16 = 0x0011
  936. FeedbagEndCluster uint16 = 0x0012
  937. FeedbagAuthorizeBuddy uint16 = 0x0013
  938. FeedbagPreAuthorizeBuddy uint16 = 0x0014
  939. FeedbagPreAuthorizedBuddy uint16 = 0x0015
  940. FeedbagRemoveMe uint16 = 0x0016
  941. FeedbagRemoveMe2 uint16 = 0x0017
  942. FeedbagRequestAuthorizeToHost uint16 = 0x0018
  943. FeedbagRequestAuthorizeToClient uint16 = 0x0019
  944. FeedbagRespondAuthorizeToHost uint16 = 0x001A
  945. FeedbagRespondAuthorizeToClient uint16 = 0x001B
  946. FeedbagBuddyAdded uint16 = 0x001C
  947. FeedbagRequestAuthorizeToBadog uint16 = 0x001D
  948. FeedbagRespondAuthorizeToBadog uint16 = 0x001E
  949. FeedbagBuddyAddedToBadog uint16 = 0x001F
  950. FeedbagTestSnac uint16 = 0x0021
  951. FeedbagForwardMsg uint16 = 0x0022
  952. FeedbagIsAuthRequiredQuery uint16 = 0x0023
  953. FeedbagIsAuthRequiredReply uint16 = 0x0024
  954. FeedbagRecentBuddyUpdate uint16 = 0x0025
  955. )
  956. type SNAC_0x13_0x02_FeedbagRightsQuery struct {
  957. TLVRestBlock
  958. }
  959. type SNAC_0x13_0x03_FeedbagRightsReply struct {
  960. TLVRestBlock
  961. }
  962. type SNAC_0x13_0x05_FeedbagQueryIfModified struct {
  963. LastUpdate uint32
  964. Count uint8
  965. }
  966. type SNAC_0x13_0x06_FeedbagReply struct {
  967. Version uint8
  968. Items []FeedbagItem `count_prefix:"uint16"`
  969. LastUpdate uint32
  970. }
  971. type SNAC_0x13_0x08_FeedbagInsertItem struct {
  972. Items []FeedbagItem
  973. }
  974. type SNAC_0x13_0x09_FeedbagUpdateItem struct {
  975. Items []FeedbagItem
  976. }
  977. type SNAC_0x13_0x0A_FeedbagDeleteItem struct {
  978. Items []FeedbagItem
  979. }
  980. type SNAC_0x13_0x0E_FeedbagStatus struct {
  981. Results []uint16
  982. }
  983. type SNAC_0x13_0x11_FeedbagStartCluster struct {
  984. TLVRestBlock
  985. }
  986. //
  987. // 0x17: BUCP
  988. //
  989. const (
  990. BUCPErr uint16 = 0x0001
  991. BUCPLoginRequest uint16 = 0x0002
  992. BUCPLoginResponse uint16 = 0x0003
  993. BUCPRegisterRequest uint16 = 0x0004
  994. BUCPChallengeRequest uint16 = 0x0006
  995. BUCPChallengeResponse uint16 = 0x0007
  996. BUCPAsasnRequest uint16 = 0x0008
  997. BUCPSecuridRequest uint16 = 0x000A
  998. BUCPRegistrationImageRequest uint16 = 0x000C
  999. )
  1000. type SNAC_0x17_0x02_BUCPLoginRequest struct {
  1001. TLVRestBlock
  1002. }
  1003. type SNAC_0x17_0x03_BUCPLoginResponse struct {
  1004. TLVRestBlock
  1005. }
  1006. type SNAC_0x17_0x06_BUCPChallengeRequest struct {
  1007. TLVRestBlock
  1008. }
  1009. type SNAC_0x17_0x07_BUCPChallengeResponse struct {
  1010. AuthKey string `len_prefix:"uint16"`
  1011. }
  1012. //
  1013. // 0x18: Alert
  1014. //
  1015. const (
  1016. AlertErr uint16 = 0x0001
  1017. AlertSetAlertRequest uint16 = 0x0002
  1018. AlertSetAlertReply uint16 = 0x0003
  1019. AlertGetSubsRequest uint16 = 0x0004
  1020. AlertGetSubsResponse uint16 = 0x0005
  1021. AlertNotifyCapabilities uint16 = 0x0006
  1022. AlertNotify uint16 = 0x0007
  1023. AlertGetRuleRequest uint16 = 0x0008
  1024. AlertGetRuleReply uint16 = 0x0009
  1025. AlertGetFeedRequest uint16 = 0x000A
  1026. AlertGetFeedReply uint16 = 0x000B
  1027. AlertRefreshFeed uint16 = 0x000D
  1028. AlertEvent uint16 = 0x000E
  1029. AlertQogSnac uint16 = 0x000F
  1030. AlertRefreshFeedStock uint16 = 0x0010
  1031. AlertNotifyTransport uint16 = 0x0011
  1032. AlertSetAlertRequestV2 uint16 = 0x0012
  1033. AlertSetAlertReplyV2 uint16 = 0x0013
  1034. AlertTransitReply uint16 = 0x0014
  1035. AlertNotifyAck uint16 = 0x0015
  1036. AlertNotifyDisplayCapabilities uint16 = 0x0016
  1037. AlertUserOnline uint16 = 0x0017
  1038. )
  1039. type TLVUserInfo struct {
  1040. ScreenName string `len_prefix:"uint8"`
  1041. WarningLevel uint16
  1042. TLVBlock
  1043. }
  1044. type FeedbagItem struct {
  1045. Name string `len_prefix:"uint16"`
  1046. GroupID uint16
  1047. ItemID uint16
  1048. ClassID uint16
  1049. TLVLBlock
  1050. }