1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#[derive(Copy, Clone)]
#[allow(dead_code)]
pub enum MediaType {
MediaTypeNone,
MediaTypeVideo,
MediaTypeAudio,
}
pub enum InstanceType {
InstanceTypeSide,
InstanceTypeLink,
}
#[derive(Copy, Clone)]
#[allow(dead_code)]
pub struct Timer {
tid: i32,
milliseconds: i32,
}
impl Timer {
pub fn get_tid(&self) -> i32 {
self.tid
}
pub fn get_milliseconds(&self) -> i32 {
self.milliseconds
}
pub fn new(_tid: i32, _milliseconds: i32) -> Self {
Timer {
tid: _tid,
milliseconds: _milliseconds,
}
}
}
pub trait BasePlugin {
fn get_name(&self) -> String;
fn get_author(&self) -> String;
fn get_args(&mut self, args: std::collections::HashMap<String, String>) -> Vec<String>;
fn get_allow_custom_args(&self) -> Vec<&'static str> {
let vec: Vec<&'static str> = Vec::new();
vec
}
fn get_filter_name(&self) -> String;
fn get_media_type(&self) -> MediaType;
fn validate_user_args(
&self,
args: std::collections::HashMap<String, String>,
) -> Result<bool, &'static str>;
fn print_log(&self, level: super::util::os::PrintLogLevel, log: &str) {
super::util::os::print_log(level, &format!("[{}] {}", self.get_name(), log).to_string())
}
fn register_task(&self) -> Vec<Timer> {
let empty: Vec<Timer> = Vec::new();
empty
}
fn register_message_keys(&self) -> Vec<super::proto::keys::EventMessageAction> {
let empty: Vec<super::proto::keys::EventMessageAction> = Vec::new();
empty
}
#[warn(unused_variables)]
fn execute_task(&mut self, _tid: u32) {}
#[allow(unused_variables)]
fn execute_message(&mut self, action: i32, body: String) {}
#[allow(unused_variables)]
fn get_instance_type(&mut self) -> InstanceType {
InstanceType::InstanceTypeLink
}
#[allow(unused_variables)]
fn hook_created(&mut self) -> i32 {
0
}
}