Frameworks/libpurple.framework/Versions/0.6.0/Headers/switchboard.h
changeset 2592 e8d15275025e
parent 2591 f66a716bfc79
child 2593 b4bd28402abc
     1.1 --- a/Frameworks/libpurple.framework/Versions/0.6.0/Headers/switchboard.h	Fri Aug 21 13:24:36 2009 -0700
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,293 +0,0 @@
     1.4 -/**
     1.5 - * @file switchboard.h MSN switchboard functions
     1.6 - *
     1.7 - * purple
     1.8 - *
     1.9 - * Purple is the legal property of its developers, whose names are too numerous
    1.10 - * to list here.  Please refer to the COPYRIGHT file distributed with this
    1.11 - * source distribution.
    1.12 - *
    1.13 - * This program is free software; you can redistribute it and/or modify
    1.14 - * it under the terms of the GNU General Public License as published by
    1.15 - * the Free Software Foundation; either version 2 of the License, or
    1.16 - * (at your option) any later version.
    1.17 - *
    1.18 - * This program is distributed in the hope that it will be useful,
    1.19 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.20 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1.21 - * GNU General Public License for more details.
    1.22 - *
    1.23 - * You should have received a copy of the GNU General Public License
    1.24 - * along with this program; if not, write to the Free Software
    1.25 - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
    1.26 - */
    1.27 -#ifndef _MSN_SWITCHBOARD_H_
    1.28 -#define _MSN_SWITCHBOARD_H_
    1.29 -
    1.30 -typedef struct _MsnSwitchBoard MsnSwitchBoard;
    1.31 -
    1.32 -#include "conversation.h"
    1.33 -
    1.34 -#include "msg.h"
    1.35 -#include "user.h"
    1.36 -
    1.37 -#include "servconn.h"
    1.38 -
    1.39 -#include "slplink.h"
    1.40 -
    1.41 -/**
    1.42 - * A switchboard error.
    1.43 - */
    1.44 -typedef enum
    1.45 -{
    1.46 -	MSN_SB_ERROR_NONE, /**< No error. */
    1.47 -	MSN_SB_ERROR_CAL, /**< The user could not join (answer the call). */
    1.48 -	MSN_SB_ERROR_OFFLINE, /**< The account is offline. */
    1.49 -	MSN_SB_ERROR_USER_OFFLINE, /**< The user to call is offline. */
    1.50 -	MSN_SB_ERROR_CONNECTION, /**< There was a connection error. */
    1.51 -	MSN_SB_ERROR_TOO_FAST, /**< We are sending too fast */
    1.52 -	MSN_SB_ERROR_AUTHFAILED, /**< Authentication failed joining the switchboard session */
    1.53 -	MSN_SB_ERROR_UNKNOWN /**< An unknown error occurred. */
    1.54 -
    1.55 -} MsnSBErrorType;
    1.56 -
    1.57 -/**
    1.58 - * A switchboard flag.
    1.59 - */
    1.60 -typedef enum
    1.61 -{
    1.62 -	MSN_SB_FLAG_IM = 0x01, /**< This switchboard is being used for a conversation. */
    1.63 -	MSN_SB_FLAG_FT = 0x02  /**< This switchboard is being used for file transfer. */
    1.64 -
    1.65 -} MsnSBFlag;
    1.66 -
    1.67 -/**
    1.68 - * A switchboard.
    1.69 - *
    1.70 - * A place where a bunch of users send messages to the rest of the users.
    1.71 - */
    1.72 -struct _MsnSwitchBoard
    1.73 -{
    1.74 -	MsnSession *session;   /**< Our parent session. */
    1.75 -	MsnServConn *servconn; /**< The physical connection for this switchboard. */
    1.76 -	MsnCmdProc *cmdproc;   /**< Convenience variable for servconn->cmdproc. */
    1.77 -	char *im_user;
    1.78 -
    1.79 -	MsnSBFlag flag;
    1.80 -	char *auth_key;
    1.81 -	char *session_id;
    1.82 -
    1.83 -	PurpleConversation *conv; /**< The conversation that displays the
    1.84 -							  messages of this switchboard, or @c NULL if
    1.85 -							  this is a helper switchboard. */
    1.86 -
    1.87 -	gboolean empty;			/**< A flag that states if the swithcboard has no
    1.88 -							  users in it. */
    1.89 -	gboolean invited;		/**< A flag that states if we were invited to the
    1.90 -							  switchboard. */
    1.91 -	gboolean ready;			/**< A flag that states if this switchboard is
    1.92 -							  ready to be used. */
    1.93 -	gboolean closed;		/**< A flag that states if the switchboard has
    1.94 -							  been closed by the user. */
    1.95 -	gboolean destroying;	/**< A flag that states if the switchboard is
    1.96 -							  alredy on the process of destruction. */
    1.97 -
    1.98 -	int current_users;
    1.99 -	int total_users;
   1.100 -	GList *users;
   1.101 -
   1.102 -	int chat_id;
   1.103 -
   1.104 -	GQueue *msg_queue; /**< Queue of messages to send. */
   1.105 -	GList *ack_list; /**< List of messages waiting for an ack. */
   1.106 -
   1.107 -	MsnSBErrorType error; /**< The error that occurred in this switchboard
   1.108 -							(if applicable). */
   1.109 -	GList *slplinks; /**< The list of slplinks that are using this switchboard. */
   1.110 -	guint reconn_timeout_h;
   1.111 -};
   1.112 -
   1.113 -/**
   1.114 - * Initialize the variables for switchboard creation.
   1.115 - */
   1.116 -void msn_switchboard_init(void);
   1.117 -
   1.118 -/**
   1.119 - * Destroy the variables for switchboard creation.
   1.120 - */
   1.121 -void msn_switchboard_end(void);
   1.122 -
   1.123 -/**
   1.124 - * Creates a new switchboard.
   1.125 - *
   1.126 - * @param session The MSN session.
   1.127 - *
   1.128 - * @return The new switchboard.
   1.129 - */
   1.130 -MsnSwitchBoard *msn_switchboard_new(MsnSession *session);
   1.131 -
   1.132 -/**
   1.133 - * Destroys a switchboard.
   1.134 - *
   1.135 - * @param swboard The switchboard to destroy.
   1.136 - */
   1.137 -void msn_switchboard_destroy(MsnSwitchBoard *swboard);
   1.138 -
   1.139 -/**
   1.140 - * Sets the auth key the switchboard must use when connecting.
   1.141 - *
   1.142 - * @param swboard The switchboard.
   1.143 - * @param key     The auth key.
   1.144 - */
   1.145 -void msn_switchboard_set_auth_key(MsnSwitchBoard *swboard, const char *key);
   1.146 -
   1.147 -/**
   1.148 - * Returns the auth key the switchboard must use when connecting.
   1.149 - *
   1.150 - * @param swboard The switchboard.
   1.151 - *
   1.152 - * @return The auth key.
   1.153 - */
   1.154 -const char *msn_switchboard_get_auth_key(MsnSwitchBoard *swboard);
   1.155 -
   1.156 -/**
   1.157 - * Sets the session ID the switchboard must use when connecting.
   1.158 - *
   1.159 - * @param swboard The switchboard.
   1.160 - * @param id      The session ID.
   1.161 - */
   1.162 -void msn_switchboard_set_session_id(MsnSwitchBoard *swboard, const char *id);
   1.163 -
   1.164 -/**
   1.165 - * Returns the session ID the switchboard must use when connecting.
   1.166 - *
   1.167 - * @param swboard The switchboard.
   1.168 - *
   1.169 - * @return The session ID.
   1.170 - */
   1.171 -const char *msn_switchboard_get_session_id(MsnSwitchBoard *swboard);
   1.172 -
   1.173 -/**
   1.174 - * Returns the next chat ID for use by a switchboard.
   1.175 - *
   1.176 - * @return The chat ID.
   1.177 - */
   1.178 -int msn_switchboard_get_chat_id(void);
   1.179 -
   1.180 -/**
   1.181 - * Sets whether or not we were invited to this switchboard.
   1.182 - *
   1.183 - * @param swboard The switchboard.
   1.184 - * @param invite  @c TRUE if invited, @c FALSE otherwise.
   1.185 - */
   1.186 -void msn_switchboard_set_invited(MsnSwitchBoard *swboard, gboolean invited);
   1.187 -
   1.188 -/**
   1.189 - * Returns whether or not we were invited to this switchboard.
   1.190 - *
   1.191 - * @param swboard The switchboard.
   1.192 - *
   1.193 - * @return @c TRUE if invited, @c FALSE otherwise.
   1.194 - */
   1.195 -gboolean msn_switchboard_is_invited(MsnSwitchBoard *swboard);
   1.196 -
   1.197 -/**
   1.198 - * Connects to a switchboard.
   1.199 - *
   1.200 - * @param swboard The switchboard.
   1.201 - * @param host    The switchboard server host.
   1.202 - * @param port    The switcbharod server port.
   1.203 - *
   1.204 - * @return @c TRUE if able to connect, or @c FALSE otherwise.
   1.205 - */
   1.206 -gboolean msn_switchboard_connect(MsnSwitchBoard *swboard,
   1.207 -								 const char *host, int port);
   1.208 -
   1.209 -/**
   1.210 - * Disconnects from a switchboard.
   1.211 - *
   1.212 - * @param swboard The switchboard to disconnect from.
   1.213 - */
   1.214 -void msn_switchboard_disconnect(MsnSwitchBoard *swboard);
   1.215 -
   1.216 -/**
   1.217 - * Closes the switchboard.
   1.218 - *
   1.219 - * Called when a conversation is closed.
   1.220 - *
   1.221 - * @param swboard The switchboard to close.
   1.222 - */
   1.223 -void msn_switchboard_close(MsnSwitchBoard *swboard);
   1.224 -
   1.225 -/**
   1.226 - * Release a switchboard from a certain function.
   1.227 - *
   1.228 - * @param swboard The switchboard to release.
   1.229 - * @param flag The flag that states the function.
   1.230 - */
   1.231 -void msn_switchboard_release(MsnSwitchBoard *swboard, MsnSBFlag flag);
   1.232 -
   1.233 -/**
   1.234 - * Returns whether or not we currently can send a message through this
   1.235 - * switchboard.
   1.236 - *
   1.237 - * @param swboard The switchboard.
   1.238 - *
   1.239 - * @return @c TRUE if a message can be sent, @c FALSE otherwise.
   1.240 - */
   1.241 -gboolean msn_switchboard_can_send(MsnSwitchBoard *swboard);
   1.242 -
   1.243 -/**
   1.244 - * Sends a message through this switchboard.
   1.245 - *
   1.246 - * @param swboard The switchboard.
   1.247 - * @param msg The message.
   1.248 - * @param queue A flag that states if we want this message to be queued (in
   1.249 - * the case it cannot currently be sent).
   1.250 - *
   1.251 - * @return @c TRUE if a message can be sent, @c FALSE otherwise.
   1.252 - */
   1.253 -void msn_switchboard_send_msg(MsnSwitchBoard *swboard, MsnMessage *msg,
   1.254 -							  gboolean queue);
   1.255 -
   1.256 -gboolean msn_switchboard_chat_leave(MsnSwitchBoard *swboard);
   1.257 -gboolean msn_switchboard_chat_invite(MsnSwitchBoard *swboard, const char *who);
   1.258 -
   1.259 -void msn_switchboard_request(MsnSwitchBoard *swboard);
   1.260 -void msn_switchboard_request_add_user(MsnSwitchBoard *swboard, const char *user);
   1.261 -
   1.262 -/**
   1.263 - * Processes peer to peer messages.
   1.264 - *
   1.265 - * @param cmdproc The command processor.
   1.266 - * @param msg     The message.
   1.267 - */
   1.268 -void msn_p2p_msg(MsnCmdProc *cmdproc, MsnMessage *msg);
   1.269 -
   1.270 -/**
   1.271 - * Processes emoticon messages.
   1.272 - *
   1.273 - * @param cmdproc The command processor.
   1.274 - * @param msg     The message.
   1.275 - */
   1.276 -void msn_emoticon_msg(MsnCmdProc *cmdproc, MsnMessage *msg);
   1.277 -
   1.278 -/**
   1.279 - * Processes INVITE messages.
   1.280 - *
   1.281 - * @param cmdproc The command processor.
   1.282 - * @param msg     The message.
   1.283 - */
   1.284 -void msn_invite_msg(MsnCmdProc *cmdproc, MsnMessage *msg);
   1.285 -
   1.286 -/**
   1.287 - * Shows an ink message from this switchboard.
   1.288 - *
   1.289 - * @param swboard  The switchboard.
   1.290 - * @param passport The user that sent the ink.
   1.291 - * @param data     The ink data.
   1.292 - */
   1.293 -void msn_switchboard_show_ink(MsnSwitchBoard *swboard, const char *passport,
   1.294 -                              const char *data);
   1.295 -
   1.296 -#endif /* _MSN_SWITCHBOARD_H_ */