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 19 by douglas, 2004-07-15T09:25:00-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)
15 >        start(start), prompted(false)
16   {
17          if (start)
18          {
# Line 43 | Line 34 | int Collector::collect(const std::set<Bu
34          net::Oscar::InfoTool info(session);
35  
36          auth.Login(login, password);
37 <        password.Clear();
37 >
38 >        if (prompted) password.Clear();
39 >
40 >        this->buddy = &buddy;
41 >        this->icbm = &icbm;
42 >
43 > //      buddy.OnOnline += etl::Bind<0>(&Collector::status, this);
44 >        icbm.OnReceive += etl::Bind<0>(&Collector::reply, this);
45  
46          net::Oscar::StringSet buddies_;
47  
# Line 60 | Line 58 | int Collector::collect(const std::set<Bu
58  
59          // figure out whether or not we logged in
60  
61 <        while (true)
64 <        {
65 <                sleep(60);
66 <
67 <                // collect
68 <        }
61 >        while (true) sleep(60);
62   }
63  
64   void Collector::prompt()
65   {
66 <        char* password(getpass("Password: "));
66 >        if (!prompted) prompted = true;
67 >
68 >        ext::String prompt(login + "'s AIM Password: ");
69 >        char* password(getpass(prompt.NullTerminate()));
70  
71          this->password = password;
72  
73 <        for (size_t index(0); index < PASS_MAX; ++index) password[index] = '\0';
73 >        for (size_t index(strlen(password)); index > 0; --index) password[index -
74 >                1] = '\0';
75 > }
76 >
77 > void Collector::reply(const ext::String& login, const ext::String& reply)
78 > {
79 >        icbm->Simple(login, reply);
80   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines