forked from CyranoChen/DiscuzNT
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPluginBase.cs
165 lines (123 loc) · 3.59 KB
/
PluginBase.cs
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
using System;
using System.Collections.Generic;
using System.Text;
using Discuz.Entity;
using System.Data;
namespace Discuz.Plugin
{
public abstract class PluginBase : IFeed, IPost, IUser, ISearch
{
#region IUser Members
public void Create(UserInfo user)
{
OnUserCreated(user);
}
public void Ban(int userid)
{
OnUserBanned(userid);
}
public void UnBan(int userid)
{
OnUserUnBanned(userid);
}
public void Delete(int userid)
{
OnUserDeleted(userid);
}
public void LogIn(UserInfo user)
{
OnUserLoggedIn(user);
}
public void LogOut(UserInfo user)
{
OnUserLoggedOut(user);
}
#endregion
#region IPost Members
public void CreateTopic(TopicInfo topic, PostInfo post, AttachmentInfo[] attachs)
{
OnTopicCreated(topic, post, attachs);
}
public void CreatePost(Discuz.Entity.PostInfo post)
{
OnPostCreated(post);
}
public void Edit(Discuz.Entity.PostInfo post)
{
OnPostEdited(post);
}
public void Ban(Discuz.Entity.PostInfo post)
{
OnPostBanned(post);
}
public void UnBan(Discuz.Entity.PostInfo post)
{
OnPostUnBanned(post);
}
public void Delete(Discuz.Entity.PostInfo post)
{
OnPostDeleted(post);
}
public string CreateAttachment(AttachmentInfo[] attachs, int usergroupid, int userid, string username)
{
return OnAttachCreated(attachs, usergroupid, userid, username);
}
#endregion
#region IFeed Members
public string GetFeed(int ttl, int uid)
{
return GetFeedXML(ttl, uid);
}
public string GetFeed(int ttl)
{
return GetFeedXML(ttl);
}
#endregion
#region ISearch Members
public DataTable GetResult(int pagesize, string idstr)
{
return GetSearchResult(pagesize, idstr);
}
#endregion
protected virtual void OnUserCreated(UserInfo user)
{ }
protected virtual void OnUserBanned(int userid)
{ }
protected virtual void OnUserUnBanned(int userid)
{ }
protected virtual void OnUserDeleted(int userid)
{ }
protected virtual void OnUserLoggedIn(UserInfo user)
{ }
protected virtual void OnUserLoggedOut(UserInfo user)
{ }
protected virtual void OnTopicCreated(TopicInfo topic, PostInfo post, AttachmentInfo[] attachs)
{ }
protected virtual void OnPostCreated(PostInfo post)
{ }
protected virtual void OnPostEdited(PostInfo post)
{ }
protected virtual void OnPostBanned(PostInfo post)
{ }
protected virtual void OnPostUnBanned(PostInfo post)
{ }
protected virtual void OnPostDeleted(PostInfo post)
{ }
protected virtual string GetFeedXML(int ttl, int uid)
{
return "";
}
protected virtual string GetFeedXML(int ttl)
{
return "";
}
protected virtual DataTable GetSearchResult(int pagesize, string idstr)
{
return new DataTable();
}
protected virtual string OnAttachCreated(AttachmentInfo[] attachs, int usergroupid, int userid, string username)
{
return "";
}
}
}