d243fe85eabfbfee1b093fa6ea3069f48575aaaa
Fenris Wolf unua enmetajxo

Fenris Wolf authored 7 years ago

1) /*
2) 	
3) 	IRC-Bot "Kvasir"
4)     Copyright (C) 2016	Fenris Wolf (fenris@folksprak.org)
5) 	
6)     This program is free software: you can redistribute it and/or modify
7)     it under the terms of the GNU General Public License as published by
8)     the Free Software Foundation, either version 3 of the License, or
9)     (at your option) any later version.
10) 	
11)     This program is distributed in the hope that it will be useful,
12)     but WITHOUT ANY WARRANTY; without even the implied warranty of
13)     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14)     GNU General Public License for more details.
15) 	
16)     You should have received a copy of the GNU General Public License
17)     along with this program.  If not, see <http://www.gnu.org/licenses/>.
18)        
19) */
20) 
21) 
22) /**
23)  * @author fenris
24)  */
25) abstract class klaso_kromajxo
26) {
27) 	
28) 	/**
29) 	 * @author fenris
30) 	 */
31) 	protected identigilo : string;
32) 	
33) 	
34) 	/**
35) 	 * @author fenris
36) 	 */
37) 	protected nomo : string;
38) 	
39) 	
40) 	/**
41) 	 * @author fenris
42) 	 */
43) 	protected priskribo : string;
44) 	
45) 	
Fenris Wolf malgranda gxisdatigajxo

Fenris Wolf authored 7 years ago

46) 	/**
47) 	 * @author fenris
48) 	 */
49) 	protected uzo : string;
50) 	
51) 	
Fenris Wolf unua enmetajxo

Fenris Wolf authored 7 years ago

52) 	/**
53) 	 * @author fenris
54) 	 */
55) 	protected auxtoro : string;
56) 	
57) 	
58) 	/**
59) 	 * @author fenris
60) 	 */
Fenris Wolf malgranda gxisdatigajxo

Fenris Wolf authored 7 years ago

61) 	public constructor
62) 	(
Fenris Wolf pli bona laborado inter kli...

Fenris Wolf authored 7 years ago

63) 		datumoj :
Fenris Wolf unua enmetajxo

Fenris Wolf authored 7 years ago

64) 		{
Fenris Wolf pli bona laborado inter kli...

Fenris Wolf authored 7 years ago

65) 			identigilo ?: string;
66) 			nomo ?: string;
67) 			priskribo ?: string;
68) 			uzo ?: string;
69) 			auxtoro ?: string;
Fenris Wolf unua enmetajxo

Fenris Wolf authored 7 years ago

70) 		}
Fenris Wolf pli bona laborado inter kli...

Fenris Wolf authored 7 years ago

71) 		= {}
72) 	)
73) 	{
74) 		this.meti_valorojn(datumoj);
75) 	}
76) 	
77) 	
78) 	/**
79) 	 * @author fenris
80) 	 */
81) 	public meti_valorojn(datumoj : Object) : void
82) 	{
83) 		this.identigilo = alporti<string>(datumoj, "identigilo", cxeno_generi("kromajxo_"), 1);
84) 		this.nomo = alporti<string>(datumoj, "nomo", null, 0);
85) 		this.priskribo = alporti<string>(datumoj, "priskribo", null, 0);
86) 		this.uzo = alporti(datumoj, "uzo", null, 0);
87) 		this.auxtoro = alporti<string>(datumoj, "auxtoro", null, 0);
Fenris Wolf unua enmetajxo

Fenris Wolf authored 7 years ago

88) 	}
89) 	
90) 	
91) 	/**
92) 	 * @author fenris
93) 	 */
94) 	public identigilo_legi() : string
95) 	{
96) 		return this.identigilo;
97) 	}
98) 	
99) 	
100) 	/**
101) 	 * @author fenris
102) 	 */
103) 	public nomo_legi() : string
104) 	{
105) 		return this.nomo;
106) 	}
107) 	
108) 	
109) 	/**
110) 	 * @author fenris
111) 	 */
112) 	public priskribo_legi() : string
113) 	{
114) 		return this.priskribo;
115) 	}
116) 	
117) 	
Fenris Wolf malgranda gxisdatigajxo

Fenris Wolf authored 7 years ago

118) 	/**
119) 	 * @author fenris
120) 	 */
121) 	public uzo_legi() : string
122) 	{
123) 		return this.uzo;
124) 	}
125) 	
126) 	
Fenris Wolf unua enmetajxo

Fenris Wolf authored 7 years ago

127) 	/**
128) 	 * @author fenris
129) 	 */
130) 	public auxtoro_legi() : string
131) 	{
132) 		return this.auxtoro;
133) 	}
134) 	
135) 	
136) 	/**
Fenris Wolf pli bona laborado inter kli...

Fenris Wolf authored 7 years ago

137) 	 * @todo sekura respondado estus mojosa
Fenris Wolf unua enmetajxo

Fenris Wolf authored 7 years ago

138) 	 * @author fenris
139) 	 */
140) 	public enigi(enigo : klaso_evento_eniga, eligi : (eligo : klaso_evento_eliga)=>void) : void
141) 	{
142) 		let that : klaso_kromajxo = this;
143) 		this.reagi
144) 		(
145) 			enigo.kruda_al(),
146) 			eligo_kruda => eligi(klaso_evento_eliga_mesagxo.kruda_de(eligo_kruda))
147) 		)
Fenris Wolf pli bona laborado inter kli...

Fenris Wolf authored 7 years ago

148) 		/*
149) 		function respondi_sekure(linioj)
150) 		{
151) 			if (linioj.length <= 5)
152) 			{
153) 				linioj.forEach(linio => respondi({"tipo": "mesagxo", "parametroj": {"celo": enigo_kruda["parametroj"]["fonto"], "enhavo": linio}}));
154) 			}
155) 			else
156) 			{
157) 				var avizo = "Tro multe da rezultoj, ili senditos al vi private";
158) 				respondi({"tipo": "mesagxo", "parametroj": {"celo": enigo_kruda["parametroj"]["fonto"], "alparolato": enigo_kruda["parametroj"]["sendinto"], "enhavo": avizo}});
159) 				linioj.forEach(linio => respondi({"tipo": "mesagxo", "parametroj": {"celo": enigo_kruda["parametroj"]["sendinto"], "enhavo": linio}}));
160) 			}
161) 		}
162) 		 */
Fenris Wolf unua enmetajxo

Fenris Wolf authored 7 years ago

163) 	}
164) 		
165) 	
Fenris Wolf 'starigi'-metodo por kromaj...

Fenris Wolf authored 7 years ago

166) 	/**
167) 	 * @author fenris
168) 	 */
169) 	public starigi(finado : (eraro ?: Error)=>void) : void
170) 	{
171) 		finado(null);
172) 	}
173) 	
174)