snacs.go 103 KB

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