snacs.go 85 KB

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