snacs.go 88 KB

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