Tizen 2.0 Release
[platform/core/messaging/email-service.git] / utilities / test-application / testapp-utility.c
1 /*
2 *  email-service
3 *
4 * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
5 *
6 * Contact: Kyuho Jo <kyuho.jo@samsung.com>, Sunghyun Kwon <sh0701.kwon@samsung.com>
7
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 *
20 */
21
22
23
24 /* common header */
25 #include <stdarg.h>
26 #include <string.h>
27
28 /* open header */
29 #include <glib.h>
30 #include <glib/gprintf.h>
31
32 /* internal header */
33 #include "testapp-utility.h"
34
35 /* internal data struct */
36
37 void testapp_print (char *fmt, ...)
38 {
39         va_list args = {0};
40         va_start(args, fmt);
41         vfprintf (stdout, fmt, args);
42         va_end (args);
43         fflush (stdout);
44 }
45
46 void testapp_show_menu (eEMAIL_MENU menu)
47 {
48         switch (menu) {
49                 case EMAIL_MAIN_MENU:
50                         testapp_print ("==========================================\n");
51                         testapp_print ("    Email test application \n");
52                         testapp_print ("==========================================\n");
53                         testapp_print ("1. Account Test\n");
54                         testapp_print ("2. Mail Test\n");
55                         testapp_print ("3. Mailbox Test\n");
56                         testapp_print ("5. Rule Test\n");
57                         testapp_print ("6. Thread Test\n");
58                         testapp_print ("7. Others\n");
59                         testapp_print ("0. Exit \n");
60                         testapp_print ("------------------------------------------\n");
61                         break;
62                         
63                 case EMAIL_ACCOUNT_MENU:
64                         testapp_print ("==========================================\n");
65                         testapp_print ("    ACCOUNT MENU \n");
66                         testapp_print ("==========================================\n");
67                         testapp_print (" 1.  Create account\n");
68                         testapp_print (" 2.  Update account\n");
69                         testapp_print (" 3.  Delete account\n");
70                         testapp_print (" 4.  Get account\n");
71                         testapp_print (" 5.  Get account list\n");
72                         testapp_print (" 7.  Validate account\n");
73                         testapp_print (" 8.  Cancel validate Account\n");
74                         testapp_print (" 9.  Backup All accounts\n");
75                         testapp_print (" 10. Restore accounts\n");
76                         testapp_print (" 11. Get password length of account\n");
77                         testapp_print (" 12. Query server info\n");
78                         testapp_print (" 13. Clear all notifications\n");
79                         testapp_print (" 14. Save default account ID\n");
80                         testapp_print (" 15. Load default account ID\n");
81                         testapp_print (" 16. Add certificate\n");
82                         testapp_print (" 17. Get certificate\n");
83                         testapp_print (" 18. Delete certificate\n");
84                         testapp_print (" 0.  Go to Main Menu\n");
85                         testapp_print ("------------------------------------------\n");
86                         break;
87                         
88                 case EMAIL_MAIL_MENU:
89                         testapp_print ("==========================================\n");
90                         testapp_print ("    MAIL MENU\n");
91                         testapp_print ("==========================================\n");
92                         testapp_print ("1.  Get mails\n");
93                         testapp_print ("2.  Send a mail\n");
94                         testapp_print ("3.  Get mail list ex\n");
95                         testapp_print ("4.  Add Attachment\n");
96                         testapp_print ("5.  Set deleted flag\n");
97                         testapp_print ("6.  Expunge deleted flagged mails\n");
98                         testapp_print ("7.  Send read receipt\n");
99                         testapp_print ("8.  Delete attachment\n");
100                         testapp_print ("9.  Mail Count \n");
101                         testapp_print ("10. Move mails to another account\n");
102                         testapp_print ("11. Send mail with downloading attachment of original mail\n");
103                         testapp_print ("14. Delete a mail \n");
104                         testapp_print ("16. Download mail body\n");
105                         testapp_print ("17. Download an attachment\n");
106                         testapp_print ("20. Delete all mail\n");
107                         testapp_print ("21. Move Mail \n");
108                         testapp_print ("23. Resend Mail \n");
109                         testapp_print ("27. Move all mails to mailbox\n");
110                         testapp_print ("38. Get total email disk usage \n");    
111                         testapp_print ("40. Verify Email Address Format\n");
112                         testapp_print ("41. Get Max Mail Count\n");
113                         testapp_print ("42. Storage test : (Input : to fields)\n");
114                         testapp_print ("43. Send mail Cancel\n");
115                         testapp_print ("44. Cancel Download Body\n");
116                         testapp_print ("46. Get thread list\n");
117                         testapp_print ("48. Get thread information\n");
118                         testapp_print ("51. Get mail list\n");
119                         testapp_print ("52. Get address info list\n");
120                         testapp_print ("55. Set a field of flags\n");
121                         testapp_print ("56. Add mail\n");
122                         testapp_print ("57. Update mail\n");
123                         testapp_print ("58. Search on server\n");
124                         testapp_print ("59. Add mail to search result table\n");
125                         testapp_print ("60. Parse mime file\n");
126                         testapp_print ("61. Write mime file\n");
127                         testapp_print ("0.  Go to Main Menu\n");
128                         testapp_print ("------------------------------------------\n");
129                         break;
130                         
131                 case EMAIL_MAILBOX_MENU:
132                         testapp_print ("==========================================\n");
133                         testapp_print ("   MAILBOX MENU\n");
134                         testapp_print ("==========================================\n");
135                         testapp_print (" 1. Add mailbox\n");
136                         testapp_print (" 2. Delete mailbox\n");
137                         testapp_print (" 3. Raname mailbox\n");
138                         testapp_print (" 4. Get IMAP mailbox List\n");
139                         testapp_print (" 5. Set local mailbox\n");
140                         testapp_print (" 6. Delete mailbox ex\n");
141                         testapp_print (" 7. Get mailbox by mailbox type\n");
142                         testapp_print (" 8. Set mailbox type\n");
143                         testapp_print (" 9. Set mail slot size\n");
144                         testapp_print ("10. Get mailbox list\n");
145                         testapp_print ("11. Sync mailbox\n");
146                         testapp_print ("12. Stamp sync time\n");
147                         testapp_print ("0. Go to Main Menu\n");
148                         testapp_print ("------------------------------------------\n");
149                         break;
150                         
151                 case EMAIL_RULE_MENU:
152                         testapp_print ("==========================================\n");
153                         testapp_print ("   RULE MENU\n");
154                         testapp_print ("==========================================\n");
155                         testapp_print ("1. Add Rule\n");
156                         testapp_print ("2. Delete Rule\n");
157                         testapp_print ("3. Update Rule\n");
158                         testapp_print ("5. Get Rule\n");
159                         testapp_print ("6. Get Rule List\n");
160                         testapp_print ("0. Go to Main Menu\n");
161                         testapp_print ("------------------------------------------\n");
162                         break;
163                         
164                 case EMAIL_THREAD_MENU:
165                         testapp_print ("==========================================\n");
166                         testapp_print ("   TRHEAD MENU\n");
167                         testapp_print ("==========================================\n");
168                         testapp_print ("1. Move Thread\n");
169                         testapp_print ("2. Delete Thread\n");
170                         testapp_print ("3. Set Seen Flag of Thread\n");
171                         testapp_print ("0. Go to Main Menu\n");
172                         testapp_print ("------------------------------------------\n");
173                         break;
174                         
175                 case EMAIL_OTHERS_MENU:
176                         testapp_print ("==========================================\n");
177                         testapp_print ("   OTHERS\n");
178                         testapp_print ("==========================================\n");
179                         testapp_print ("1.  Get Network Status\n");
180                         testapp_print ("2.  Get Pending Job\n");
181                         testapp_print ("3.  Cancel Job\n");
182                         testapp_print ("5.  Set DNET Proper Profile Type\n");
183                         testapp_print ("6.  Get DNET Proper Profile Type\n");
184                         testapp_print ("7.  Get preview text\n");
185                         testapp_print ("11. Print receiving event queue via debug msg\n");
186                         testapp_print ("12. Create DB full\n");
187                         testapp_print ("13. Encoding Test\n");
188                         testapp_print ("14. DTT Test\n");
189                         testapp_print ("15. Show User Message\n");
190                         testapp_print ("16. Get mime entity in signed file\n");
191                         testapp_print ("0.  Go to Main Menu\n");
192                         testapp_print ("------------------------------------------\n");
193                         break;
194                         
195                 default:
196                         break;
197         }
198 }
199 void testapp_show_prompt (eEMAIL_MENU menu)
200 {
201         switch (menu) {
202                 case EMAIL_MAIN_MENU:
203                         testapp_print ("[MAIN]# ");
204                         break;
205                         
206                 case EMAIL_ACCOUNT_MENU:
207                         testapp_print ("[ACCOUNT]# ");
208                         break;
209                         
210                 case EMAIL_MAIL_MENU:
211                         testapp_print ("[MAIL]# ");
212                         break;
213                         
214                 case EMAIL_MAILBOX_MENU:
215                         testapp_print ("[MAILBOX]# ");
216                         break;
217                         
218                 case EMAIL_RULE_MENU:
219                         testapp_print ("[RULE]# ");
220                         break;
221                         
222                 case EMAIL_THREAD_MENU:
223                         testapp_print ("[THREAD]# ");
224                         break;
225                         
226                 case EMAIL_OTHERS_MENU:
227                         testapp_print ("[OTHERS]# ");
228                         break;
229                         
230                 default:
231                         break;
232         }
233 }
234
235