isolationserver/isoserver/inc/isomodifycontactlist.h
changeset 10 59927b2d3b75
parent 0 d0f3a028347a
equal deleted inserted replaced
0:d0f3a028347a 10:59927b2d3b75
     1 
       
     2 /* ============================================================================
       
     3 *  Name        : isomodifycontacts.h
       
     4 *  Part of     : isolation server.
       
     5 *  Version     : %version: 7 %
       
     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 * /def To avoid multiple inclusion of header
       
    33 */
       
    34 #ifndef __ISOADDCONTACTS_H__
       
    35 #define __ISOADDCONTACTS_H__
       
    36 
       
    37 #include "tp-conn.h"
       
    38 #include "tp-connmgr.h"
       
    39 #include "tp-chan.h"
       
    40 #include "tp-chan-gen.h"
       
    41 #include "tp-ch-gen.h"
       
    42 #include "tp-chan-iface-group-gen.h"
       
    43 #include "tp-chan-type-text-gen.h"
       
    44 #include "tp-chan-type-streamed-media-gen.h"
       
    45 #include "tp-props-iface.h"
       
    46 #include "tp-constants.h"
       
    47 #include "tp-interfaces.h"
       
    48 
       
    49 #include "isoim.h"
       
    50 
       
    51 /*! /file 
       
    52  *	Interfaces for the maintainence of the contact list. 
       
    53  *	client anywhere in the documentation refers to anyone
       
    54  *	using the isoserver
       
    55  */
       
    56 
       
    57 /*!
       
    58  *  /brief This function is called by message_send_recv function in isoservermain.c if message type
       
    59  *  is EReject_Contact_Request, EAccept_Contact_Request, EAdd_Contact_Request and EDelete_Contact_Request. 
       
    60  *  Contacts added/removed to/from list. This function parses the message buffer, 
       
    61  *  validates for the arguments and calls modify_contact_list to add/remove contacts
       
    62  * 
       
    63  *  /param buf : buffer to be parsed
       
    64  *  /param buf_len : buffer length
       
    65  *  /return : error code if any, 0 on success 
       
    66  */
       
    67 gint action_parse_modify_contact_list( gchar* buf, gint buf_len ) ;
       
    68 
       
    69 /*!
       
    70  *  /brief gets the handles for contacts. Handles are returned in request_modify_contact_list_handles_cb 
       
    71  *  callback which is an arg for the async request to get handles.
       
    72  *  
       
    73  *  /param msg_hdr : The header and message passed to callbacks
       
    74  *  /param contact_id : contact ids whose handles to be returned
       
    75  *  /param no_cntcts : total no. of contacts to be added
       
    76  *  /return : error code if any, handle on success 
       
    77  */
       
    78 guint get_handles_for_contacts ( send_msg_struct* msg_hdr, 
       
    79 	const gchar **contact_id, gint no_cntcts );
       
    80 	
       
    81 /*!
       
    82  *  /brief Handles are returned in this callback. Which will then actually do modify 
       
    83  *	the contact list based on the request type(add/remove/accept/reject)
       
    84  *	modify_contact_list_cb is registered as the callback.
       
    85  *
       
    86  *  /param proxy : unused
       
    87  *  /param handles : handles of the contacts
       
    88  *  /param error : error if any
       
    89  *  /param message : userdata(send_msg_struct) passed back
       
    90  *  /return : error code if any, handle on success 
       
    91  */		
       
    92 void request_modify_contact_list_handles_cb( DBusGProxy *proxy, GArray *handles, 
       
    93 		GError* error, gpointer message );	
       
    94 
       
    95 /*!
       
    96  *  /brief Calls get_handles_for_contacts to get the handles for contact. 
       
    97  * 
       
    98  *  /param msg_hdr : message request header passed to callbacks
       
    99  *  /param contact_id : contact ids to be added
       
   100  *  /param message : messgae if any
       
   101  *  /param no_cntcts : no of contacts to be added
       
   102  *  /return void 
       
   103  */
       
   104 gint modify_contact_list ( send_msg_struct* msg_hdr, const gchar  **contact_ids, 
       
   105 				gint no_cntcts );
       
   106 
       
   107 /*!
       
   108  *  /brief called as callback for request for modify contact list 
       
   109  *	This function then sends the result to client
       
   110  * 
       
   111  *  /param proxy unused 
       
   112  *  /param error Error if any
       
   113  *  /param userdata request message header
       
   114  *  /return void 
       
   115  */
       
   116 void modify_contact_list_cb( DBusGProxy *proxy, GError *error, gpointer userdata );
       
   117 
       
   118 /*!
       
   119  *  /brief The contact names corresponding to the contact handles that are changed 
       
   120  *	are passed to the client
       
   121  *  /param proxy 
       
   122  * 	/param handles_name
       
   123  * 	/param error
       
   124  * 	/param userdata
       
   125  * 	/return void 
       
   126  */
       
   127 static void rosters_changed_contacts_cb( DBusGProxy *proxy,
       
   128 	gchar **handles_names, GError *error, gpointer userdata );
       
   129 				 
       
   130 				 
       
   131 /*!	/brief Whenever contact list is changed by others( someone trying to add this user
       
   132  *	or someone rejecting the add request etc., ) this callback registered as a signal
       
   133  *	is called with the handles of the changed contacts. rosters_changed_contacts_cb is
       
   134  *	passed as callback to get the contact name of the changed handles
       
   135  * 
       
   136  * /param group_iface unused 
       
   137  * /param message unused
       
   138  * /param added List of contacts that are recently added
       
   139  * /param removed List of contacts that were recently removed
       
   140  * /param local_pending List of contacts that are locally pending for approval
       
   141  * /param remote_pending List of contacts that are remotely pending for approval
       
   142  * /param actor unused
       
   143  * /param reason unused
       
   144  * /param userdata unused
       
   145  * /return void
       
   146  */
       
   147 void roster_members_changed_cb ( DBusGProxy           *group_iface,
       
   148 									    gchar                *message,
       
   149 									    GArray               *added,
       
   150 									    GArray               *removed,
       
   151 									    GArray               *local_pending,
       
   152 									    GArray               *remote_pending,
       
   153 									    guint                 actor,
       
   154 									    guint                 reason,
       
   155 									    gpointer  			  userdata );				
       
   156 
       
   157 
       
   158 		
       
   159 #endif //__ISOADDCONTACTS_H__