snacs.go 84 KB

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