isolationserver/isoserver/inc/isofetchcontactlist.h
changeset 10 59927b2d3b75
parent 0 d0f3a028347a
equal deleted inserted replaced
0:d0f3a028347a 10:59927b2d3b75
     1 
       
     2 /* ============================================================================
       
     3 *  Name        : isofetchcontactlist.h
       
     4 *  Part of     : isolation server.
       
     5 *  Version     : %version: 9 %
       
     6 *
       
     7 *  Copyright © 2007-2008 Nokia.  All rights reserved.
       
     8 *  All rights reserved.
       
     9 *  Redistribution and use in source and binary forms, with or without modification, 
       
    10 *  are permitted provided that the following conditions are met:
       
    11 *  Redistributions of source code must retain the above copyright notice, this list 
       
    12 *  of conditions and the following disclaimer.Redistributions in binary form must 
       
    13 *  reproduce the above copyright notice, this list of conditions and the following 
       
    14 *  disclaimer in the documentation and/or other materials provided with the distribution.
       
    15 *  Neither the name of the Nokia Corporation nor the names of its contributors may be used 
       
    16 *  to endorse or promote products derived from this software without specific prior written 
       
    17 *  permission.
       
    18 *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
       
    19 *  EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 
       
    20 *  OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
       
    21 *  SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
       
    22 *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
       
    23 *  OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
       
    24 *  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
       
    25 *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 
       
    26 *  EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
       
    27 * ============================================================================
       
    28 * Template version: 1.0
       
    29 */
       
    30 
       
    31 
       
    32 
       
    33 /*!
       
    34 * \def To avoid multiple inclusion of header
       
    35 */
       
    36 #ifndef __IFETCHCONTACTLIST_H__
       
    37 #define __IFETCHCONTACTLIST_H__
       
    38 
       
    39 #include "tp-conn.h"
       
    40 #include "tp-connmgr.h"
       
    41 #include "tp-chan.h"
       
    42 #include "tp-chan-gen.h"
       
    43 #include "tp-ch-gen.h"
       
    44 #include "tp-chan-iface-group-gen.h"
       
    45 #include "tp-chan-type-text-gen.h"
       
    46 #include "tp-chan-type-streamed-media-gen.h"
       
    47 #include "tp-props-iface.h"
       
    48 #include "tp-constants.h"
       
    49 #include "tp-interfaces.h"
       
    50 
       
    51 #include "isoim.h"
       
    52 
       
    53 /*!	\file
       
    54 *	Interfaces for fetching of contacts.
       
    55 *	client anywhere in the documentation refers to anyone
       
    56 *	using the isoserver
       
    57 */
       
    58 
       
    59 /*! \enum channel_type
       
    60  *	type of the channel
       
    61  */
       
    62 enum channel_type
       
    63 	{
       
    64 	ESubscribe_Channel,
       
    65 	EPublish_Channel	
       
    66 	};
       
    67 
       
    68 /*!	\brief This function is called as a callback to get the contact names from 
       
    69  * 	contact handles. Contact names are sent to client in multiple packets of
       
    70  * 	size MAX_MSG_SIZE
       
    71  *
       
    72  * 	\param proxy unused
       
    73  * 	\param handles_names 2D array of contact names
       
    74  * 	\param error error if any 
       
    75  * 	\param userdata msg_type
       
    76  */
       
    77 static void inspect_handles_cb( DBusGProxy *proxy,char **handles_names, 
       
    78 			GError *error, gpointer userdata ) ;
       
    79 
       
    80 
       
    81 /*!	\brief This function is called if there are 0 contacts or there was an error
       
    82  *
       
    83  * 	\param contact_type : Type of the contacts
       
    84  * 	\param err : err if any, 0 otherwise
       
    85  */
       
    86 static gint send_fetch_contacts_error( gint contact_type , gint err );
       
    87 
       
    88 /*!	\brief This function is a callback for request for the contacts 
       
    89  *	in local pending contatct list from server. This is 
       
    90  *	only called for publish channel members. fetch_contacts is called 
       
    91  *	to get the contact names from the handles. If there are no conatcts in 
       
    92  *	the list it calls send_fetch_contacts_error else requests for the contact names
       
    93  *	from the contact handles
       
    94  *
       
    95  * 	\param proxy unused 
       
    96  * 	\param current_members array of handles of current contatcs
       
    97  * 	\param local_pending_members unused 
       
    98  * 	\param remote_pending_members array of handles of remote pending contatcs
       
    99  * 	\param error error if any
       
   100  * 	\param userdata unused 
       
   101  */
       
   102 static void get_roster_local_member_cb( DBusGProxy *proxy,GArray* current_members, 
       
   103 			GArray* local_pending_members, GArray* remote_pending_members, 
       
   104 			GError *error, gpointer userdata );
       
   105 			
       
   106 /*!	\brief Requests the server to get contact names from the handles
       
   107  *	The contact names are returned in inspect_handles_cb. From there
       
   108  *	contacts are sent to client
       
   109  *
       
   110  * 	\param contact_mem : handles to contact members
       
   111  * 	\param msg_type : type of the message, which wil be passed to cb
       
   112  * 	\return  Errors if any, else 0
       
   113  */
       
   114 			
       
   115 static gint fetch_contacts( GArray* contact_mem, gint* msg_type ) ;			
       
   116 
       
   117 /*!	\brief This function is a callback for request for the contacts 
       
   118  *	in msg_type(subscribe or publish) contatct list from server. This is 
       
   119  *	only called for subscribe channel members. fetch_contacts is called 
       
   120  *	to get the contact names from the handles. If there are no conatcts in 
       
   121  *	the list it calls send_fetch_contacts_error else requests for the contacts 
       
   122  *	from the handles
       
   123  *
       
   124  * 	\param proxy unused 
       
   125  * 	\param current_members array of handles of current contatcs
       
   126  * 	\param local_pending_members unused 
       
   127  * 	\param remote_pending_members array of handles of remote pending contatcs
       
   128  * 	\param error error if any
       
   129  * 	\param userdata unused 
       
   130  */
       
   131 static void get_roster_member_cb( DBusGProxy *proxy,GArray* current_members,
       
   132 		 GArray* local_pending_members, GArray* remote_pending_members, 
       
   133 		 	GError *error, gpointer userdata ) ;
       
   134 		 	
       
   135 
       
   136 /*!	\brief this function requests for the contacts in its contatct list from server
       
   137  *	
       
   138  *	\param	type of the contacts channel( publish, subscribe )
       
   139  */
       
   140 void request_roster( enum channel_type type );
       
   141 
       
   142 /*! \brief Sends contacts to the client. Contact names are sent to client in multiple 
       
   143  * 	packets of size less than or equal to MAX_MSG_SIZE. Contact will be sent as a whole. 
       
   144  * 	A single contact will not be sent in two consecutive packets
       
   145  *
       
   146  * 	\param members : Contacts to be sent to client
       
   147  * 	\param mem_count : no. of contacts 
       
   148  * 	\param contact_type : type of the contact
       
   149  * 	\return error code..
       
   150  */
       
   151 gint send_contacts_to_client( gchar** members, gint mem_count, gint contact_type ) ;
       
   152 
       
   153 
       
   154 /*! \brief Fetches the cached contacts stored in telepathy gabble
       
   155  *   This is as good as fetching the contacts
       
   156  */ 
       
   157 void fetch_cached_contacts();
       
   158 
       
   159 #endif //__IFETCHCONTACTLIST_H__