Main Page   Class Hierarchy   Compound List   File List   Compound Members   Related Pages  

SNAC-BUD.h

00001 /*
00002  * SNAC - Buddy (Contact) list management
00003  *
00004  * Copyright (C) 2001 Barnaby Gray <barnaby@beedesign.co.uk>
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Lesser General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2.1 of the License, or (at your option) any later version.
00010  *
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Lesser General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with this library; if not, write to the Free Software
00018  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
00019  *
00020  */
00021 
00022 #ifndef SNAC_BUD_H
00023 #define SNAC_BUD_H
00024 
00025 #include <string>
00026 #include <list>
00027 
00028 #include <libicq2000/SNAC-base.h>
00029 #include <libicq2000/Contact.h>
00030 #include <libicq2000/ContactList.h>
00031 #include <libicq2000/UserInfoBlock.h>
00032 
00033 namespace ICQ2000 {
00034 
00035   // Buddy stuff (Family 0x0003)
00036   const unsigned short SNAC_BUD_Error = 0x0001;
00037   const unsigned short SNAC_BUD_AddBuddy = 0x0004;
00038   const unsigned short SNAC_BUD_RemoveBuddy = 0x0005;
00039   const unsigned short SNAC_BUD_Online = 0x000b;
00040   const unsigned short SNAC_BUD_Offline = 0x000c;
00041 
00042   // ----------------- Buddy List (Family 0x0003) SNACs -----------
00043 
00044   class BUDFamilySNAC : virtual public SNAC {
00045    public:
00046     unsigned short Family() const { return SNAC_FAM_BUD; }
00047   };
00048 
00049   class AddBuddySNAC : public BUDFamilySNAC, public OutSNAC {
00050    private:
00051     list<string> m_buddy_list;
00052     
00053    protected:
00054     void OutputBody(Buffer& b) const;
00055 
00056    public:
00057     AddBuddySNAC();
00058     AddBuddySNAC(const ContactList& l);
00059     AddBuddySNAC(const Contact& c);
00060 
00061     void addBuddy(const Contact& c);
00062 
00063     unsigned short Subtype() const { return SNAC_BUD_AddBuddy; }
00064   };
00065 
00066   class RemoveBuddySNAC : public BUDFamilySNAC, public OutSNAC {
00067    private:
00068     list<string> m_buddy_list;
00069     
00070    protected:
00071     void OutputBody(Buffer& b) const;
00072 
00073    public:
00074     RemoveBuddySNAC();
00075     RemoveBuddySNAC(const ContactList& l);
00076     RemoveBuddySNAC(const string& s);
00077 
00078     void removeBuddy(const Contact& c);
00079 
00080     unsigned short Subtype() const { return SNAC_BUD_RemoveBuddy; }
00081   };
00082 
00083   class BuddyOnlineSNAC : public BUDFamilySNAC, public InSNAC {
00084    private:
00085     UserInfoBlock m_userinfo;
00086 
00087   protected:
00088     void ParseBody(Buffer& b);
00089 
00090    public:
00091     BuddyOnlineSNAC();
00092 
00093     const UserInfoBlock& getUserInfo() const { return m_userinfo; }
00094     unsigned short Subtype() const { return SNAC_BUD_Online; }
00095   };
00096   
00097 
00098   class BuddyOfflineSNAC : public BUDFamilySNAC, public InSNAC {
00099    private:
00100     UserInfoBlock m_userinfo;
00101 
00102   protected:
00103     void ParseBody(Buffer& b);
00104 
00105    public:
00106     BuddyOfflineSNAC();
00107 
00108     UserInfoBlock getUserInfo() const { return m_userinfo; }
00109     unsigned short Subtype() const { return SNAC_BUD_Offline; }
00110   };
00111   
00112 
00113 }
00114 
00115 #endif

Generated on Tue Jan 15 12:24:35 2002 for libicq2000 by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001