libepp_nicbr
ContactFunctions.H
Go to the documentation of this file.
1 /* ${copyright}$ */
2 /* $Id: ContactFunctions.H 1243 2014-11-14 17:16:47Z rafael $ */
6 #ifndef __CONTACT_FUNCTIONS_H__
7 #define __CONTACT_FUNCTIONS_H__
9 
10 #include "ContactCheck.H"
11 #include "ContactInfo.H"
12 #include "ContactTransfer.H"
13 #include "ContactCreate.H"
14 #include "ContactUpdate.H"
15 #include "ContactDelete.H"
16 
18 
23 int cmd_contact_help(string error_msg, string specific = "")
24 {
25  if (error_msg != "") {
26  printf("error: %s\n", error_msg.c_str());
27  }
28 
29  printf("contact command syntax help:\n");
30  printf("\n");
31 
32  if (specific == "" || specific == "check") {
33  printf(" check <contact1> [contact2 ... contactN]\n");
34  printf("\n");
35  }
36  if (specific == "" || specific == "info") {
37  printf(" info <contact> [-auth authInfoPw]\n");
38  printf("\n");
39  }
40  if (specific == "" || specific == "transfer") {
41  printf(" transfer: <contact> [-auth authInfoPw]\n");
42  printf("\n");
43  }
44  if (specific == "" || specific == "create") {
45  printf(" create <contact>\n");
46  printf(" [-postalInfo <type> <-name \"Contact Name\"> "
47  "[-org \"Org Name\"]\n");
48  printf(" <-street1 \"address street/line 1\"> "
49  "[-street2 \"address number/line 2\"]\n");
50  printf(" [-street3 \"address line 3\"] <-city \"City Name\"> "
51  "[-state \"State or Province\"]\n");
52  printf(" [-pc \"postal code\"] <-cc country-code> ...]\n");
53  printf(" [-voice number:ext] [-fax number:ext]\n");
54  printf(" <-email emailAddr> [-auth authInfoPw]\n");
55  printf(" [-disclose <flag> opt,opt,...] "
56  " [-password \"Password\"]\n"
57  " [-reminder \"Password reminder\"] [-language <lang>]\n");
58  printf("\n");
59  printf(" available values for opt:\n");
60  printf(" {name_int name_loc org_int org_loc addr_int addr_loc "
61  "voice fax email}\n");
62  printf("\n");
63  }
64  if (specific == "" || specific == "delete") {
65  printf(" delete <contact>\n");
66  printf("\n");
67  }
68  if (specific == "" || specific == "renew") {
69  printf(" renew: not implemented\n");
70  printf("\n");
71  }
72  if (specific == "" || specific == "update") {
73  printf(" update <contact> [-add-status st1,...,stN] "
74  "[-rem-status st1,...,stN]\n");
75  printf(" [-postalInfo <type> [-name \"Contact Name\"] "
76  "[-org \"Org Name\"]\n");
77  printf(" [-street1 \"address street/line 1\"] "
78  "[-street2 \"address number/line 2\"]\n");
79  printf(" [-street3 \"address line 3\"] [-city \"City Name\"] "
80  "[-state \"State or Province\"]\n");
81  printf(" [-pc \"postal code\"] [-cc country-code] ...]\n");
82  printf(" [-voice number:ext] [-fax number:ext]\n");
83  printf(" [-email emailAddr] [-auth authInfoPw]\n");
84  printf(" [-disclose <flag> opt,opt,...] "
85  " [-password \"Password\"]\n"
86  " [-reminder \"Password reminder\"] [-language <lang>]\n"
87  " [-add-property \"property\" ...] [-rem-property \"property\" ...]\n");
88  printf("\n");
89  printf(" available values for opt:\n");
90  printf(" {name_int name_loc org_int org_loc addr_int addr_loc "
91  "voice fax email}\n");
92  printf("\n");
93  }
94 
95  if (error_msg != "") {
96  return -1;
97  }
98 
99  return 0;
100 }
101 
103 
107 int cmd_contact_check(vector<string> &args)
108 {
109  ContactCheck act;
110  ContactCheckCmd *cmd = act.get_command();
111 
112  string cmd_name = "check";
113 
114  while (!args.empty()) {
115  cmd->insert_id(args[0]);
116  args.erase(args.begin());
117  }
118 
119  if (cmd->get_id_list().empty()) {
120  return cmd_contact_help("no contact id specified", cmd_name);
121  }
122 
123  if (_debug) {
124  set<string> contacts = cmd->get_id_list();
125  set<string>::const_iterator it;
126  printf("contacts to be checked:\n");
127  for (it = contacts.begin(); it != contacts.end(); it++) {
128  printf(" [%s]\n", (*it).c_str());
129  }
130  } // _debug
131 
132  if (process_action(act) != 0) {
133  return -1;
134  }
135 
136  return 0;
137 }
138 
140 
144 int cmd_contact_info(vector<string> &args)
145 {
146  ContactInfo act;
147  ContactInfoCmd *cmd = act.get_command();
148  string cmd_name = "info";
149 
150  if (args.empty()) {
151  return cmd_contact_help("no contact id specified", cmd_name);
152  }
153 
154  cmd->set_id(args[0]);
155  args.erase(args.begin());
156 
157  while (!args.empty()) {
158  if (args[0] == "-auth") {
159  //set authInfo
160  AuthInfo auth;
161  if (SheppObjSet::authInfo(auth, args) != 0) {
162  return cmd_contact_help("invalid auth", cmd_name);
163  }
164 
165  // roid not allowed in contact commands
166  if (auth.get_roid_f() == true) {
167  return cmd_contact_help("invalid auth", cmd_name);
168  }
169 
170  cmd->set_authInfo(auth);
171  } else {
172  return cmd_contact_help("invalid syntax near \"" + args[0] + "\"",
173  cmd_name);
174  }
175  }
176 
177  if (_debug) {
178  printf("id to get info: [%s]\n", cmd->get_id().c_str());
180  } // _debug
181 
182  if (process_action(act) != 0) {
183  return -1;
184  }
185 
186  return 0;
187 }
188 
190 
194 int cmd_contact_transfer(vector<string> &args)
195 {
196  ContactTransfer act;
197  ContactTransferCmd *cmd = act.get_command();
198  string cmd_name = "transfer";
199 
200  if (args.empty()) {
201  return cmd_contact_help("no contact id specified", cmd_name);
202  }
203 
204  cmd->set_id(args[0]);
205  args.erase(args.begin());
206 
207  while (!args.empty()) {
208  if (args[0] == "-auth") {
209  //set authInfo
210  AuthInfo auth;
211  if (SheppObjSet::authInfo(auth, args) != 0) {
212  return cmd_contact_help("invalid auth", cmd_name);
213  }
214 
215  // roid not allowed in contact commands
216  if (auth.get_roid_f() == true) {
217  return cmd_contact_help("invalid auth", cmd_name);
218  }
219 
220  cmd->set_authInfo(auth);
221  } else {
222  return cmd_contact_help("invalid syntax near \"" + args[0] + "\"",
223  cmd_name);
224  }
225  }
226 
227  if (process_action(act) != 0) {
228  return -1;
229  }
230 
231  return 0;
232 }
233 
235 
239 int cmd_contact_create(vector<string> &args)
240 {
241  ContactCreate act;
242  ContactCreateCmd *cmd = act.get_command();
243  string cmd_name = "create";
244 
245  if (args.empty()) {
246  return cmd_contact_help("no contact id specified", cmd_name);
247  }
248 
249  CommonData common_data;
250 
251  common_data.set_id(args[0]);
252  args.erase(args.begin());
253 
254  //authInfo defaults to empty
255  AuthInfo auth;
256  cmd->set_authInfo(auth);
257 
258  while (!args.empty()) {
259  if (args[0] == "-postalInfo") {
260  //postalInfo
261  args.erase(args.begin());
262  if (args.empty()) {
263  return cmd_contact_help("missing postal info arguments", cmd_name);
264  }
265  PostalInfo postal;
266  string error_msg;
267  if (SheppObjSet::postalInfo(postal, args, error_msg, false) != 0) {
268  return cmd_contact_help(error_msg, cmd_name);
269  }
270  vector<PostalInfo> postal_list = common_data.get_postal_info();
271  for (int i = 0; i < (int) postal_list.size(); i++) {
272  if (postal_list[i].get_type() == postal.get_type()) {
273  return cmd_contact_help("duplicated postal info type", cmd_name);
274  }
275  }
276  common_data.insert_postal_info(postal);
277  } else if (args[0] == "-voice") {
278  //voice
279  args.erase(args.begin());
280  CommonData::Phone phone;
281  if (SheppObjSet::phone(phone, args) != 0) {
282  return cmd_contact_help("error setting voice telephone number",
283  cmd_name);
284  }
285  common_data.set_voice(phone);
286  } else if (args[0] == "-fax") {
287  //fax
288  args.erase(args.begin());
289  CommonData::Phone phone;
290  if (SheppObjSet::phone(phone, args) != 0) {
291  return cmd_contact_help("error setting fax telephone number",
292  cmd_name);
293  }
294  common_data.set_fax(phone);
295  } else if (args[0] == "-email") {
296  //email
297  args.erase(args.begin());
298  if (args.empty()) {
299  return cmd_contact_help("no e-mail address specified", cmd_name);
300  }
301  common_data.set_email(args[0]);
302  args.erase(args.begin());
303  } else if (args[0] == "-auth") {
304  //auth
305  AuthInfo auth;
306  if (SheppObjSet::authInfo(auth, args) != 0) {
307  return cmd_contact_help("invalid auth", cmd_name);
308  }
309 
310  // roid not allowed in contact commands
311  if (auth.get_roid_f() == true) {
312  return cmd_contact_help("invalid auth", cmd_name);
313  }
314 
315  cmd->set_authInfo(auth);
316  } else if (args[0] == "-disclose") {
317  //disclose
318  args.erase(args.begin());
319  CommonData::Disclose disclose;
320 
321  if (args[0] != "0" && args[0] != "1") {
322  return cmd_contact_help("disclose flag must be '0' or '1'", cmd_name);
323  }
324  disclose.flag = atoi(args[0].c_str());
325  args.erase(args.begin());
326 
327  if (SheppObjSet::disclose(disclose, args[0]) != 0) {
328  return cmd_contact_help("invalid diclose information", cmd_name);
329  }
330  args.erase(args.begin());
331  common_data.set_disclose(disclose);
332 
333  } else if (args[0] == "-password") {
334  //password
335  args.erase(args.begin());
336 
337  if (args.empty()) {
338  return cmd_contact_help("unspecified password", cmd_name);
339  }
340 
341  string password = args[0];
342  args.erase(args.begin());
343 
344  if (SheppStrUtil::quote_gathering(args, password) != 0) {
345  return cmd_contact_help("error setting password", cmd_name);
346  }
347 
348  cmd->set_password(password);
349 
350  } else if (args[0] == "-reminder") {
351  //reminder
352  args.erase(args.begin());
353 
354  if (args.empty()) {
355  return cmd_contact_help("unspecified reminder", cmd_name);
356  }
357 
358  string reminder = args[0];
359  args.erase(args.begin());
360 
361  if (SheppStrUtil::quote_gathering(args, reminder) != 0) {
362  return cmd_contact_help("error setting reminder", cmd_name);
363  }
364 
365  cmd->set_reminder(reminder);
366 
367  } else if (args[0] == "-language") {
368  //language
369  args.erase(args.begin());
370 
371  if (args.empty()) {
372  return cmd_contact_help("unspecified language", cmd_name);
373  }
374 
375  string language = args[0];
376  args.erase(args.begin());
377 
378  if (SheppStrUtil::quote_gathering(args, language) != 0) {
379  return cmd_contact_help("error setting language", cmd_name);
380  }
381 
382  cmd->set_language(language);
383 
384  } else {
385  return cmd_contact_help("invalid syntax near \"" + args[0] + "\"",
386  cmd_name);
387  }
388  }
389 
390  if (common_data.get_postal_info().empty()) {
391  return cmd_contact_help("at least one postal info must be entered",
392  cmd_name);
393  }
394 
395  if (common_data.get_email() == "") {
396  return cmd_contact_help("e-mail is mandatory", cmd_name);
397  }
398 
399  cmd->set_common_data(common_data);
400 
401  // If at least one of the fields were informed, they should all be
402  // informed!
403  if (!cmd->get_password().empty() ||
404  !cmd->get_reminder().empty() ||
405  !cmd->get_language().empty()) {
406  if (cmd->get_password().empty()) {
407  return cmd_contact_help("password is mandatory", cmd_name);
408  }
409  if (cmd->get_reminder().empty()) {
410  return cmd_contact_help("reminder is mandatory", cmd_name);
411  }
412  if (cmd->get_language().empty()) {
413  return cmd_contact_help("language is mandatory", cmd_name);
414  }
415  }
416 
417  if (_debug) {
418  printf(" contact id: [%s]\n", cmd->get_common_data().get_id().c_str());
419 
420  vector<PostalInfo>::const_iterator it;
421  vector<PostalInfo> postal_list;
422  postal_list = cmd->get_common_data().get_postal_info();
423  for (it = postal_list.begin(); it != postal_list.end(); it++) {
425  }
426 
427  if (cmd->get_common_data().get_voice().number != "") {
428  printf(" voice:");
430  }
431 
432  if (cmd->get_common_data().get_fax().number != "") {
433  printf(" fax :");
435  }
436 
437  printf(" email: [%s]\n", cmd->get_common_data().get_email().c_str());
438 
440 
441  if (cmd->get_common_data().get_disclose().is_set()) {
443  }
444 
445  //lacniccontact
446  if (!cmd->get_password().empty() ||
447  !cmd->get_reminder().empty() ||
448  !cmd->get_language().empty()) {
449  printf(" password: [%s]\n", cmd->get_password().c_str());
450  printf(" reminder: [%s]\n", cmd->get_reminder().c_str());
451  printf(" language: [%s]\n", cmd->get_language().c_str());
452  }
453  } // _debug
454 
455  if (process_action(act) != 0) {
456  return -1;
457  }
458 
459  return 0;
460 }
461 
463 
467 int cmd_contact_delete(vector<string> &args)
468 {
469  ContactDelete act;
470  ContactDeleteCmd *cmd = act.get_command();
471  string cmd_name = "delete";
472 
473  if (args.empty()) {
474  return cmd_contact_help("no contact id specified", cmd_name);
475  }
476 
477  cmd->set_id(args[0]);
478  args.erase(args.begin());
479 
480  if (process_action(act) != 0) {
481  return -1;
482  }
483 
484  return 0;
485 }
486 
488 
492 int cmd_contact_renew(vector<string> &args)
493 {
494  string cmd_name = "renew";
495  return cmd_contact_help("", cmd_name);
496 }
497 
499 
503 int cmd_contact_update(vector<string> &args)
504 {
505  ContactUpdate act;
506  ContactUpdateCmd *cmd = act.get_command();
507  string cmd_name = "update";
508 
509  if (args.empty()) {
510  return cmd_contact_help("no contact id specified", cmd_name);
511  }
512 
513  CommonData common_data;
514 
515  common_data.set_id(args[0]);
516  args.erase(args.begin());
517 
518  while (!args.empty()) {
519  if (args[0] == "-add-status") {
520  //add-status
521  args.erase(args.begin());
522  if (args.empty()) {
523  return cmd_contact_help("error setting add-status", cmd_name);
524  }
525  string tmp1 = args[0];
526  string tmp2;
527  while (SheppStrUtil::split(tmp1, tmp1, tmp2, ",", true) == 0) {
528  cmd->insert_status_list_add(tmp1);
529  if (tmp2 == "") {
530  break;
531  }
532  tmp1 = tmp2;
533  }
534  args.erase(args.begin());
535  } else if (args[0] == "-rem-status") {
536  //rem-status
537  args.erase(args.begin());
538  if (args.empty()) {
539  return cmd_contact_help("error setting rem-status", cmd_name);
540  }
541  string tmp1 = args[0];
542  string tmp2;
543  while (SheppStrUtil::split(tmp1, tmp1, tmp2, ",", true) == 0) {
544  cmd->insert_status_list_rem(tmp1);
545  if (tmp2 == "") {
546  break;
547  }
548  tmp1 = tmp2;
549  }
550  args.erase(args.begin());
551  } else if (args[0] == "-postalInfo") {
552  //postalInfo
553  args.erase(args.begin());
554  if (args.empty()) {
555  return cmd_contact_help("missing postal info arguments", cmd_name);
556  }
557  PostalInfo postal;
558  string error_msg;
559  if (SheppObjSet::postalInfo(postal, args, error_msg, true) != 0) {
560  return cmd_contact_help(error_msg, cmd_name);
561  }
562  vector<PostalInfo> postal_list = common_data.get_postal_info();
563  for (int i = 0; i < (int) postal_list.size(); i++) {
564  if (postal_list[i].get_type() == postal.get_type()) {
565  return cmd_contact_help("duplicated postal info type", cmd_name);
566  }
567  }
568  common_data.insert_postal_info(postal);
569  } else if (args[0] == "-voice") {
570  //voice
571  args.erase(args.begin());
572  CommonData::Phone phone;
573  if (SheppObjSet::phone(phone, args) != 0) {
574  return cmd_contact_help("error setting voice telephone number",
575  cmd_name);
576  }
577  common_data.set_voice(phone);
578  } else if (args[0] == "-fax") {
579  //fax
580  args.erase(args.begin());
581  CommonData::Phone phone;
582  if (SheppObjSet::phone(phone, args) != 0) {
583  return cmd_contact_help("error setting fax telephone number",
584  cmd_name);
585  }
586  common_data.set_fax(phone);
587  } else if (args[0] == "-email") {
588  //email
589  args.erase(args.begin());
590  if (args.empty()) {
591  return cmd_contact_help("no e-mail address specified", cmd_name);
592  }
593  common_data.set_email(args[0]);
594  args.erase(args.begin());
595  } else if (args[0] == "-auth") {
596  //auth
597  AuthInfo auth;
598  if (SheppObjSet::authInfo(auth, args) != 0) {
599  return cmd_contact_help("invalid auth", cmd_name);
600  }
601 
602  // roid not allowed in update command
603  if (auth.get_roid_f() == true) {
604  return cmd_contact_help("invalid auth", cmd_name);
605  }
606 
607  cmd->set_authInfo(auth);
608  } else if (args[0] == "-disclose") {
609  //disclose
610  args.erase(args.begin());
611  CommonData::Disclose disclose;
612 
613  if (args[0] != "0" && args[0] != "1") {
614  return cmd_contact_help("disclose flag must be '0' or '1'", cmd_name);
615  }
616  disclose.flag = atoi(args[0].c_str());
617  args.erase(args.begin());
618 
619  if (SheppObjSet::disclose(disclose, args[0]) != 0) {
620  return cmd_contact_help("invalid diclose information", cmd_name);
621  }
622  args.erase(args.begin());
623  common_data.set_disclose(disclose);
624 
625  } else if (args[0] == "-password") {
626  //password
627  args.erase(args.begin());
628 
629  if (args.empty()) {
630  return cmd_contact_help("unspecified password", cmd_name);
631  }
632 
633  string password = args[0];
634  args.erase(args.begin());
635 
636  if (SheppStrUtil::quote_gathering(args, password) != 0) {
637  return cmd_contact_help("error setting password", cmd_name);
638  }
639 
640  cmd->set_password(password);
641 
642  } else if (args[0] == "-reminder") {
643  //reminder
644  args.erase(args.begin());
645 
646  if (args.empty()) {
647  return cmd_contact_help("unspecified reminder", cmd_name);
648  }
649 
650  string reminder = args[0];
651  args.erase(args.begin());
652 
653  if (SheppStrUtil::quote_gathering(args, reminder) != 0) {
654  return cmd_contact_help("error setting reminder", cmd_name);
655  }
656 
657  cmd->set_reminder(reminder);
658 
659  } else if (args[0] == "-language") {
660  //language
661  args.erase(args.begin());
662 
663  if (args.empty()) {
664  return cmd_contact_help("unspecified language", cmd_name);
665  }
666 
667  string language = args[0];
668  args.erase(args.begin());
669 
670  if (SheppStrUtil::quote_gathering(args, language) != 0) {
671  return cmd_contact_help("error setting language", cmd_name);
672  }
673 
674  cmd->set_language(language);
675 
676  } else if (args[0] == "-add-property") {
677  // property
678  args.erase(args.begin());
679 
680  if (args.empty()) {
681  return cmd_contact_help("unspecified property to add", cmd_name);
682  }
683 
684  string property = args[0];
685  args.erase(args.begin());
686 
687  if (SheppStrUtil::quote_gathering(args, property) != 0) {
688  return cmd_contact_help("error setting property to add", cmd_name);
689  }
690 
691  cmd->insert_property_add(property);
692 
693  } else if (args[0] == "-rem-property") {
694  // property
695  args.erase(args.begin());
696 
697  if (args.empty()) {
698  return cmd_contact_help("unspecified property to remove", cmd_name);
699  }
700 
701  string property = args[0];
702  args.erase(args.begin());
703 
704  if (SheppStrUtil::quote_gathering(args, property) != 0) {
705  return cmd_contact_help("error setting property to remove", cmd_name);
706  }
707 
708  cmd->insert_property_rem(property);
709 
710  } else {
711  return cmd_contact_help("invalid syntax near \"" + args[0] + "\"",
712  cmd_name);
713  }
714  }
715 
716  if (cmd->get_status_list_add().empty() &&
717  cmd->get_status_list_rem().empty() &&
718  common_data.get_postal_info().empty() &&
719  common_data.get_voice().number == "" &&
720  common_data.get_fax().number == "" &&
721  common_data.get_email() == "" &&
722  cmd->get_authInfo().get_pw() == "" &&
723  !common_data.get_disclose().is_set() &&
724  cmd->get_password().empty() &&
725  cmd->get_reminder().empty() &&
726  cmd->get_language().empty() &&
727  cmd->get_properties_add().empty() &&
728  cmd->get_properties_rem().empty()) {
729  return cmd_contact_help("you didn't set a thing", cmd_name);
730  }
731 
732  cmd->set_common_data(common_data);
733 
734  if (_debug) {
735  printf(" contact id: [%s]\n", cmd->get_common_data().get_id().c_str());
736 
737  set<string> status = cmd->get_status_list_add();
738  set<string>::const_iterator st_it;
739  if (!status.empty()) {
740  printf(" status to add: [ ");
741  for (st_it = status.begin(); st_it != status.end(); st_it++) {
742  printf("%s ", (*st_it).c_str());
743  }
744  printf("]\n");
745  }
746 
747  status = cmd->get_status_list_rem();
748  if (!status.empty()) {
749  printf(" status to rem: [ ");
750  for (st_it = status.begin(); st_it != status.end(); st_it++) {
751  printf("%s ", (*st_it).c_str());
752  }
753  printf("]\n");
754  }
755 
756  vector<PostalInfo>::const_iterator it;
757  vector<PostalInfo> postal_list;
758  postal_list = cmd->get_common_data().get_postal_info();
759  for (it = postal_list.begin(); it != postal_list.end(); it++) {
761  }
762 
763  if (cmd->get_common_data().get_voice_f()) {
764  printf(" voice:");
766  }
767 
768  if (cmd->get_common_data().get_fax_f()) {
769  printf(" fax :");
771  }
772 
773  if (cmd->get_common_data().get_email_f()) {
774  printf(" email: [%s]\n", cmd->get_common_data().get_email().c_str());
775  }
776 
777  if (cmd->get_authInfo().get_pw() != "") {
779  }
780 
781  if (cmd->get_common_data().get_disclose().is_set()) {
783  }
784 
785  if (!cmd->get_password().empty()) {
786  printf(" password: [%s]\n", cmd->get_password().c_str());
787  }
788 
789  if (!cmd->get_reminder().empty()) {
790  printf(" reminder: [%s]\n", cmd->get_reminder().c_str());
791  }
792 
793  if (!cmd->get_language().empty()) {
794  printf(" language: [%s]\n", cmd->get_language().c_str());
795  }
796 
797  vector<string> propertiesAdd = cmd->get_properties_add();
798  for (int i = 0; i < propertiesAdd.size(); i++) {
799  printf(" property to add: [%s]\n", propertiesAdd[i].c_str());
800  }
801 
802  vector<string> propertiesRem = cmd->get_properties_rem();
803  for (int i = 0; i < propertiesRem.size(); i++) {
804  printf(" property to rem: [%s]\n", propertiesRem[i].c_str());
805  }
806  } // _debug
807 
808  if (process_action(act) != 0) {
809  return -1;
810  }
811 
812  return 0;
813 }
814 
816 
820 int cmd_contact(vector<string> &args)
821 {
822  // contact command processing
823  if (!args.empty() && !(args[0] == "help")) {
824  if (args[0] == "check") {
825  args.erase(args.begin());
826  return cmd_contact_check(args);
827  } else if (args[0] == "info") {
828  args.erase(args.begin());
829  return cmd_contact_info(args);
830  } else if (args[0] == "transfer") {
831  args.erase(args.begin());
832  return cmd_contact_transfer(args);
833  } else if (args[0] == "create") {
834  args.erase(args.begin());
835  return cmd_contact_create(args);
836  } else if (args[0] == "delete") {
837  args.erase(args.begin());
838  return cmd_contact_delete(args);
839  } else if (args[0] == "renew") {
840  args.erase(args.begin());
841  return cmd_contact_renew(args);
842  } else if (args[0] == "update") {
843  args.erase(args.begin());
844  return cmd_contact_update(args);
845  } else {
846  return cmd_contact_help("invalid command: contact " + args[0]);
847  }
848  }
849 
850  return cmd_contact_help("");
851 }
852 
853 #endif //__CONTACT_FUNCTIONS_H__
void set_id(const string &id)
Sets the contact's id.
Definition: ContactInfoCmd.H:37
void set_authInfo(const AuthInfo &authInfo)
Sets authorization information.
Definition: ContactTransferCmd.H:56
string get_id() const
Returns the contact's id.
Definition: ContactInfoCmd.H:43
void set_id(const string &id)
id to be deleted
Definition: ContactDeleteCmd.H:37
ContactUpdateCmd * get_command()
Returns raw pointer to the command.
Definition: ContactUpdate.H:57
int cmd_contact_check(vector< string > &args)
contact check command function
Definition: ContactFunctions.H:107
static int split(string input, string &first, string &second, string splitter, bool relaxed=false)
Definition: SheppStrUtil.H:120
AuthInfo get_authInfo() const
Returns authorization information.
Definition: ContactUpdateCmd.H:96
void set_id(const string &id)
Sets the object's id.
bool get_email_f() const
Returns the object's email change flag.
Definition: CommonData.H:623
string get_email() const
Returns the object's email.
ContactCreateCmd * get_command()
Returns raw pointer to the command.
Definition: ContactCreate.H:57
void set_password(const string &password)
Sets password attribute.
Definition: ContactCreateCmd.H:72
void insert_property_add(const string &property)
Adds a property to the vector of properties.
Definition: ContactUpdateCmd.H:165
Disclose get_disclose() const
Returns the object's disclosure policy.
int cmd_contact_delete(vector< string > &args)
contact delete command function
Definition: ContactFunctions.H:467
void set_disclose(const Disclose &disclose)
Sets the object's disclosure policy.
bool get_fax_f() const
Returns the object's fax change flag.
Definition: CommonData.H:608
void set_email(const string &email)
Sets the object's email.
static void authInfo(AuthInfo auth)
prints an AuthInfo object
Definition: SheppPrint.H:21
static int phone(CommonData::Phone &phone, vector< string > &words)
fills a Phone based on input command line
Definition: SheppObjSet.H:546
void insert_status_list_add(const string &status_add)
Inserts a status to the object.
Definition: ContactUpdateCmd.H:42
EPP ContactInfoCmd Class.
Definition: ContactInfoCmd.H:22
string get_language() const
Returns the language.
Definition: ContactUpdateCmd.H:147
EPP ContactInfo Class.
Definition: ContactInfo.H:23
EPP ContactTransferCmd Class.
Definition: ContactTransferCmd.H:21
EPP ContactUpdate Class.
AuthInfo get_authInfo()
Returns authorization information.
Definition: ContactCreateCmd.H:66
EPP ContactCheck Class.
Definition: ContactCheck.H:23
set< string > get_status_list_add() const
Returns the list of status to be added to the object.
Definition: ContactUpdateCmd.H:60
PostalInfo class.
Definition: CommonData.H:281
void set_fax(const Phone &fax)
Sets the object's fax number.
string get_reminder() const
Returns the reminder.
Definition: ContactUpdateCmd.H:129
void insert_postal_info(const PostalInfo &postal_info)
Inserts postal information into the object.
string get_password() const
Returns the password.
Definition: ContactUpdateCmd.H:111
set< string > get_status_list_rem() const
Returns the list of status to be removed from the object.
Definition: ContactUpdateCmd.H:66
void insert_property_rem(const string &property)
Adds a property to be removed from the contact.
Definition: ContactUpdateCmd.H:193
int cmd_contact(vector< string > &args)
main contact command
Definition: ContactFunctions.H:820
set< string > get_id_list() const
Returns contact id list.
Definition: ContactCheckCmd.H:44
ContactInfoCmd * get_command()
Returns raw pointer to the command.
Definition: ContactInfo.H:57
void set_authInfo(const AuthInfo &authInfo)
Sets authorization information.
Definition: ContactInfoCmd.H:56
int cmd_contact_transfer(vector< string > &args)
contact transfer command function
Definition: ContactFunctions.H:194
Phone get_fax() const
Returns the object's fax number.
void set_reminder(const string &reminder)
Sets reminder attribute.
Definition: ContactUpdateCmd.H:120
void set_authInfo(const AuthInfo &authInfo)
Sets authorization information.
Definition: ContactUpdateCmd.H:87
CommonData get_common_data() const
Returns the common data object.
Definition: ContactUpdateCmd.H:81
void set_authInfo(const AuthInfo &authInfo)
Sets authorization information.
Definition: ContactCreateCmd.H:57
EPP ContactTransfer Class.
Definition: ContactTransfer.H:23
void set_common_data(const CommonData &common)
Sets the common data object.
Definition: ContactUpdateCmd.H:72
void set_reminder(const string &reminder)
Sets reminder attribute.
Definition: ContactCreateCmd.H:90
EPP ContactCheck Class.
void set_voice(const Phone &voice)
Sets the object's voice telephone number.
EPP ContactUpdate Class.
Definition: ContactUpdate.H:23
vector< string > get_properties_rem()
Definition: ContactUpdateCmd.H:203
EPP ContactCreateCmd Class.
Definition: ContactCreateCmd.H:26
static void postal_info(PostalInfo postal)
prints a PostalInfo object
Definition: SheppPrint.H:53
bool get_roid_f() const
Returns the roid change flag.
Definition: CommonData.H:121
int process_action(Action &act)
Send and EPP Action.
Definition: SheppCommandFunctions.H:871
string get_password() const
Returns the password.
Definition: ContactCreateCmd.H:81
Definition: CommonData.H:491
string get_reminder() const
Returns the reminder.
Definition: ContactCreateCmd.H:99
vector< PostalInfo > get_postal_info() const
Returns the object's postal information.
EPP ContactCheckCmd Class.
Definition: ContactCheckCmd.H:23
int cmd_contact_info(vector< string > &args)
contact info command function
Definition: ContactFunctions.H:144
EPP ContactTransfer Class.
int cmd_contact_renew(vector< string > &args)
contact renew command function
Definition: ContactFunctions.H:492
static void disclose(CommonData::Disclose disclose)
prints a Disclose object
Definition: SheppPrint.H:106
CommonData get_common_data() const
Returns a common data object raw pointer.
Definition: ContactCreateCmd.H:51
static int postalInfo(PostalInfo &postal, vector< string > &words, string &error_msg, bool relaxed)
fills a PostalInfo based on input command line
Definition: SheppObjSet.H:357
EPP CommonData Class.
Definition: CommonData.H:487
vector< string > get_properties_add()
Definition: ContactUpdateCmd.H:175
EPP ContactDelete Class.
ContactTransferCmd * get_command()
Returns raw pointer to the command.
Definition: ContactTransfer.H:57
Phone get_voice() const
Returns the object's voice telephone number.
string get_pw() const
Returns the password.
Definition: CommonData.H:140
int cmd_contact_create(vector< string > &args)
contact create command function
Definition: ContactFunctions.H:239
ContactDeleteCmd * get_command()
Returns raw pointer to the command.
Definition: ContactDelete.H:56
bool get_voice_f() const
Returns the object's voice change flag.
Definition: CommonData.H:593
AuthInfo get_authInfo() const
Returns authorization information.
Definition: ContactInfoCmd.H:65
EPP command-line shell client command functions include file.
static int disclose(CommonData::Disclose &disclose, string word)
fills a Disclose based on input command line
Definition: SheppObjSet.H:563
Definition: CommonData.H:524
ContactCheckCmd * get_command()
Returns raw pointer to the command.
Definition: ContactCheck.H:57
void insert_status_list_rem(const string &status_rem)
Removes a status from the object.
Definition: ContactUpdateCmd.H:51
void insert_id(const string &id)
Inserts an id into id list.
Definition: ContactCheckCmd.H:38
void set_id(const string &id)
Sets contact ID.
Definition: ContactTransferCmd.H:37
static int quote_gathering(vector< string > &words, string &gather)
Gathers command-line arguments bounded by quotes in a string.
Definition: SheppStrUtil.H:152
void set_language(const string &language)
Sets language attribute.
Definition: ContactCreateCmd.H:108
int cmd_contact_help(string error_msg, string specific="")
print contact command usage info
Definition: ContactFunctions.H:23
void set_common_data(const CommonData &common)
Sets the common data object.
Definition: ContactCreateCmd.H:42
void set_password(const string &password)
Sets password attribute.
Definition: ContactUpdateCmd.H:102
EPP ContactInfo Class.
int cmd_contact_update(vector< string > &args)
contact update command function
Definition: ContactFunctions.H:503
EPP ContactUpdateCmd Class.
Definition: ContactUpdateCmd.H:26
EPP ContactCreate Class.
EPP ContactDelete Class.
Definition: ContactDelete.H:22
string get_id() const
Returns the object's id.
EPP ContactCreate Class.
Definition: ContactCreate.H:23
EPP ContactDeleteCmd Class.
Definition: ContactDeleteCmd.H:21
string get_language() const
Returns the language.
Definition: ContactCreateCmd.H:117
static int authInfo(AuthInfo &auth, vector< string > &words)
fills an AuthInfo based on input command line
Definition: SheppObjSet.H:54
void set_language(const string &language)
Sets language attribute.
Definition: ContactUpdateCmd.H:138
static void phone(CommonData::Phone phone)
prints a Phone object
Definition: SheppPrint.H:96
AuthInfo Class.
Definition: CommonData.H:83