summaryrefslogtreecommitdiff
path: root/utilities/test-application/testapp-utility.c
blob: c834b7ec0610654267441591a0bd0adb05e886d8 (plain)
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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
/*
*  email-service
*
* Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
*
* Contact: Kyuho Jo <kyuho.jo@samsung.com>, Sunghyun Kwon <sh0701.kwon@samsung.com>
* 
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/



/* common header */
#include <stdarg.h>
#include <string.h>

/* open header */
#include <glib.h>
#include <glib/gprintf.h>

/* internal header */
#include "testapp-utility.h"

/* internal data struct */

void testapp_print (char *fmt, ...)
{
	va_list args = {0};
	va_start(args, fmt);
	vfprintf (stdout, fmt, args);
	va_end (args);
	fflush (stdout);
}

void testapp_show_menu (eEMAIL_MENU menu)
{
	switch (menu) {
		case EMAIL_MAIN_MENU:
			testapp_print ("==========================================\n");
			testapp_print ("    Email test application \n");
			testapp_print ("==========================================\n");
			testapp_print ("1. Account Test\n");
			testapp_print ("2. Mail Test\n");
			testapp_print ("3. Mailbox Test\n");
			testapp_print ("5. Rule Test\n");
			testapp_print ("6. Thread Test\n");
			testapp_print ("7. Others\n");
			testapp_print ("8. Gmime test\n");
			testapp_print ("0. Exit \n");
			testapp_print ("------------------------------------------\n");
			break;
			
		case EMAIL_ACCOUNT_MENU:
			testapp_print ("==========================================\n");
			testapp_print ("    ACCOUNT MENU \n");
			testapp_print ("==========================================\n");
			testapp_print (" 1.  Add account with validation\n");
			testapp_print (" 2.  Update account\n");
			testapp_print (" 3.  Delete account\n");
			testapp_print (" 4.  Get account\n");
			testapp_print (" 5.  Get account list\n");
			testapp_print (" 6.  Update check interval\n");
			testapp_print (" 7.  Validate account\n");
			testapp_print (" 8.  Cancel validate Account\n");
			testapp_print (" 9.  Backup All accounts\n");
			testapp_print (" 10. Restore accounts\n");
			testapp_print (" 11. Get password length of account\n");
			testapp_print (" 12. Query server info\n");
			testapp_print (" 13. Clear all notifications\n");
			testapp_print (" 14. Save default account ID\n");
			testapp_print (" 15. Load default account ID\n");
			testapp_print (" 16. Add certificate\n");
			testapp_print (" 17. Get certificate\n");
			testapp_print (" 18. Delete certificate\n");
			testapp_print (" 19. Add Account\n");
			testapp_print (" 20. Update peak schedule\n");
			testapp_print (" 0.  Go to Main Menu\n");
			testapp_print ("------------------------------------------\n");
			break;
			
		case EMAIL_MAIL_MENU:
			testapp_print ("==========================================\n");
			testapp_print ("    MAIL MENU\n");
			testapp_print ("==========================================\n");
			testapp_print ("1.  Get mails\n");
			testapp_print ("2.  Send a mail\n");
			testapp_print ("3.  Get mail list ex\n");
			testapp_print ("4.  Add Attachment\n");
			testapp_print ("5.  Set deleted flag\n");
			testapp_print ("6.  Expunge deleted flagged mails\n");
			testapp_print ("7.  Send read receipt\n");
			testapp_print ("8.  Delete attachment\n");
			testapp_print ("9.  Mail Count \n");
			testapp_print ("10. Move mails to another account\n");
			testapp_print ("11. Send mail with downloading attachment of original mail\n");
			testapp_print ("12. Get mail data\n");
			testapp_print ("13. Schedule sending mail\n");
			testapp_print ("14. Delete a mail \n");
			testapp_print ("15. Update mail attribute \n");
			testapp_print ("16. Download mail body\n");
			testapp_print ("17. Download an attachment\n");
			testapp_print ("18. Get attachment list\n");
			testapp_print ("19. Get meeting request\n");
			testapp_print ("20. Delete all mail\n");
			testapp_print ("21. Move Mail \n");
			testapp_print ("23. Resend Mail \n");
			testapp_print ("24. Get attachment data \n");
			testapp_print ("27. Move all mails to mailbox\n");
			testapp_print ("38. Get total email disk usage \n");	
			testapp_print ("40. Verify Email Address Format\n");
			testapp_print ("41. Get Max Mail Count\n");
			testapp_print ("42. Storage test : (Input : to fields)\n");
			testapp_print ("43. Send mail Cancel\n");
			testapp_print ("44. Cancel Download Body\n");
			testapp_print ("46. Get thread list\n");
 			testapp_print ("48. Get thread information\n");
			testapp_print ("51. Get mail list\n");
			testapp_print ("52. Get address info list\n");
			testapp_print ("55. Set a field of flags\n");
			testapp_print ("56. Add mail\n");
			testapp_print ("57. Update mail\n");
			testapp_print ("58. Search on server\n");
			testapp_print ("59. Add mail to search result table\n");
			testapp_print ("60. Parse mime file\n");
			testapp_print ("61. Write mime file\n");
			testapp_print ("0.  Go to Main Menu\n");
			testapp_print ("------------------------------------------\n");
			break;
			
		case EMAIL_MAILBOX_MENU:
			testapp_print ("==========================================\n");
			testapp_print ("   MAILBOX MENU\n");
			testapp_print ("==========================================\n");
			testapp_print (" 1. Add mailbox\n");
			testapp_print (" 2. Delete mailbox\n");
			testapp_print (" 3. Raname mailbox\n");
			testapp_print (" 4. Get IMAP mailbox List\n");
			testapp_print (" 5. Set local mailbox\n");
			testapp_print (" 6. Delete mailbox ex\n");
			testapp_print (" 7. Get mailbox by mailbox type\n");
			testapp_print (" 8. Set mailbox type\n");
			testapp_print (" 9. Set mail slot size\n");
			testapp_print ("10. Get mailbox list\n");
			testapp_print ("11. Sync mailbox\n");
			testapp_print ("12. Stamp sync time\n");
			testapp_print ("13. Raname mailbox ex\n");
			testapp_print ("14. Get mailbox list by keyword\n");
			testapp_print ("0. Go to Main Menu\n");
			testapp_print ("------------------------------------------\n");
			break;
			
		case EMAIL_RULE_MENU:
			testapp_print ("==========================================\n");
			testapp_print ("   RULE MENU\n");
			testapp_print ("==========================================\n");
			testapp_print ("1. Add Rule\n");
			testapp_print ("2. Delete Rule\n");
			testapp_print ("3. Update Rule\n");
			testapp_print ("5. Get Rule\n");
			testapp_print ("6. Get Rule List\n");
			testapp_print ("0. Go to Main Menu\n");
			testapp_print ("------------------------------------------\n");
			break;
			
		case EMAIL_THREAD_MENU:
			testapp_print ("==========================================\n");
			testapp_print ("   TRHEAD MENU\n");
			testapp_print ("==========================================\n");
			testapp_print ("1. Move Thread\n");
			testapp_print ("2. Delete Thread\n");
			testapp_print ("3. Set Seen Flag of Thread\n");
			testapp_print ("0. Go to Main Menu\n");
			testapp_print ("------------------------------------------\n");
			break;
			
		case EMAIL_OTHERS_MENU:
			testapp_print ("==========================================\n");
			testapp_print ("   OTHERS\n");
			testapp_print ("==========================================\n");
			testapp_print ("1.  Ping service\n");
			testapp_print ("3.  Cancel Job\n");
			testapp_print ("5.  Set DNET Proper Profile Type\n");
			testapp_print ("6.  Get DNET Proper Profile Type\n");
			testapp_print ("7.  Get preview text\n");
			testapp_print ("11. Get task information\n");
			testapp_print ("12. Create DB full\n");
			testapp_print ("13. Encoding Test\n");
			testapp_print ("14. DTT Test\n");
			testapp_print ("15. Show User Message\n");
			testapp_print ("16. Get mime entity in signed file\n");
			testapp_print ("17. Query SMTP mail size limit\n");
			testapp_print ("0.  Go to Main Menu\n");
			testapp_print ("------------------------------------------\n");
			break;
			
		case EMAIL_GMIME_MENU:
			testapp_print ("==========================================\n");
			testapp_print ("   Gmime Test\n");
			testapp_print ("==========================================\n");
			testapp_print ("1. Parsing eml\n");
			testapp_print ("0.  Go to Main Menu\n");
			testapp_print ("------------------------------------------\n");
			break;

		default:
			break;
	}
}
void testapp_show_prompt (eEMAIL_MENU menu)
{
	switch (menu) {
		case EMAIL_MAIN_MENU:
			testapp_print ("[MAIN]# ");
			break;
			
		case EMAIL_ACCOUNT_MENU:
			testapp_print ("[ACCOUNT]# ");
			break;
			
		case EMAIL_MAIL_MENU:
			testapp_print ("[MAIL]# ");
			break;
			
		case EMAIL_MAILBOX_MENU:
			testapp_print ("[MAILBOX]# ");
			break;
			
		case EMAIL_RULE_MENU:
			testapp_print ("[RULE]# ");
			break;
			
		case EMAIL_THREAD_MENU:
			testapp_print ("[THREAD]# ");
			break;
			
		case EMAIL_OTHERS_MENU:
			testapp_print ("[OTHERS]# ");
			break;
			
		case EMAIL_GMIME_MENU:
			testapp_print ("[Gmime Test]# ");
			break;

		default:
			break;
	}
}