snacs.go 85 KB

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