/[projects]/smsdaemon/smsqueue.cpp
ViewVC logotype

Diff of /smsdaemon/smsqueue.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 158 by torben, Mon Dec 8 21:49:49 2008 UTC revision 196 by torben, Thu Dec 18 06:53:29 2008 UTC
# Line 23  int main(int argc, char* argv[]) Line 23  int main(int argc, char* argv[])
23          string recipient;          string recipient;
24          string message;          string message;
25    
26          if (!(argc == 3 || argc == 4)) {          if (!(argc == 3 || argc == 4))
27            {
28                  printUsage();                  printUsage();
29                  return 0;                  return 0;
30          }          }
31    
32          if ( string(argv[1]) == "-m")          if ( string(argv[1]) == "-m")
33          {          {
34                  if (argc != 4) {                  if (argc != 4)
35                    {
36                          printUsage();                          printUsage();
37                          return 0;                          return 0;
38                  }                  }
39                  message = string(argv[2]);                  message = string(argv[2]);
40                  recipient = string(argv[3]);                  recipient = string(argv[3]);
41          }          }
42          else          else
43          {          {
44                  if (argc != 3) {                  if (argc != 3)
45                    {
46                          printUsage();                          printUsage();
47                          return 0;                          return 0;
48                  }                  }
49                  try {                  try
50                    {
51                          message = Util::readfile(string(argv[1]));                          message = Util::readfile(string(argv[1]));
52                  } catch(exception& e) {                  }
53                    catch (exception& e)
54                    {
55                          cout << e.what() << endl;                          cout << e.what() << endl;
56                          return -1;                          return -1;
57                  }                  }
58                  recipient = string(argv[2]);                  recipient = string(argv[2]);
59          }          }
60            
61          srand(time(0));          srand(time(0));
62    
63          Spooler spool;          Spooler spool;
64    
65          try {          try
66            {
67                  spool.enqueue(recipient,message);                  spool.enqueue(recipient,message);
68                  cout << "enqueued as: " << spool.getFilename() << endl;                  cout << "enqueued as: " << spool.getFilename() << endl;
69          } catch (std::exception& e) {          }
70            catch (std::exception& e)
71            {
72                  cout << e.what() << endl;                  cout << e.what() << endl;
73                  return -1;                  return -1;
74          }          }
75            
76          return 0;          return 0;
77  }  }

Legend:
Removed from v.158  
changed lines
  Added in v.196

  ViewVC Help
Powered by ViewVC 1.1.20