chore: rename quicproquo → quicprochat in Rust workspace
Rename all crate directories, package names, binary names, proto package/module paths, ALPN strings, env var prefixes, config filenames, mDNS service names, and plugin ABI symbols from quicproquo/qpq to quicprochat/qpc.
This commit is contained in:
@@ -5,11 +5,11 @@
|
||||
name = "logging_plugin"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
description = "Reference quicproquo server plugin: logs all hook events to stderr."
|
||||
description = "Reference quicprochat server plugin: logs all hook events to stderr."
|
||||
license = "MIT"
|
||||
|
||||
[lib]
|
||||
crate-type = ["cdylib"]
|
||||
|
||||
[dependencies]
|
||||
quicproquo-plugin-api = { path = "../../../crates/quicproquo-plugin-api" }
|
||||
quicprochat-plugin-api = { path = "../../../crates/quicprochat-plugin-api" }
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//! Reference quicproquo server plugin: logs all hook events to stderr.
|
||||
//! Reference quicprochat server plugin: logs all hook events to stderr.
|
||||
//!
|
||||
//! This plugin demonstrates every hook point in the `HookVTable` API. It
|
||||
//! writes a single-line human-readable record to stderr for each server event.
|
||||
@@ -15,14 +15,14 @@
|
||||
//! # Deploying
|
||||
//!
|
||||
//! ```bash
|
||||
//! cp target/release/liblogging_plugin.so /etc/qpq/plugins/
|
||||
//! qpq-server --plugin-dir /etc/qpq/plugins
|
||||
//! cp target/release/liblogging_plugin.so /etc/qpc/plugins/
|
||||
//! qpc-server --plugin-dir /etc/qpc/plugins
|
||||
//! ```
|
||||
|
||||
use std::ffi::c_void;
|
||||
use std::slice;
|
||||
|
||||
use quicproquo_plugin_api::{
|
||||
use quicprochat_plugin_api::{
|
||||
CAuthEvent, CChannelEvent, CFetchEvent, CMessageEvent, HookVTable, HOOK_CONTINUE, PLUGIN_OK,
|
||||
};
|
||||
|
||||
@@ -53,7 +53,7 @@ unsafe extern "C" fn on_message_enqueue(
|
||||
) -> i32 {
|
||||
let e = &*event;
|
||||
eprintln!(
|
||||
"[qpq-plugin:logging] enqueue: recipient={} payload_len={} seq={} has_sender={}",
|
||||
"[qpc-plugin:logging] enqueue: recipient={} payload_len={} seq={} has_sender={}",
|
||||
hex_prefix(e.recipient_key, e.recipient_key_len),
|
||||
e.payload_len,
|
||||
e.seq,
|
||||
@@ -67,11 +67,11 @@ unsafe extern "C" fn on_batch_enqueue(
|
||||
events: *const CMessageEvent,
|
||||
count: usize,
|
||||
) {
|
||||
eprintln!("[qpq-plugin:logging] batch_enqueue: count={}", count);
|
||||
eprintln!("[qpc-plugin:logging] batch_enqueue: count={}", count);
|
||||
let events = slice::from_raw_parts(events, count);
|
||||
for (i, e) in events.iter().enumerate() {
|
||||
eprintln!(
|
||||
"[qpq-plugin:logging] [{}/{}] recipient={} seq={}",
|
||||
"[qpc-plugin:logging] [{}/{}] recipient={} seq={}",
|
||||
i + 1,
|
||||
count,
|
||||
hex_prefix(e.recipient_key, e.recipient_key_len),
|
||||
@@ -84,11 +84,11 @@ unsafe extern "C" fn on_auth(_user_data: *mut c_void, event: *const CAuthEvent)
|
||||
let e = &*event;
|
||||
let username = str_from_raw(e.username, e.username_len);
|
||||
if e.success != 0 {
|
||||
eprintln!("[qpq-plugin:logging] auth: user='{}' SUCCESS", username);
|
||||
eprintln!("[qpc-plugin:logging] auth: user='{}' SUCCESS", username);
|
||||
} else {
|
||||
let reason = str_from_raw(e.failure_reason, e.failure_reason_len);
|
||||
eprintln!(
|
||||
"[qpq-plugin:logging] auth: user='{}' FAILURE reason='{}'",
|
||||
"[qpc-plugin:logging] auth: user='{}' FAILURE reason='{}'",
|
||||
username, reason
|
||||
);
|
||||
}
|
||||
@@ -100,7 +100,7 @@ unsafe extern "C" fn on_channel_created(
|
||||
) {
|
||||
let e = &*event;
|
||||
eprintln!(
|
||||
"[qpq-plugin:logging] channel_created: channel={} was_new={} initiator={}",
|
||||
"[qpc-plugin:logging] channel_created: channel={} was_new={} initiator={}",
|
||||
hex_prefix(e.channel_id, e.channel_id_len),
|
||||
e.was_new != 0,
|
||||
hex_prefix(e.initiator_key, e.initiator_key_len),
|
||||
@@ -111,7 +111,7 @@ unsafe extern "C" fn on_fetch(_user_data: *mut c_void, event: *const CFetchEvent
|
||||
let e = &*event;
|
||||
if e.message_count > 0 {
|
||||
eprintln!(
|
||||
"[qpq-plugin:logging] fetch: recipient={} count={}",
|
||||
"[qpc-plugin:logging] fetch: recipient={} count={}",
|
||||
hex_prefix(e.recipient_key, e.recipient_key_len),
|
||||
e.message_count,
|
||||
);
|
||||
@@ -127,7 +127,7 @@ unsafe extern "C" fn on_user_registered(
|
||||
) {
|
||||
let name = str_from_raw(username, username_len);
|
||||
eprintln!(
|
||||
"[qpq-plugin:logging] user_registered: user='{}' key={}",
|
||||
"[qpc-plugin:logging] user_registered: user='{}' key={}",
|
||||
name,
|
||||
hex_prefix(identity_key, identity_key_len),
|
||||
);
|
||||
@@ -139,9 +139,9 @@ unsafe extern "C" fn on_user_registered(
|
||||
///
|
||||
/// # Safety
|
||||
///
|
||||
/// `vtable` must point to a zeroed `HookVTable` as provided by `qpq-server`.
|
||||
/// `vtable` must point to a zeroed `HookVTable` as provided by `qpc-server`.
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn qpq_plugin_init(vtable: *mut HookVTable) -> i32 {
|
||||
pub unsafe extern "C" fn qpc_plugin_init(vtable: *mut HookVTable) -> i32 {
|
||||
if vtable.is_null() {
|
||||
return -1;
|
||||
}
|
||||
@@ -157,6 +157,6 @@ pub unsafe extern "C" fn qpq_plugin_init(vtable: *mut HookVTable) -> i32 {
|
||||
v.on_user_registered = Some(on_user_registered);
|
||||
// error_message and destroy not needed (no state, never rejects).
|
||||
|
||||
eprintln!("[qpq-plugin:logging] initialized");
|
||||
eprintln!("[qpc-plugin:logging] initialized");
|
||||
PLUGIN_OK
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user