libmsn 4.2.1
/home/salem/libmsn/tags/libmsn-4.2/msn/buddy.h
00001 #ifndef __msn_buddy_h__
00002 #define __msn_buddy_h__
00003 
00004 /*
00005  * buddy.h
00006  * libmsn
00007  *
00008  * Created by Mark Rowe on Mon Apr 19 2004.
00009  * Refactored by Tiago Salem Herrmann on 08/2007.
00010  * Copyright (c) 2004 Mark Rowe. All rights reserved.
00011  * Copyright (c) 2007 Tiago Salem Herrmann. All rights reserved
00012  *
00013  * This program is free software; you can redistribute it and/or modify
00014  * it under the terms of the GNU General Public License as published by
00015  * the Free Software Foundation; either version 2 of the License, or
00016  * (at your option) any later version.
00017  *
00018  * This program is distributed in the hope that it will be useful,
00019  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00020  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00021  * GNU General Public License for more details.
00022  *
00023  * You should have received a copy of the GNU General Public License
00024  * along with this program; if not, write to the Free Software
00025  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00026  */
00027 
00028 #include <string>
00029 #include <list>
00030 #include <vector>
00031 #include <map>
00032 #include <msn/passport.h>
00033 
00034 #include "libmsn_export.h"
00035 
00036 namespace MSN
00037 {
00041     enum BuddyStatus
00042     {
00043         STATUS_AVAILABLE, 
00044         STATUS_BUSY, 
00045         STATUS_IDLE, 
00046         STATUS_BERIGHTBACK, 
00047         STATUS_AWAY, 
00048         STATUS_ONTHEPHONE, 
00049         STATUS_OUTTOLUNCH, 
00050         STATUS_INVISIBLE 
00051     };
00052     
00053     std::string LIBMSN_EXPORT buddyStatusToString(BuddyStatus s);
00054     BuddyStatus LIBMSN_EXPORT buddyStatusFromString(std::string s);
00055     
00056     class Group;
00057     
00065     class LIBMSN_EXPORT Buddy
00066     {
00067 public:
00071         class PhoneNumber
00072         {
00073 public:
00079              std::string title;
00080 
00081              std::string number;
00082 
00083              bool enabled;
00084  
00085               PhoneNumber(std::string title_, std::string number_, bool enabled_=true)
00086                  : title(title_), number(number_), enabled(enabled_) {};
00087 
00088         };
00089 
00091         std::map<std::string, std::string> properties;
00092        
00094         Passport userName;
00095         
00097         std::string friendlyName;
00098 
00100         std::list<Buddy::PhoneNumber> phoneNumbers;
00101 
00103         std::list<Group *> groups;
00104 
00106         unsigned int lists;
00107         
00108         Buddy(Passport userName_, std::string friendlyName_ = "") :
00109             userName(userName_), friendlyName(friendlyName_), lists(0) {};
00110         bool operator==(const Buddy &other) { return userName == other.userName; }
00111     };
00112     
00118     class LIBMSN_EXPORT Group
00119     {
00120 public:
00121     
00123         std::string groupID;
00124 
00126         std::string name;
00127 
00129         std::list<Buddy *> buddies;
00130         
00131         Group(std::string groupID_, std::string name_)
00132             : groupID(groupID_), name(name_) {};
00133         
00134         Group() : name("INVALID") {};
00135     };
00136 }
00137 
00138 #endif
 All Classes Namespaces Functions Variables Enumerations Enumerator