wire_legacy_commands.go 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. package icq_legacy
  2. // ICQ Legacy Protocol Command Constants
  3. // Ported from iserverd v3_defines.h and v5_defines.h
  4. // Protocol version identifiers
  5. const (
  6. ICQLegacyVersionV1 uint16 = 0x0001 // Early ICQ clients (same wire format as V2)
  7. ICQLegacyVersionV2 uint16 = 0x0002
  8. ICQLegacyVersionV3 uint16 = 0x0003
  9. ICQLegacyVersionV4 uint16 = 0x0004
  10. ICQLegacyVersionV5 uint16 = 0x0005
  11. )
  12. // Client Commands (received from client)
  13. const (
  14. // Common commands (V2-V5)
  15. ICQLegacyCmdAck uint16 = 0x000A // Acknowledgment
  16. ICQLegacyCmdThruServer uint16 = 0x010E // Send message through server
  17. ICQLegacyCmdReconnect uint16 = 0x015E // Reconnect request
  18. ICQLegacyCmdLogin uint16 = 0x03E8 // Login request
  19. ICQLegacyCmdGetDeps uint16 = 0x03F2 // Pre-auth pseudo-login (historically "get departments list")
  20. ICQLegacyCmdContactList uint16 = 0x0406 // Send contact list
  21. ICQLegacyCmdSearchUIN uint16 = 0x041A // Search by UIN (old)
  22. ICQLegacyCmdSearchUser uint16 = 0x0424 // Search by name/email (old)
  23. ICQLegacyCmdKeepAlive uint16 = 0x042E // Keep connection alive (ping)
  24. ICQLegacyCmdLogoff uint16 = 0x0438 // Disconnect
  25. ICQLegacyCmdSysMsgDoneAck uint16 = 0x0442 // Offline messages acknowledged
  26. ICQLegacyCmdSysMsgReq uint16 = 0x044C // Request offline messages
  27. ICQLegacyCmdAuthorize uint16 = 0x0456 // Authorize user (V2)
  28. ICQLegacyCmdInfoReq uint16 = 0x0460 // Get user info (old)
  29. ICQLegacyCmdExtInfoReq uint16 = 0x046A // Get extended info (old)
  30. ICQLegacyCmdSetPassword uint16 = 0x049C // Change password
  31. ICQLegacyCmdUpdateBasic uint16 = 0x04A6 // Update basic profile (V2)
  32. ICQLegacyCmdUpdateDetail uint16 = 0x04B0 // Update extended profile (V2)
  33. ICQLegacyCmdGetExternals uint16 = 0x04C4 // Get external services
  34. ICQLegacyCmdLoginInfoReq uint16 = 0x04CE // Login info request (V4)
  35. ICQLegacyCmdSetStatus uint16 = 0x04D8 // Change status
  36. ICQLegacyCmdFirstLogin uint16 = 0x04EC // Initial login setup
  37. ICQLegacyCmdSetBasicInfo uint16 = 0x050A // Update basic profile (V4+)
  38. ICQLegacyCmdSetAuth uint16 = 0x0514 // Set authorization mode
  39. ICQLegacyCmdKeepAlive2 uint16 = 0x051E // Alternate keep-alive
  40. ICQLegacyCmdUserAdd uint16 = 0x053C // Add user to contacts
  41. ICQLegacyCmdSearchStart uint16 = 0x05C8 // Begin user search
  42. ICQLegacyCmdGetDeps1 uint16 = 0x05F0 // Pre-auth pseudo-login (alternate)
  43. ICQLegacyCmdUserGetInfo uint16 = 0x05FA // Get user info
  44. ICQLegacyCmdBroadcastAll uint16 = 0x060E // Broadcast to all users
  45. ICQLegacyCmdBroadcastOnl uint16 = 0x0618 // Broadcast to online users
  46. ICQLegacyCmdWWPMsg uint16 = 0x0622 // Web pager message
  47. ICQLegacyCmdInvisibleList uint16 = 0x06A4 // Set invisible list
  48. ICQLegacyCmdVisibleList uint16 = 0x06AE // Set visible list
  49. ICQLegacyCmdRegNewUser uint16 = 0x03FC // Register new user (V5)
  50. ICQLegacyCmdRegRequestInfo uint16 = 0x05DC // Request registration info (V3/V4)
  51. ICQLegacyCmdRegNewUserInfo uint16 = 0x05E6 // Send registration form (V3/V4)
  52. // V5-specific commands
  53. ICQLegacyCmdMetaUser uint16 = 0x064A // Meta user commands
  54. ICQLegacyCmdChangeVILists uint16 = 0x06B8 // Change visible/invisible lists
  55. )
  56. // Server Responses (sent to client)
  57. const (
  58. ICQLegacySrvAck uint16 = 0x000A // Acknowledgment
  59. ICQLegacySrvUserLMeta uint16 = 0x001E // User last meta
  60. ICQLegacySrvSetOffline uint16 = 0x0028 // Force offline
  61. ICQLegacySrvUserDepsList uint16 = 0x0032 // Pre-auth response (historically "departments list")
  62. ICQLegacySrvUserDepsList1 uint16 = 0x0082 // Pre-auth response (session) - from v3_send_depslist1()
  63. ICQLegacySrvNewUIN uint16 = 0x0046 // New UIN assigned
  64. ICQLegacySrvHello uint16 = 0x005A // Login successful
  65. ICQLegacySrvWrongPasswd uint16 = 0x0064 // Invalid password
  66. ICQLegacySrvUserOnline uint16 = 0x006E // Contact came online
  67. ICQLegacySrvUserOffline uint16 = 0x0078 // Contact went offline
  68. ICQLegacySrvSearchFound uint16 = 0x008C // Search result (old)
  69. ICQLegacySrvSearchDone uint16 = 0x00A0 // Search complete (old)
  70. ICQLegacySrvUpdatedBasic uint16 = 0x00B4 // Basic info updated successfully (V2)
  71. ICQLegacySrvUpdateBasicFail uint16 = 0x00BE // Basic info update failed (V2)
  72. ICQLegacySrvUpdatedDetail uint16 = 0x00C8 // Detail info updated successfully (V2)
  73. ICQLegacySrvUpdateDetailFail uint16 = 0x00D2 // Detail info update failed (V2)
  74. ICQLegacySrvUpdatedBasicV4 uint16 = 0x01E0 // Basic info updated successfully (V4)
  75. ICQLegacySrvUpdateBasicFailV4 uint16 = 0x01EA // Basic info update failed (V4)
  76. ICQLegacySrvSysMsgOffline uint16 = 0x00DC // Offline message
  77. ICQLegacySrvSysMsgDone uint16 = 0x00E6 // End of offline messages
  78. ICQLegacySrvNotConnected uint16 = 0x00F0 // Not connected error
  79. ICQLegacySrvBusy uint16 = 0x00FA // Server busy
  80. ICQLegacySrvSysMsgOnline uint16 = 0x0104 // Online message
  81. ICQLegacySrvInfoReply uint16 = 0x0118 // User info response (single)
  82. ICQLegacySrvExtInfoReply uint16 = 0x0122 // Extended info response
  83. ICQLegacySrvInvalidUIN uint16 = 0x012C // Invalid UIN
  84. ICQLegacySrvUserStatus uint16 = 0x01A4 // Status changed
  85. ICQLegacySrvUserListDone uint16 = 0x021C // Contact list processed
  86. ICQLegacySrvUserInfoBasic uint16 = 0x02E4 // Basic user info (nick, first, last, email, auth) - from v3_defines.h ICQ_CMDxSND_USERxINFO_BASIC
  87. ICQLegacySrvUserInfoWork uint16 = 0x02F8 // Work info - from v3_defines.h ICQ_CMDxSND_USERxINFO_WORK
  88. ICQLegacySrvUserInfoWWeb uint16 = 0x030C // Work web page - from v3_defines.h ICQ_CMDxSND_USERxINFO_WWEB
  89. ICQLegacySrvUserInfoHome uint16 = 0x0320 // Home info - from v3_defines.h ICQ_CMDxSND_USERxINFO_HOME
  90. ICQLegacySrvUserInfoHWeb uint16 = 0x0334 // Home web page - from v3_defines.h ICQ_CMDxSND_USERxINFO_HWEB
  91. ICQLegacySrvRegisterInfo uint16 = 0x037A // Registration info (admin notes)
  92. ICQLegacySrvLoginErr uint16 = 0x0370 // Login error
  93. ICQLegacySrvRegistrationOK uint16 = 0x0384 // Registration successful with new UIN
  94. ICQLegacySrvMetaUser uint16 = 0x03DE // Meta user response
  95. ICQLegacySrvAckNewUIN uint16 = 0x03FC // Registration successful
  96. )
  97. // META_USER Sub-Commands (V5)
  98. const (
  99. // Set commands
  100. ICQLegacyMetaSetBasic uint16 = 0x03E8 // Set basic info
  101. ICQLegacyMetaSetBasic2 uint16 = 0x03E9 // Set basic info (alt)
  102. ICQLegacyMetaSetWork uint16 = 0x03F2 // Set work info
  103. ICQLegacyMetaSetWork2 uint16 = 0x03F3 // Set work info (alt)
  104. ICQLegacyMetaSetMore uint16 = 0x03FC // Set more info
  105. ICQLegacyMetaSetMore2 uint16 = 0x03FD // Set more info (alt)
  106. ICQLegacyMetaSetAbout uint16 = 0x0406 // Set about text
  107. ICQLegacyMetaSetInterests uint16 = 0x0410 // Set interests
  108. ICQLegacyMetaSetAffiliations uint16 = 0x041A // Set affiliations
  109. ICQLegacyMetaSetSecurity uint16 = 0x0424 // Set security options
  110. ICQLegacyMetaSetPass uint16 = 0x042E // Change password
  111. ICQLegacyMetaSetHPCat uint16 = 0x0442 // Set homepage category
  112. // Get commands
  113. ICQLegacyMetaUserFullInfo uint16 = 0x04B0 // Request full user info
  114. ICQLegacyMetaUserFullInfo2 uint16 = 0x04B1 // Request full user info (alt)
  115. ICQLegacyMetaUserInfo uint16 = 0x04BA // Request short user info
  116. ICQLegacyMetaUserUnreg uint16 = 0x04C4 // Unregister account
  117. ICQLegacyMetaLoginInfo uint16 = 0x04CE // Login info
  118. ICQLegacyMetaLoginInfo2 uint16 = 0x04CF // Login info (alt)
  119. // Search commands
  120. ICQLegacyMetaSearchName uint16 = 0x0514 // Search by name
  121. ICQLegacyMetaSearchName2 uint16 = 0x0515 // Search by name (alt)
  122. ICQLegacyMetaSearchUIN uint16 = 0x051E // Search by UIN
  123. ICQLegacyMetaSearchUIN2 uint16 = 0x051F // Search by UIN (alt)
  124. ICQLegacyMetaSearchEmail uint16 = 0x0528 // Search by email
  125. ICQLegacyMetaSearchEmail2 uint16 = 0x0529 // Search by email (alt)
  126. ICQLegacyMetaSearchWhite uint16 = 0x0532 // White pages search
  127. ICQLegacyMetaSearchWhite2 uint16 = 0x0533 // White pages search (alt)
  128. // Other
  129. ICQLegacyMetaUsageStats uint16 = 0x06B8 // Usage statistics
  130. ICQLegacyMetaLogin uint16 = 0x07D0 // Meta login
  131. )
  132. // META_USER Server Response Sub-Commands
  133. const (
  134. ICQLegacySrvMetaSetBasicAck uint16 = 0x0064 // Set basic ack
  135. ICQLegacySrvMetaSetWorkAck uint16 = 0x006E // Set work ack
  136. ICQLegacySrvMetaSetMoreAck uint16 = 0x0078 // Set more ack
  137. ICQLegacySrvMetaSetAboutAck uint16 = 0x0082 // Set about ack
  138. ICQLegacySrvMetaSetInterestsAck uint16 = 0x008C // Set interests ack
  139. ICQLegacySrvMetaSetAffilAck uint16 = 0x0096 // Set affiliations ack
  140. ICQLegacySrvMetaSetSecureAck uint16 = 0x00A0 // Set security ack
  141. ICQLegacySrvMetaSetPassAck uint16 = 0x00AA // Set password ack
  142. ICQLegacySrvMetaUnregAck uint16 = 0x00B4 // Unregister ack
  143. ICQLegacySrvMetaSetHPCatAck uint16 = 0x00BE // Set homepage cat ack
  144. ICQLegacySrvMetaUserInfo2 uint16 = 0x00C8 // User info response
  145. ICQLegacySrvMetaInfoWork uint16 = 0x00D2 // Work info response
  146. ICQLegacySrvMetaInfoMore uint16 = 0x00DC // More info response
  147. ICQLegacySrvMetaInfoAbout uint16 = 0x00E6 // About response
  148. ICQLegacySrvMetaInfoInterests uint16 = 0x00F0 // Interests response
  149. ICQLegacySrvMetaInfoAffil uint16 = 0x00FA // Affiliations response
  150. ICQLegacySrvMetaUserInfo uint16 = 0x0104 // Short user info
  151. ICQLegacySrvMetaInfoHPCat uint16 = 0x010E // Homepage category
  152. ICQLegacySrvMetaUserFound uint16 = 0x0190 // Search result
  153. ICQLegacySrvMetaUserLastFound uint16 = 0x019A // Last search result
  154. ICQLegacySrvMetaWhiteFound uint16 = 0x01A4 // White pages result
  155. ICQLegacySrvMetaWhiteLastFound uint16 = 0x01AE // Last white pages result
  156. )
  157. // Message Types
  158. const (
  159. ICQLegacyMsgText uint16 = 0x0001 // Plain text message
  160. ICQLegacyMsgChat uint16 = 0x0002 // Chat request
  161. ICQLegacyMsgFile uint16 = 0x0003 // File transfer request
  162. ICQLegacyMsgURL uint16 = 0x0004 // URL with description
  163. ICQLegacyMsgAuthReq uint16 = 0x0006 // Authorization request
  164. ICQLegacyMsgAuthDeny uint16 = 0x0007 // Authorization denied
  165. ICQLegacyMsgAuthGrant uint16 = 0x0008 // Authorization granted
  166. ICQLegacyMsgServer uint16 = 0x0009 // Server message
  167. ICQLegacyMsgAdded uint16 = 0x000C // "You were added" notification
  168. ICQLegacyMsgWWP uint16 = 0x000D // Web pager message
  169. ICQLegacyMsgEmailPager uint16 = 0x000E // Email pager message
  170. ICQLegacyMsgContacts uint16 = 0x0013 // Contact list sharing
  171. ICQLegacyMsgPlugin uint16 = 0x001A // Plugin message
  172. ICQLegacyMsgAutoAway uint16 = 0x00E8 // Auto-away message
  173. ICQLegacyMsgAutoOcc uint16 = 0x00E9 // Auto-occupied message
  174. ICQLegacyMsgAutoNA uint16 = 0x00EA // Auto-NA message
  175. ICQLegacyMsgAutoDND uint16 = 0x00EB // Auto-DND message
  176. ICQLegacyMsgAutoFFC uint16 = 0x00EC // Auto-FFC message
  177. )
  178. // User Status Codes
  179. const (
  180. ICQLegacyStatusOnline uint32 = 0x00000000 // Available
  181. ICQLegacyStatusAway uint32 = 0x00000001 // Away from computer
  182. ICQLegacyStatusDND uint32 = 0x00000002 // Do not disturb
  183. ICQLegacyStatusNA uint32 = 0x00000004 // Not available
  184. ICQLegacyStatusOccupied uint32 = 0x00000010 // Busy/Occupied
  185. ICQLegacyStatusFFC uint32 = 0x00000020 // Free for chat
  186. ICQLegacyStatusInvisible uint32 = 0x00000100 // Hidden from others
  187. )
  188. // Status Flags (can be combined with status)
  189. const (
  190. ICQLegacyStatusFlagWebAware uint32 = 0x00010000 // Web aware
  191. ICQLegacyStatusFlagShowIP uint32 = 0x00020000 // Show IP address
  192. ICQLegacyStatusFlagBirthday uint32 = 0x00080000 // Birthday flag
  193. ICQLegacyStatusFlagWebFront uint32 = 0x00200000 // Web front
  194. ICQLegacyStatusFlagDCAuth uint32 = 0x10000000 // DC requires auth
  195. ICQLegacyStatusFlagDCCont uint32 = 0x20000000 // DC only contacts
  196. )
  197. // Login Error Codes
  198. const (
  199. ICQLegacyLoginErrSuccess uint8 = 0x00 // Success
  200. ICQLegacyLoginErrBadPassword uint8 = 0x01 // Invalid password
  201. ICQLegacyLoginErrBadUIN uint8 = 0x02 // Invalid UIN
  202. ICQLegacyLoginErrNotRegistered uint8 = 0x03 // UIN not registered
  203. ICQLegacyLoginErrBusy uint8 = 0x04 // Server busy
  204. ICQLegacyLoginErrRateLimit uint8 = 0x05 // Rate limited
  205. ICQLegacyLoginErrOldVersion uint8 = 0x06 // Client too old
  206. ICQLegacyLoginErrDualLogin uint8 = 0x07 // Already logged in
  207. ICQLegacyLoginErrTryAgain uint8 = 0x08 // Try again later
  208. )
  209. // Search Result Codes
  210. const (
  211. ICQLegacySearchSuccess uint8 = 0x00 // Search successful
  212. ICQLegacySearchNotFound uint8 = 0x01 // No results found
  213. ICQLegacySearchTooMany uint8 = 0x02 // Too many results
  214. ICQLegacySearchError uint8 = 0x03 // Search error
  215. )
  216. // Authorization Modes
  217. const (
  218. ICQLegacyAuthNone uint8 = 0x00 // No authorization required
  219. ICQLegacyAuthRequired uint8 = 0x01 // Authorization required
  220. )
  221. // Gender Codes
  222. const (
  223. ICQLegacyGenderUnspecified uint8 = 0x00
  224. ICQLegacyGenderFemale uint8 = 0x01
  225. ICQLegacyGenderMale uint8 = 0x02
  226. )