Sat, 17 May 2003 01:41:52 +0000
[gaim-migrate @ 5782]
This should prevent the possibility of duplicate buddies when MSN
transfers us to a new notification server (rare).
| 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; | |
|
5363
b6e28be0c9bd
[gaim-migrate @ 5739]
Christian Hammond <chipx86@chipx86.com>
parents:
5327
diff
changeset
|
34 | MsnUser *user; |
| 5309 | 35 | |
| 36 | char *dispatch_server; | |
| 37 | int dispatch_port; | |
| 38 | ||
| 39 | gboolean connected; | |
| 40 | ||
| 41 | MsnServConn *dispatch_conn; | |
| 42 | MsnServConn *notification_conn; | |
| 43 | ||
| 44 | unsigned int trId; | |
| 45 | ||
| 46 | MsnUsers *users; | |
| 47 | ||
| 48 | GList *switches; | |
|
5318
2073a19f4217
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
49 | GHashTable *group_names; /* ID -> name */ |
|
2073a19f4217
[gaim-migrate @ 5690]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
50 | GHashTable *group_ids; /* Name -> ID */ |
| 5309 | 51 | |
| 52 | struct | |
| 53 | { | |
| 54 | GSList *forward; | |
| 55 | GSList *reverse; | |
| 56 | GSList *allow; | |
| 57 | GSList *block; | |
| 58 | ||
| 59 | } lists; | |
| 60 | ||
| 61 | struct | |
| 62 | { | |
| 63 | char *kv; | |
| 64 | char *sid; | |
| 65 | char *mspauth; | |
| 66 | unsigned long sl; | |
| 67 | char *file; | |
| 68 | ||
| 69 | } passport_info; | |
| 70 | ||
|
5322
782746a9bfdd
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
71 | /* You have no idea how much I hate all that is below. */ |
| 5309 | 72 | GaimPlugin *prpl; |
|
5322
782746a9bfdd
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
73 | |
|
5406
001d8ddda70b
[gaim-migrate @ 5782]
Christian Hammond <chipx86@chipx86.com>
parents:
5363
diff
changeset
|
74 | gboolean lists_synced; |
|
001d8ddda70b
[gaim-migrate @ 5782]
Christian Hammond <chipx86@chipx86.com>
parents:
5363
diff
changeset
|
75 | |
|
5322
782746a9bfdd
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
76 | /* For moving buddies from one group to another. Ugh. */ |
|
782746a9bfdd
[gaim-migrate @ 5694]
Christian Hammond <chipx86@chipx86.com>
parents:
5318
diff
changeset
|
77 | gboolean moving_buddy; |
|
5327
c12297f29f8d
[gaim-migrate @ 5700]
Christian Hammond <chipx86@chipx86.com>
parents:
5322
diff
changeset
|
78 | char *dest_group_name; |
| 5309 | 79 | }; |
| 80 | ||
| 81 | /** | |
| 82 | * Creates an MSN session. | |
| 83 | * | |
| 84 | * @param account The account. | |
| 85 | * @param server The dispatch server. | |
| 86 | * @param port The dispatch port. | |
| 87 | * | |
| 88 | * @return The new MSN session. | |
| 89 | */ | |
| 90 | MsnSession *msn_session_new(struct gaim_account *account, | |
| 91 | const char *server, int port); | |
| 92 | ||
| 93 | /** | |
| 94 | * Destroys an MSN session. | |
| 95 | * | |
| 96 | * @param session The MSN session to destroy. | |
| 97 | */ | |
| 98 | void msn_session_destroy(MsnSession *session); | |
| 99 | ||
| 100 | /** | |
| 101 | * Connects to and initiates an MSN session. | |
| 102 | * | |
| 103 | * @param session The MSN session. | |
| 104 | * | |
| 105 | * @return @c TRUE on success, @c FALSE on failure. | |
| 106 | */ | |
| 107 | gboolean msn_session_connect(MsnSession *session); | |
| 108 | ||
| 109 | /** | |
| 110 | * Disconnects from an MSN session. | |
| 111 | * | |
| 112 | * @param session The MSN session. | |
| 113 | */ | |
| 114 | void msn_session_disconnect(MsnSession *session); | |
| 115 | ||
| 116 | /** | |
| 117 | * Opens a new switchboard connection. | |
| 118 | * | |
| 119 | * @param session The MSN session. | |
| 120 | * | |
| 121 | * @return The new switchboard connection. | |
| 122 | */ | |
| 123 | MsnSwitchBoard *msn_session_open_switchboard(MsnSession *session); | |
| 124 | ||
| 125 | /** | |
| 126 | * Finds a switch with the given passport. | |
| 127 | * | |
| 128 | * @param session The MSN session. | |
| 129 | * @param passport The passport to search for. | |
| 130 | * | |
| 131 | * @return The switchboard, if found. | |
| 132 | */ | |
| 133 | MsnSwitchBoard *msn_session_find_switch_with_passport( | |
| 134 | const MsnSession *session, const char *passport); | |
| 135 | ||
| 136 | /** | |
| 137 | * Finds a switchboard with the given chat ID. | |
| 138 | * | |
| 139 | * @param session The MSN session. | |
| 140 | * @param chat_id The chat ID to search for. | |
| 141 | * | |
| 142 | * @return The switchboard, if found. | |
| 143 | */ | |
| 144 | MsnSwitchBoard *msn_session_find_switch_with_id(const MsnSession *session, | |
| 145 | int chat_id); | |
| 146 | ||
| 147 | /** | |
| 148 | * Finds the first unused switchboard. | |
| 149 | * | |
| 150 | * @param session The MSN session. | |
| 151 | * | |
| 152 | * @return The first unused, writable switchboard, if found. | |
| 153 | */ | |
| 154 | MsnSwitchBoard *msn_session_find_unused_switch(const MsnSession *session); | |
| 155 | ||
| 156 | #endif /* _MSN_SESSION_H_ */ |