connwrap - initialize gnutls session in cw_connect
[centerim.git] / libmsn / msn / buddy.h
blob92ea1733c41bcfd1b89774b8cb59817fa29b47f2
1 #ifndef __msn_buddy_h__
2 #define __msn_buddy_h__
4 /*
5 * buddy.h
6 * libmsn
8 * Created by Mark Rowe on Mon Apr 19 2004.
9 * Copyright (c) 2004 Mark Rowe. All rights reserved.
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 #include <string>
27 #include <list>
28 #include <msn/passport.h>
30 namespace MSN
32 /** The online state of a buddy.
35 enum BuddyStatus
37 STATUS_AVAILABLE,
38 STATUS_BUSY,
39 STATUS_IDLE,
40 STATUS_BERIGHTBACK,
41 STATUS_AWAY,
42 STATUS_ONTHEPHONE,
43 STATUS_OUTTOLUNCH,
44 STATUS_INVISIBLE
47 std::string buddyStatusToString(BuddyStatus s);
48 BuddyStatus buddyStatusFromString(std::string s);
50 class Group;
52 /** The Buddy class contains information about a member of a buddy list.
54 * Each Buddy is made up of their passport address (@a userName),
55 * user-visible display name (@a friendlyName), zero or more @a phoneNumbers,
56 * and zero or more @a groups on the buddy list that they belong to.
58 * It is only currently used during MSN::ext::gotBuddyListInfo to
59 * store contact information about a buddy that was retrieved during
60 * the buddy list synchronisation process.
62 class Buddy
64 /** @todo BPR's need to be handled at any time, not just when syncing. */
65 public:
66 /** The PhoneNumber class contains information about a single phone number
67 * that is retrieved during the buddy list synchronisation process.
69 class PhoneNumber
71 public:
72 /** The name of this phone number.
74 * @todo Should this be an enumeration containing the possible
75 * types of phone number?
77 std::string title;
79 /** The phone number */
80 std::string number;
82 /** @todo Document me! */
83 bool enabled;
85 PhoneNumber(std::string title_, std::string number_, bool enabled_=true)
86 : title(title_), number(number_), enabled(enabled_) {};
89 /** Their passport address */
90 Passport userName;
92 /** Their friendly name */
93 std::string friendlyName;
95 /** A list of phone numbers related to this buddy */
96 std::list<Buddy::PhoneNumber> phoneNumbers;
98 /** A list of Group's that this buddy is a member of */
99 std::list<Group *> groups;
101 Buddy(Passport userName_, std::string friendlyName_) :
102 userName(userName_), friendlyName(friendlyName_) {};
103 bool const operator==(const Buddy &other) { return userName == other.userName; }
106 /** The Group class represents a group of contacts on the buddy list.
108 * Each group is represented by a @a groupID and has a user-visible
109 * @a name.
111 class Group
113 public:
114 int groupID;
115 std::string name;
116 std::list<Buddy *> buddies;
118 Group(int groupID_, std::string name_)
119 : groupID(groupID_), name(name_) {};
121 Group() : groupID(-1), name("INVALID") {};
125 #endif