snacs.go 74 KB

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