ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/zoe/trunk/Collector.cpp
(Generate patch)

Comparing trunk/Collector.cpp (file contents):
Revision 15 by douglas, 2004-07-13T20:14:49-07:00 vs.
Revision 16 by douglas, 2004-07-14T20:57:30-07:00

# Line 6 | Line 6
6  
7   #include "Collector.hpp"
8  
9 + #include <cstring>
10   #include <pwd.h>
11   #include <unistd.h>
12  
12 #ifndef PASS_MAX
13 #if defined (_PASSWORD_LEN)
14 const unsigned PASS_MAX(_PASSWORD_LEN);
15 #elif defined (_SC_PASS_MAX)
16 const unsigned PASS_MAX(_SC_PASS_MAX);
17 #else
18 #error PASS_MAX unknown
19 #endif
20 #endif // PASS_MAX
21
13   Collector::Collector(const ext::String& login, ext::String& password, const
14          std::set<Buddy>& buddies, bool start) : login(login), password(password),
15          start(start)
# Line 31 | Line 22 | Collector::Collector(const ext::String&
22          }
23   }
24  
25 + net::Oscar::BuddyTool* Collector::buddy(NULL);
26 + net::Oscar::IcbmTool* Collector::icbm(NULL);
27 +
28   int Collector::collect(const std::set<Buddy>& buddies)
29   {
30          cerr << "Collector::collect()\n";
# Line 43 | Line 37 | int Collector::collect(const std::set<Bu
37          net::Oscar::InfoTool info(session);
38  
39          auth.Login(login, password);
40 <        password.Clear();
40 >
41 >        Collector::buddy = &buddy;
42 >        Collector::icbm = &icbm;
43 >
44 >        icbm.OnIncomingIcbm += &Collector::reply;
45 >
46 > //      for (size_t index(password.GetSize()); index > 0; --index) password[index -
47 > //              1] = '\0';
48  
49          net::Oscar::StringSet buddies_;
50  
# Line 60 | Line 61 | int Collector::collect(const std::set<Bu
61  
62          // figure out whether or not we logged in
63  
64 <        while (true)
64 <        {
65 <                sleep(60);
66 <
67 <                // collect
68 <        }
64 >        while (true) sleep(60);
65   }
66  
67   void Collector::prompt()
68   {
69 <        char* password(getpass("Password: "));
69 >        ext::String prompt(login + "'s AIM Password: ");
70 >        char* password(getpass(prompt.NullTerminate()));
71  
72          this->password = password;
73  
74 <        for (size_t index(0); index < PASS_MAX; ++index) password[index] = '\0';
74 >        for (size_t index(strlen(password)); index > 0; --index) password[index -
75 >                1] = '\0';
76 > }
77 >
78 > void Collector::reply(const ext::String& login, const ext::String& reply)
79 > {
80 >        icbm->Simple(login, reply);
81   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines