Sun, 26 Aug 2007 06:36:56 +0000
In msimprpl, move session-related functions to a new session module.
|
19616
017838ce7393
In msimprpl, move zap-related code to a separate module.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
1 | /* MySpaceIM Protocol Plugin, session |
|
017838ce7393
In msimprpl, move zap-related code to a separate module.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
2 | * |
|
017838ce7393
In msimprpl, move zap-related code to a separate module.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
3 | * Copyright (C) 2007, Jeff Connelly <jeff2@soc.pidgin.im> |
|
017838ce7393
In msimprpl, move zap-related code to a separate module.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
4 | * |
|
017838ce7393
In msimprpl, move zap-related code to a separate module.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
5 | * This program is free software; you can redistribute it and/or modify |
|
017838ce7393
In msimprpl, move zap-related code to a separate module.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
6 | * it under the terms of the GNU General Public License as published by |
|
017838ce7393
In msimprpl, move zap-related code to a separate module.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
7 | * the Free Software Foundation; either version 2 of the License, or |
|
017838ce7393
In msimprpl, move zap-related code to a separate module.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
8 | * (at your option) any later version. |
|
017838ce7393
In msimprpl, move zap-related code to a separate module.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
9 | * |
|
017838ce7393
In msimprpl, move zap-related code to a separate module.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
10 | * This program is distributed in the hope that it will be useful, |
|
017838ce7393
In msimprpl, move zap-related code to a separate module.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
017838ce7393
In msimprpl, move zap-related code to a separate module.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
017838ce7393
In msimprpl, move zap-related code to a separate module.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
13 | * GNU General Public License for more details. |
|
017838ce7393
In msimprpl, move zap-related code to a separate module.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
14 | * |
|
017838ce7393
In msimprpl, move zap-related code to a separate module.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
15 | * You should have received a copy of the GNU General Public License |
|
017838ce7393
In msimprpl, move zap-related code to a separate module.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
16 | * along with this program; if not, write to the Free Software |
|
017838ce7393
In msimprpl, move zap-related code to a separate module.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
017838ce7393
In msimprpl, move zap-related code to a separate module.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
18 | */ |
|
017838ce7393
In msimprpl, move zap-related code to a separate module.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
19 | |
|
19617
c2da44d56312
In msimprpl, move session-related functions to a new session module.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19616
diff
changeset
|
20 | #ifndef _MYSPACE_SESSION_H |
|
c2da44d56312
In msimprpl, move session-related functions to a new session module.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19616
diff
changeset
|
21 | #define _MYSPACE_SESSION_H |
|
c2da44d56312
In msimprpl, move session-related functions to a new session module.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19616
diff
changeset
|
22 | |
|
19616
017838ce7393
In msimprpl, move zap-related code to a separate module.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
23 | /* Random number in every MsimSession, to ensure it is valid. */ |
|
017838ce7393
In msimprpl, move zap-related code to a separate module.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
24 | #define MSIM_SESSION_STRUCT_MAGIC 0xe4a6752b |
|
017838ce7393
In msimprpl, move zap-related code to a separate module.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
25 | |
|
017838ce7393
In msimprpl, move zap-related code to a separate module.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
26 | /* Everything needed to keep track of a session (proto_data field in PurpleConnection) */ |
|
017838ce7393
In msimprpl, move zap-related code to a separate module.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
27 | typedef struct _MsimSession |
|
017838ce7393
In msimprpl, move zap-related code to a separate module.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
28 | { |
|
017838ce7393
In msimprpl, move zap-related code to a separate module.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
29 | guint magic; /**< MSIM_SESSION_STRUCT_MAGIC */ |
|
017838ce7393
In msimprpl, move zap-related code to a separate module.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
30 | PurpleAccount *account; |
|
017838ce7393
In msimprpl, move zap-related code to a separate module.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
31 | PurpleConnection *gc; |
|
017838ce7393
In msimprpl, move zap-related code to a separate module.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
32 | guint sesskey; /**< Session key from server */ |
|
017838ce7393
In msimprpl, move zap-related code to a separate module.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
33 | guint userid; /**< This user's numeric user ID */ |
|
017838ce7393
In msimprpl, move zap-related code to a separate module.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
34 | gchar *username; /**< This user's unique username */ |
|
017838ce7393
In msimprpl, move zap-related code to a separate module.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
35 | gint fd; /**< File descriptor to/from server */ |
|
017838ce7393
In msimprpl, move zap-related code to a separate module.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
36 | |
|
017838ce7393
In msimprpl, move zap-related code to a separate module.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
37 | /* TODO: Remove. */ |
|
017838ce7393
In msimprpl, move zap-related code to a separate module.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
38 | GHashTable *user_lookup_cb; /**< Username -> userid lookup callback */ |
|
017838ce7393
In msimprpl, move zap-related code to a separate module.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
39 | GHashTable *user_lookup_cb_data; /**< Username -> userid lookup callback data */ |
|
017838ce7393
In msimprpl, move zap-related code to a separate module.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
40 | |
|
017838ce7393
In msimprpl, move zap-related code to a separate module.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
41 | MsimMessage *server_info; /**< Parameters from server */ |
|
017838ce7393
In msimprpl, move zap-related code to a separate module.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
42 | |
|
017838ce7393
In msimprpl, move zap-related code to a separate module.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
43 | gchar *rxbuf; /**< Receive buffer */ |
|
017838ce7393
In msimprpl, move zap-related code to a separate module.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
44 | guint rxoff; /**< Receive buffer offset */ |
|
017838ce7393
In msimprpl, move zap-related code to a separate module.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
45 | guint next_rid; /**< Next request/response ID */ |
|
017838ce7393
In msimprpl, move zap-related code to a separate module.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
46 | time_t last_comm; /**< Time received last communication */ |
|
017838ce7393
In msimprpl, move zap-related code to a separate module.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
47 | guint inbox_status; /**< Bit field of inbox notifications */ |
|
017838ce7393
In msimprpl, move zap-related code to a separate module.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
48 | } MsimSession; |
|
017838ce7393
In msimprpl, move zap-related code to a separate module.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
49 | |
|
017838ce7393
In msimprpl, move zap-related code to a separate module.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
50 | /* Check if an MsimSession is valid */ |
|
017838ce7393
In msimprpl, move zap-related code to a separate module.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
51 | #define MSIM_SESSION_VALID(s) (session != NULL && session->magic == MSIM_SESSION_STRUCT_MAGIC) |
|
017838ce7393
In msimprpl, move zap-related code to a separate module.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
52 | |
|
19617
c2da44d56312
In msimprpl, move session-related functions to a new session module.
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19616
diff
changeset
|
53 | #endif /* !_MYSPACE_SESSION_H */ |