Changeset 1120 for trunk/auto-reply
- Timestamp:
- 02/22/00 04:36:51 (9 years ago)
- Location:
- trunk/auto-reply
- Files:
-
- 4 modified
-
configure.in (modified) (1 diff)
-
src/autoreply.cpp (modified) (3 diffs)
-
src/autoreply.h (modified) (3 diffs)
-
src/main.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/auto-reply/configure.in
r1084 r1120 6 6 7 7 dnl All versioning is done via the following line 8 AM_INIT_AUTOMAKE(Licq-AutoReply, 0.1 2)8 AM_INIT_AUTOMAKE(Licq-AutoReply, 0.15) 9 9 AM_CONFIG_HEADER(config.h) 10 10 -
trunk/auto-reply/src/autoreply.cpp
r809 r1120 29 29 * CLicqAutoReply::Constructor 30 30 *-------------------------------------------------------------------------*/ 31 CLicqAutoReply::CLicqAutoReply(bool _bEnable, char *_szStatus)31 CLicqAutoReply::CLicqAutoReply(bool _bEnable, bool _bDelete, char *_szStatus) 32 32 { 33 33 tcp = new TCPSocket; 34 34 m_bExit = false; 35 35 m_bEnabled = _bEnable; 36 m_bDelete = _bDelete; 36 37 m_szStatus = _szStatus == NULL ? NULL : strdup(_szStatus); 37 38 } … … 241 242 242 243 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(); 247 260 // Forward it 248 if (!ForwardEvent(u, e)) break; 249 // Erase the event 250 u->ClearEvent(0); 261 ForwardEvent(u, e); 251 262 } 252 263 … … 261 272 char c; 262 273 int pos = 0; 274 275 if (e == NULL) return false; 276 263 277 for (int i = 0; i < 4096; i++) 264 278 { -
trunk/auto-reply/src/autoreply.h
r794 r1120 16 16 { 17 17 public: 18 CLicqAutoReply(bool, char *);18 CLicqAutoReply(bool, bool, char *); 19 19 ~CLicqAutoReply(); 20 20 int Run(CICQDaemon *); … … 24 24 protected: 25 25 int m_nPipe; 26 bool m_bExit, m_bEnabled ;26 bool m_bExit, m_bEnabled, m_bDelete; 27 27 char *m_szStatus; 28 28 char m_szProgram[512]; … … 38 38 void ProcessUserEvent(unsigned long); 39 39 bool ForwardEvent(ICQUser *, CUserEvent *); 40 // bool ForwardEvent_ICQ(ICQUser *, CUserEvent *);41 40 42 41 }; -
trunk/auto-reply/src/main.cpp
r794 r1120 13 13 { 14 14 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" 16 16 " -h : help\n" 17 17 " -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"; 19 20 return usage; 20 21 } … … 36 37 const char *LP_Version() 37 38 { 38 static const char version[] = "0.1 0";39 static const char version[] = "0.15"; 39 40 return version; 40 41 } … … 56 57 57 58 // parse command line for arguments 58 bool bEnable = false ;59 bool bEnable = false, bDelete = false; 59 60 char *szStatus = NULL; 60 61 int i = 0; 61 while( (i = getopt(argc, argv, " hel:")) > 0)62 while( (i = getopt(argc, argv, "dhel:")) > 0) 62 63 { 63 64 switch (i) 64 65 { 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; 74 78 } 75 79 } 76 licqAutoReply = new CLicqAutoReply(bEnable, szStatus);80 licqAutoReply = new CLicqAutoReply(bEnable, bDelete, szStatus); 77 81 if (szStatus != NULL) free(szStatus); 78 82 return (licqAutoReply != NULL);
