Changeset 2099 for trunk/auto-reply
- Timestamp:
- 07/05/00 10:30:08 (8 years ago)
- Location:
- trunk/auto-reply/src
- Files:
-
- 2 modified
-
autoreply.cpp (modified) (7 diffs)
-
autoreply.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/auto-reply/src/autoreply.cpp
r1711 r2099 177 177 switch (s->Signal()) 178 178 { 179 case SIGNAL_UPDATExUSER: 180 if (s->SubSignal() == USER_EVENTS && s->Uin() != gUserManager.OwnerUin() && s->Argument() > 0) 181 ProcessUserEvent(s->Uin(), s->Argument()); 182 break; 183 // We should never get any other signal 184 case SIGNAL_UPDATExLIST: 185 break; 186 case SIGNAL_LOGON: 187 break; 188 default: 189 gLog.Warn("%sInternal error: CLicqiAutoReply::ProcessSignal(): Unknown signal command received from daemon: %ld.\n", 190 L_WARNxSTR, s->Signal()); 191 break; 179 case SIGNAL_UPDATExUSER: 180 if (s->SubSignal() == USER_EVENTS && s->Uin() != gUserManager.OwnerUin() && s->Argument() > 0) 181 ProcessUserEvent(s->Uin(), s->Argument()); 182 break; 183 // We should never get any other signal 184 default: 185 break; 192 186 } 193 187 delete s; … … 200 194 void CLicqAutoReply::ProcessEvent(ICQEvent *e) 201 195 { 202 /* switch (e->m_nCommand)203 {204 case ICQ_CMDxTCP_START:205 case ICQ_CMDxSND_THRUxSERVER:206 case ICQ_CMDxSND_USERxGETINFO:207 case ICQ_CMDxSND_USERxGETDETAILS:208 case ICQ_CMDxSND_UPDATExDETAIL:209 case ICQ_CMDxSND_UPDATExBASIC:210 case ICQ_CMDxSND_LOGON:211 case ICQ_CMDxSND_REGISTERxUSER:212 case ICQ_CMDxSND_SETxSTATUS:213 case ICQ_CMDxSND_AUTHORIZE:214 case ICQ_CMDxSND_USERxLIST:215 case ICQ_CMDxSND_VISIBLExLIST:216 case ICQ_CMDxSND_INVISIBLExLIST:217 case ICQ_CMDxSND_PING:218 case ICQ_CMDxSND_USERxADD:219 case ICQ_CMDxSND_SYSxMSGxREQ:220 case ICQ_CMDxSND_SYSxMSGxDONExACK:221 case ICQ_CMDxSND_SEARCHxINFO:222 case ICQ_CMDxSND_SEARCHxUIN:223 break;224 225 default:226 gLog.Warn("%sInternal error: CLicqAutoReply::ProcessEvent(): Unknown event command received from daemon: %d.\n",227 L_WARNxSTR, e->m_nCommand);228 break;229 }*/230 196 delete e; 231 197 } … … 234 200 void CLicqAutoReply::ProcessUserEvent(unsigned long nUin, unsigned long nId) 235 201 { 236 ICQUser *u = gUserManager.FetchUser(nUin, LOCK_ W);202 ICQUser *u = gUserManager.FetchUser(nUin, LOCK_R); 237 203 if (u == NULL) 238 204 { … … 242 208 243 209 CUserEvent *e = u->EventPeekId(nId); 210 gUserManager.DropUser(u); 244 211 245 212 if (e == NULL) … … 249 216 else 250 217 { 251 bool r = AutoReplyEvent( u, e);218 bool r = AutoReplyEvent(nUin); 252 219 if (m_bDelete && r) 220 { 221 u = gUserManager.FetchUser(nUin, LOCK_W); 253 222 u->EventClearId(nId); 254 }255 256 gUserManager.DropUser(u);257 } 258 259 260 bool CLicqAutoReply::AutoReplyEvent( ICQUser *u, CUserEvent *e)223 gUserManager.DropUser(u); 224 } 225 } 226 } 227 228 229 bool CLicqAutoReply::AutoReplyEvent(unsigned long nUin) 261 230 { 262 231 FILE *output; … … 265 234 int pos = 0; 266 235 267 if (e == NULL) return false;268 269 236 for (int i = 0; i < 4096; i++) 270 237 { … … 284 251 char *szText = new char[4096 + 256]; 285 252 sprintf(szText, "%s", m_szMessage); 286 CICQEventTag *tag = licqDaemon->icqSendMessage( u->Uin(), szText, false,253 CICQEventTag *tag = licqDaemon->icqSendMessage(nUin, szText, false, 287 254 ICQ_TCPxMSG_NORMAL); 288 255 delete []szText; 256 257 ICQUser *u = gUserManager.FetchUser(nUin, LOCK_R); 258 if (u == NULL) return false; 259 289 260 if (tag == NULL) 290 261 { 291 262 gLog.Warn("%sSending message to %s (%ld) failed.\n", L_AUTOREPxSTR, 292 u->GetAlias(), u->Uin()); 293 return false; 294 } 295 gLog.Info("%sSent autoreply to %s (%ld).\n", L_AUTOREPxSTR, u->GetAlias(), 296 u->Uin()); 263 u->GetAlias(), nUin); 264 } 265 else 266 { 267 gLog.Info("%sSent autoreply to %s (%ld).\n", L_AUTOREPxSTR, u->GetAlias(), 268 nUin); 269 } 270 271 gUserManager.DropUser(u); 297 272 delete tag; 298 return t rue;299 } 300 273 return tag != NULL; 274 } 275 -
trunk/auto-reply/src/autoreply.h
r1193 r2099 37 37 38 38 void ProcessUserEvent(unsigned long, unsigned long); 39 bool AutoReplyEvent( ICQUser *, CUserEvent *);39 bool AutoReplyEvent(unsigned long); 40 40 41 41 };
