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 16 by douglas, 2004-07-14T20:57:30-07:00 vs.
Revision 20 by douglas, 2004-07-16T00:41:53-07:00

# Line 12 | Line 12
12  
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 >        buddies(buddies), start(start), prompted(false)
16   {
17          if (start)
18          {
19                  if (password.IsEmpty()) prompt();
20  
21 <                collector.Spawn(etl::BindAll(&Collector::collect, this, buddies));
21 >                collector.Spawn(etl::Bind<0>(&Collector::collect, this));
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)
25 > int Collector::collect()
26   {
27          cerr << "Collector::collect()\n";
28  
# Line 38 | Line 35 | int Collector::collect(const std::set<Bu
35  
36          auth.Login(login, password);
37  
38 <        Collector::buddy = &buddy;
42 <        Collector::icbm = &icbm;
38 >        if (prompted) password.Clear();
39  
40 <        icbm.OnIncomingIcbm += &Collector::reply;
40 >        this->buddy = &buddy;
41 >        this->icbm = &icbm;
42  
43 < //      for (size_t index(password.GetSize()); index > 0; --index) password[index -
44 < //              1] = '\0';
43 > //      buddy.OnOnline += etl::Bind<0>(&Collector::status, this);
44 >        icbm.OnReceive += etl::Bind<0>(&Collector::reply, this);
45  
46 <        net::Oscar::StringSet buddies_;
46 >        net::Oscar::StringSet buddies;
47  
48 <        for (std::set<Buddy>::const_iterator buddy(buddies.begin()); buddy !=
49 <                buddies.end(); ++buddy) buddies_.Insert(*buddy);
48 >        for (std::set<Buddy>::const_iterator buddy(this->buddies.begin()); buddy !=
49 >                this->buddies.end(); ++buddy) buddies.Insert(*buddy);
50  
51 <        buddy.Insert(buddies_);
51 >        buddy.Insert(buddies);
52          icbm.RequestParams();
53  
54          net::Oscar::Capabilities capabilities;
55  
56          capabilities.Insert(net::Oscar::ChatCapability);
57 <        info.SetProfile("<font size=3>I am <a href=\"http://computers.douglasthrift.net/zoe.xml\">Zoe</a>.</font> :-*", "", capabilities);
57 >        info.SetProfile("<font size=3>I am <a href=\"http://computers.douglasthrift.net/zoe.xml\">Zoe</a>.</font> :-*", "<font size=3>Mommy told me not to talk to strangers.</font> O:-)", capabilities);
58  
59          // figure out whether or not we logged in
60  
# Line 66 | Line 63 | int Collector::collect(const std::set<Bu
63  
64   void Collector::prompt()
65   {
66 +        if (!prompted) prompted = true;
67 +
68          ext::String prompt(login + "'s AIM Password: ");
69          char* password(getpass(prompt.NullTerminate()));
70  
# Line 75 | Line 74 | void Collector::prompt()
74                  1] = '\0';
75   }
76  
77 < void Collector::reply(const ext::String& login, const ext::String& reply)
77 > void Collector::reply(const Buddy& buddy, const ext::String& message)
78   {
79 <        icbm->Simple(login, reply);
79 >        if (buddies.find(buddy) != buddies.end())
80 >        {
81 >                //
82 >        }
83 >        else
84 >        {
85 >                sleep(1);
86 >
87 >                icbm->Simple(buddy, "<font size=3>Mommy told me not to talk to strangers. O:-)");
88 >        }
89   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines