5309
|
1 /**
|
|
2 * @file session.h MSN session functions
|
|
3 *
|
|
4 * gaim
|
|
5 *
|
|
6 * Copyright (C) 2003 Christian Hammond <chipx86@gnupdate.org>
|
|
7 *
|
|
8 * This program is free software; you can redistribute it and/or modify
|
|
9 * it under the terms of the GNU General Public License as published by
|
|
10 * the Free Software Foundation; either version 2 of the License, or
|
|
11 * (at your option) any later version.
|
|
12 *
|
|
13 * This program is distributed in the hope that it will be useful,
|
|
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16 * GNU General Public License for more details.
|
|
17 *
|
|
18 * You should have received a copy of the GNU General Public License
|
|
19 * along with this program; if not, write to the Free Software
|
|
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
21 */
|
|
22 #ifndef _MSN_SESSION_H_
|
|
23 #define _MSN_SESSION_H_
|
|
24
|
|
25 typedef struct _MsnSession MsnSession;
|
|
26
|
|
27 #include "servconn.h"
|
|
28 #include "switchboard.h"
|
|
29 #include "user.h"
|
|
30
|
|
31 struct _MsnSession
|
|
32 {
|
|
33 struct gaim_account *account;
|
|
34
|
|
35 char *dispatch_server;
|
|
36 int dispatch_port;
|
|
37
|
|
38 gboolean connected;
|
|
39
|
|
40 MsnServConn *dispatch_conn;
|
|
41 MsnServConn *notification_conn;
|
|
42
|
|
43 unsigned int trId;
|
|
44
|
|
45 MsnUsers *users;
|
|
46
|
|
47 GList *switches;
|
|
48 GHashTable *groups;
|
|
49
|
|
50 struct
|
|
51 {
|
|
52 GSList *forward;
|
|
53 GSList *reverse;
|
|
54 GSList *allow;
|
|
55 GSList *block;
|
|
56
|
|
57 } lists;
|
|
58
|
|
59 struct
|
|
60 {
|
|
61 char *kv;
|
|
62 char *sid;
|
|
63 char *mspauth;
|
|
64 unsigned long sl;
|
|
65 char *file;
|
|
66
|
|
67 } passport_info;
|
|
68
|
|
69 /* You have no idea how much I hate this. */
|
|
70 GaimPlugin *prpl;
|
|
71 };
|
|
72
|
|
73 /**
|
|
74 * Creates an MSN session.
|
|
75 *
|
|
76 * @param account The account.
|
|
77 * @param server The dispatch server.
|
|
78 * @param port The dispatch port.
|
|
79 *
|
|
80 * @return The new MSN session.
|
|
81 */
|
|
82 MsnSession *msn_session_new(struct gaim_account *account,
|
|
83 const char *server, int port);
|
|
84
|
|
85 /**
|
|
86 * Destroys an MSN session.
|
|
87 *
|
|
88 * @param session The MSN session to destroy.
|
|
89 */
|
|
90 void msn_session_destroy(MsnSession *session);
|
|
91
|
|
92 /**
|
|
93 * Connects to and initiates an MSN session.
|
|
94 *
|
|
95 * @param session The MSN session.
|
|
96 *
|
|
97 * @return @c TRUE on success, @c FALSE on failure.
|
|
98 */
|
|
99 gboolean msn_session_connect(MsnSession *session);
|
|
100
|
|
101 /**
|
|
102 * Disconnects from an MSN session.
|
|
103 *
|
|
104 * @param session The MSN session.
|
|
105 */
|
|
106 void msn_session_disconnect(MsnSession *session);
|
|
107
|
|
108 /**
|
|
109 * Opens a new switchboard connection.
|
|
110 *
|
|
111 * @param session The MSN session.
|
|
112 *
|
|
113 * @return The new switchboard connection.
|
|
114 */
|
|
115 MsnSwitchBoard *msn_session_open_switchboard(MsnSession *session);
|
|
116
|
|
117 /**
|
|
118 * Finds a switch with the given passport.
|
|
119 *
|
|
120 * @param session The MSN session.
|
|
121 * @param passport The passport to search for.
|
|
122 *
|
|
123 * @return The switchboard, if found.
|
|
124 */
|
|
125 MsnSwitchBoard *msn_session_find_switch_with_passport(
|
|
126 const MsnSession *session, const char *passport);
|
|
127
|
|
128 /**
|
|
129 * Finds a switchboard with the given chat ID.
|
|
130 *
|
|
131 * @param session The MSN session.
|
|
132 * @param chat_id The chat ID to search for.
|
|
133 *
|
|
134 * @return The switchboard, if found.
|
|
135 */
|
|
136 MsnSwitchBoard *msn_session_find_switch_with_id(const MsnSession *session,
|
|
137 int chat_id);
|
|
138
|
|
139 /**
|
|
140 * Finds the first unused switchboard.
|
|
141 *
|
|
142 * @param session The MSN session.
|
|
143 *
|
|
144 * @return The first unused, writable switchboard, if found.
|
|
145 */
|
|
146 MsnSwitchBoard *msn_session_find_unused_switch(const MsnSession *session);
|
|
147
|
|
148 #endif /* _MSN_SESSION_H_ */
|