Note that existing AirDC++ users should use the inbuilt updating function (File -> Update check).
]]>Version 2.13.x focuses on modernizing the core application codebase and providing new API features for developers.
The new ADC commands allows developers to interact directly with the ADC protocol via hubs or directory with other clients over TCP or UDP protocol.
It’s possible to send ADC commands, read incoming ADC commands and add new parameters in outgoing commands. It’s also possible to advertise custom protocol supports to hubs/other clients so it’s fully possible to design and implement new ADC protocol extensions!
Here’s a very simplied version of an imaginary partial file sharing extension demonstrating a way to exchange information between the clients about finished files that aren’t shared yet. Note that there’s actual partial sharing functionality already implement in the client and it’s a lot more complicated than this.
// Add a support for our imaginary partial sharing extension (PSE0) that
// is advertised to other hub users in case we need it for other functionality
// It's not used in this example and in real use cases you shouldn't
// add supports "just in case" in order to save hub's bandwidth
await socket.post(`adc_commands/supports/hub/PSE0`)
await socket.addListener(
`search`,
'search_incoming_search',
async ({ results, query, user }) => {
if (!query.tth || results.length > 0) {
// No need to match text searches or if we have results already
return
}
// Check if we have something queued
const files = socket.post('queue', `files/${query.tth}`)
if (!files.length) {
return
}
// Send information about all queued files over UDP
for (const file of files) {
await socket.post(`adc_commands/udp_command`, {
command: {
type: 'U',
command: 'PSE',
params: [
`TH${file.tth}`,
]
},
user,
});
}
}
)
// Listener for incoming partial bundle sharing commands
// sent by other clients (PSE)
await socket.addListener(
`adc_commands`,
'incoming_udp_command/PSE',
async (commandData) => {
const tth = getAdcCommandParam(commandData, 'TH');
if (tth) {
// ...add source for the file or do something else
}
}
)
API
Core
Note that existing AirDC++ users should use the inbuilt updating function (File -> Update check).
]]>Note that existing AirDC++ users should use the inbuilt updating function (File -> Update check).
]]>