Tue, 25 Nov 2003 07:16:11 +0000
[gaim-migrate @ 8255]
long car rides and a power inverter can generate some interesting code tweaks
| 5309 | 1 | /** |
| 2 | * @file session.h MSN session functions | |
| 3 | * | |
| 4 | * gaim | |
| 5 | * | |
| 6 | * Copyright (C) 2003 Christian Hammond <chipx86@gnupdate.org> | |
|
6701
7e2db9273748
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
5898
diff
changeset
|
7 | * |
| 5309 | 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 | ||
|
6701
7e2db9273748
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
5898
diff
changeset
|
27 | #include "sslconn.h" |
|
7e2db9273748
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
5898
diff
changeset
|
28 | |
| 5309 | 29 | #include "servconn.h" |
| 30 | #include "switchboard.h" | |
| 31 | #include "user.h" | |
|
5518
436fb9490b62
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
32 | #include "group.h" |
| 5309 | 33 | |
| 34 | struct _MsnSession | |
| 35 | { | |
|
5564
1779a1bfbdb8
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
36 | GaimAccount *account; |
|
5363
b6e28be0c9bd
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
37 | MsnUser *user; |
|
7590
54b26062c7e0
[gaim-migrate @ 8208]
Christian Hammond <chipx86@chipx86.com>
parents:
7288
diff
changeset
|
38 | char *away_state; |
| 5309 | 39 | |
| 7631 | 40 | guint protocol_ver; |
|
6701
7e2db9273748
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
5898
diff
changeset
|
41 | |
| 5309 | 42 | char *dispatch_server; |
| 43 | int dispatch_port; | |
| 44 | ||
| 45 | gboolean connected; | |
| 46 | ||
| 47 | MsnServConn *dispatch_conn; | |
| 48 | MsnServConn *notification_conn; | |
| 49 | ||
| 50 | unsigned int trId; | |
| 51 | ||
|
7288
486e8b44a14b
[gaim-migrate @ 7869]
Christian Hammond <chipx86@chipx86.com>
parents:
6701
diff
changeset
|
52 | gboolean http_method; |
|
486e8b44a14b
[gaim-migrate @ 7869]
Christian Hammond <chipx86@chipx86.com>
parents:
6701
diff
changeset
|
53 | |
|
6701
7e2db9273748
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
5898
diff
changeset
|
54 | char *ssl_url; |
|
7e2db9273748
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
5898
diff
changeset
|
55 | char *ssl_login_host; |
|
7e2db9273748
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
5898
diff
changeset
|
56 | char *ssl_login_path; |
|
7e2db9273748
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
5898
diff
changeset
|
57 | char *ssl_login_params; |
|
7e2db9273748
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
5898
diff
changeset
|
58 | GHashTable *ssl_challenge_data; |
|
7e2db9273748
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
5898
diff
changeset
|
59 | GaimSslConnection *ssl_conn; |
|
7e2db9273748
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
5898
diff
changeset
|
60 | |
| 5309 | 61 | MsnUsers *users; |
|
5518
436fb9490b62
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
62 | MsnGroups *groups; |
| 5309 | 63 | |
|
5898
77c591517706
[gaim-migrate @ 6330]
Christian Hammond <chipx86@chipx86.com>
parents:
5564
diff
changeset
|
64 | GList *servconns; |
| 5309 | 65 | GList *switches; |
| 66 | ||
| 67 | struct | |
| 68 | { | |
| 69 | GSList *forward; | |
| 70 | GSList *reverse; | |
| 71 | GSList *allow; | |
| 72 | GSList *block; | |
| 73 | ||
| 74 | } lists; | |
| 75 | ||
| 76 | struct | |
| 77 | { | |
| 78 | char *kv; | |
| 79 | char *sid; | |
| 80 | char *mspauth; | |
| 81 | unsigned long sl; | |
| 82 | char *file; | |
|
6701
7e2db9273748
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
5898
diff
changeset
|
83 | char *client_ip; |
|
7e2db9273748
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
5898
diff
changeset
|
84 | int client_port; |
| 5309 | 85 | |
| 86 | } passport_info; | |
| 87 | ||
|
5322
782746a9bfdd
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
88 | /* You have no idea how much I hate all that is below. */ |
| 5309 | 89 | GaimPlugin *prpl; |
|
5322
782746a9bfdd
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
90 | |
|
6701
7e2db9273748
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
5898
diff
changeset
|
91 | /* For MSNP8 and MSNP9. */ |
|
7e2db9273748
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
5898
diff
changeset
|
92 | int num_users; |
|
7e2db9273748
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
5898
diff
changeset
|
93 | int total_users; |
|
7e2db9273748
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
5898
diff
changeset
|
94 | int num_groups; |
|
7e2db9273748
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
5898
diff
changeset
|
95 | int total_groups; |
|
7e2db9273748
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
5898
diff
changeset
|
96 | MsnUser *last_user_added; |
|
7e2db9273748
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
5898
diff
changeset
|
97 | |
|
7e2db9273748
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
5898
diff
changeset
|
98 | /* For MSNP7 and lower. */ |
|
5456
ff4eb9f08890
[gaim-migrate @ 5844]
Christian Hammond <chipx86@chipx86.com>
parents:
5406
diff
changeset
|
99 | gboolean syncing_lists; |
|
5406
001d8ddda70b
[gaim-migrate @ 5782]
Christian Hammond <chipx86@chipx86.com>
parents:
5363
diff
changeset
|
100 | gboolean lists_synced; |
|
001d8ddda70b
[gaim-migrate @ 5782]
Christian Hammond <chipx86@chipx86.com>
parents:
5363
diff
changeset
|
101 | |
|
5322
782746a9bfdd
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
102 | /* For moving buddies from one group to another. Ugh. */ |
|
782746a9bfdd
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
103 | gboolean moving_buddy; |
|
5327
c12297f29f8d
[gaim-migrate @ 5700]
Christian Hammond <chipx86@chipx86.com>
parents:
5322
diff
changeset
|
104 | char *dest_group_name; |
|
5518
436fb9490b62
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
105 | MsnUser *moving_user; |
|
436fb9490b62
[gaim-migrate @ 5918]
Christian Hammond <chipx86@chipx86.com>
parents:
5456
diff
changeset
|
106 | MsnGroup *old_group; |
| 5309 | 107 | }; |
| 108 | ||
| 109 | /** | |
| 110 | * Creates an MSN session. | |
| 111 | * | |
| 112 | * @param account The account. | |
| 113 | * @param server The dispatch server. | |
| 114 | * @param port The dispatch port. | |
| 115 | * | |
| 116 | * @return The new MSN session. | |
| 117 | */ | |
|
5564
1779a1bfbdb8
[gaim-migrate @ 5966]
Christian Hammond <chipx86@chipx86.com>
parents:
5518
diff
changeset
|
118 | MsnSession *msn_session_new(GaimAccount *account, |
| 5309 | 119 | const char *server, int port); |
| 120 | ||
| 121 | /** | |
| 122 | * Destroys an MSN session. | |
| 123 | * | |
| 124 | * @param session The MSN session to destroy. | |
| 125 | */ | |
| 126 | void msn_session_destroy(MsnSession *session); | |
| 127 | ||
| 128 | /** | |
| 129 | * Connects to and initiates an MSN session. | |
| 130 | * | |
| 131 | * @param session The MSN session. | |
| 132 | * | |
| 133 | * @return @c TRUE on success, @c FALSE on failure. | |
| 134 | */ | |
| 135 | gboolean msn_session_connect(MsnSession *session); | |
| 136 | ||
| 137 | /** | |
| 138 | * Disconnects from an MSN session. | |
| 139 | * | |
| 140 | * @param session The MSN session. | |
| 141 | */ | |
| 142 | void msn_session_disconnect(MsnSession *session); | |
| 143 | ||
| 144 | /** | |
| 145 | * Opens a new switchboard connection. | |
| 146 | * | |
| 147 | * @param session The MSN session. | |
| 148 | * | |
| 149 | * @return The new switchboard connection. | |
| 150 | */ | |
| 151 | MsnSwitchBoard *msn_session_open_switchboard(MsnSession *session); | |
| 152 | ||
| 153 | /** | |
|
7590
54b26062c7e0
[gaim-migrate @ 8208]
Christian Hammond <chipx86@chipx86.com>
parents:
7288
diff
changeset
|
154 | * Changes the status of the user. |
|
54b26062c7e0
[gaim-migrate @ 8208]
Christian Hammond <chipx86@chipx86.com>
parents:
7288
diff
changeset
|
155 | * |
|
54b26062c7e0
[gaim-migrate @ 8208]
Christian Hammond <chipx86@chipx86.com>
parents:
7288
diff
changeset
|
156 | * @param session The MSN session. |
|
54b26062c7e0
[gaim-migrate @ 8208]
Christian Hammond <chipx86@chipx86.com>
parents:
7288
diff
changeset
|
157 | * @param state The new state. |
|
54b26062c7e0
[gaim-migrate @ 8208]
Christian Hammond <chipx86@chipx86.com>
parents:
7288
diff
changeset
|
158 | */ |
|
54b26062c7e0
[gaim-migrate @ 8208]
Christian Hammond <chipx86@chipx86.com>
parents:
7288
diff
changeset
|
159 | gboolean msn_session_change_status(MsnSession *session, const char *state); |
|
54b26062c7e0
[gaim-migrate @ 8208]
Christian Hammond <chipx86@chipx86.com>
parents:
7288
diff
changeset
|
160 | |
|
54b26062c7e0
[gaim-migrate @ 8208]
Christian Hammond <chipx86@chipx86.com>
parents:
7288
diff
changeset
|
161 | /** |
| 5309 | 162 | * Finds a switch with the given passport. |
| 163 | * | |
| 164 | * @param session The MSN session. | |
| 165 | * @param passport The passport to search for. | |
| 166 | * | |
| 167 | * @return The switchboard, if found. | |
| 168 | */ | |
| 169 | MsnSwitchBoard *msn_session_find_switch_with_passport( | |
| 170 | const MsnSession *session, const char *passport); | |
| 171 | ||
| 172 | /** | |
| 173 | * Finds a switchboard with the given chat ID. | |
| 174 | * | |
| 175 | * @param session The MSN session. | |
| 176 | * @param chat_id The chat ID to search for. | |
| 177 | * | |
| 178 | * @return The switchboard, if found. | |
| 179 | */ | |
| 180 | MsnSwitchBoard *msn_session_find_switch_with_id(const MsnSession *session, | |
| 181 | int chat_id); | |
| 182 | ||
| 183 | /** | |
| 184 | * Finds the first unused switchboard. | |
| 185 | * | |
| 186 | * @param session The MSN session. | |
| 187 | * | |
| 188 | * @return The first unused, writable switchboard, if found. | |
| 189 | */ | |
| 190 | MsnSwitchBoard *msn_session_find_unused_switch(const MsnSession *session); | |
| 191 | ||
| 192 | #endif /* _MSN_SESSION_H_ */ |