snacs.go 84 KB

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