Changeset 1120 for trunk/auto-reply

Show
Ignore:
Timestamp:
02/22/00 04:36:51 (9 years ago)
Author:
graham
Message:

Added delete new messages option to not automatically delete new messages
after auto-replying to them.

Location:
trunk/auto-reply
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • trunk/auto-reply/configure.in

    r1084 r1120  
    66 
    77dnl All versioning is done via the following line 
    8 AM_INIT_AUTOMAKE(Licq-AutoReply, 0.12) 
     8AM_INIT_AUTOMAKE(Licq-AutoReply, 0.15) 
    99AM_CONFIG_HEADER(config.h) 
    1010 
  • trunk/auto-reply/src/autoreply.cpp

    r809 r1120  
    2929 * CLicqAutoReply::Constructor 
    3030 *-------------------------------------------------------------------------*/ 
    31 CLicqAutoReply::CLicqAutoReply(bool _bEnable, char *_szStatus) 
     31CLicqAutoReply::CLicqAutoReply(bool _bEnable, bool _bDelete, char *_szStatus) 
    3232{ 
    3333  tcp = new TCPSocket; 
    3434  m_bExit = false; 
    3535  m_bEnabled = _bEnable; 
     36  m_bDelete = _bDelete; 
    3637  m_szStatus = _szStatus == NULL ? NULL : strdup(_szStatus); 
    3738} 
     
    241242 
    242243  CUserEvent *e = NULL; 
    243   while (u->NewMessages() > 0) 
    244   { 
    245     // Fetch the event 
    246     e = u->GetEvent(0); 
     244 
     245  if (m_bDelete) 
     246  { 
     247    while (u->NewMessages() > 0) 
     248    { 
     249      // Fetch the event 
     250      e = u->EventPop(); 
     251      // Forward it 
     252      if (!ForwardEvent(u, e)) break; 
     253      // Erase the event 
     254      delete e; 
     255    } 
     256  } 
     257  else 
     258  { 
     259    e = u->EventPeekLast(); 
    247260    // Forward it 
    248     if (!ForwardEvent(u, e)) break; 
    249     // Erase the event 
    250     u->ClearEvent(0); 
     261    ForwardEvent(u, e); 
    251262  } 
    252263 
     
    261272  char c; 
    262273  int pos = 0; 
     274 
     275  if (e == NULL) return false; 
     276 
    263277  for (int i = 0; i < 4096; i++) 
    264278  { 
  • trunk/auto-reply/src/autoreply.h

    r794 r1120  
    1616{ 
    1717public: 
    18   CLicqAutoReply(bool, char *); 
     18  CLicqAutoReply(bool, bool, char *); 
    1919  ~CLicqAutoReply(); 
    2020  int Run(CICQDaemon *); 
     
    2424protected: 
    2525  int m_nPipe; 
    26   bool m_bExit, m_bEnabled; 
     26  bool m_bExit, m_bEnabled, m_bDelete; 
    2727  char *m_szStatus; 
    2828  char m_szProgram[512]; 
     
    3838  void ProcessUserEvent(unsigned long); 
    3939  bool ForwardEvent(ICQUser *, CUserEvent *); 
    40 //  bool ForwardEvent_ICQ(ICQUser *, CUserEvent *); 
    4140 
    4241}; 
  • trunk/auto-reply/src/main.cpp

    r794 r1120  
    1313{ 
    1414  static const char usage[] = 
    15     "Usage:  Licq [options] -p autoreply -- [ -h ] [ -e ] [ -l <staus> ]\n" 
     15    "Usage:  Licq [options] -p autoreply -- [ -h ] [ -e ] [ -l <staus> ] [ -d ]\n" 
    1616    "         -h          : help\n" 
    1717    "         -e          : start enabled\n" 
    18     "         -l <status> : log on at startup\n"; 
     18    "         -l <status> : log on at startup\n" 
     19    "         -d          : delete messages after auto-replying\n"; 
    1920  return usage; 
    2021} 
     
    3637const char *LP_Version() 
    3738{ 
    38   static const char version[] = "0.10"; 
     39  static const char version[] = "0.15"; 
    3940  return version; 
    4041} 
     
    5657 
    5758  // parse command line for arguments 
    58   bool bEnable = false; 
     59  bool bEnable = false, bDelete = false; 
    5960  char *szStatus = NULL; 
    6061  int i = 0; 
    61   while( (i = getopt(argc, argv, "hel:")) > 0) 
     62  while( (i = getopt(argc, argv, "dhel:")) > 0) 
    6263  { 
    6364    switch (i) 
    6465    { 
    65     case 'h':  // help 
    66       LP_Usage(); 
    67       return false; 
    68     case 'e': // enable 
    69       bEnable = true; 
    70       break; 
    71     case 'l': //log on 
    72       szStatus = strdup(optarg); 
    73       break; 
     66      case 'h':  // help 
     67        LP_Usage(); 
     68        return false; 
     69      case 'e': // enable 
     70        bEnable = true; 
     71        break; 
     72      case 'l': //log on 
     73        szStatus = strdup(optarg); 
     74        break; 
     75      case 'd': // delete new 
     76        bDelete = true; 
     77        break; 
    7478    } 
    7579  } 
    76   licqAutoReply = new CLicqAutoReply(bEnable, szStatus); 
     80  licqAutoReply = new CLicqAutoReply(bEnable, bDelete, szStatus); 
    7781  if (szStatus != NULL) free(szStatus); 
    7882  return (licqAutoReply != NULL);