Wed, 01 Oct 2003 07:15:53 +0000
[gaim-migrate @ 7673]
Put the rest of util.[ch] into namespaces and sectioned off the functions.
| 5309 | 1 | /** |
| 2 | * @file servconn.h Server connection 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:
5962
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_SERVCONN_H_ | |
| 23 | #define _MSN_SERVCONN_H_ | |
| 24 | ||
|
6701
7e2db9273748
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
5962
diff
changeset
|
25 | #include "proxy.h" |
|
7e2db9273748
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
5962
diff
changeset
|
26 | |
| 5309 | 27 | typedef struct _MsnServConn MsnServConn; |
| 28 | ||
| 29 | #include "msg.h" | |
| 30 | ||
| 31 | typedef gboolean (*MsnServConnCommandCb)(MsnServConn *servconn, | |
| 32 | const char *cmd, const char **params, | |
| 33 | size_t param_count); | |
| 34 | ||
|
5506
b53a1acacefe
[gaim-migrate @ 5905]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
35 | typedef gboolean (*MsnServConnMsgCb)(MsnServConn *servconn, MsnMessage *msg); |
| 5309 | 36 | |
| 37 | #include "session.h" | |
| 38 | ||
|
5962
d5413616b57b
[gaim-migrate @ 6409]
Christian Hammond <chipx86@chipx86.com>
parents:
5506
diff
changeset
|
39 | typedef enum |
|
d5413616b57b
[gaim-migrate @ 6409]
Christian Hammond <chipx86@chipx86.com>
parents:
5506
diff
changeset
|
40 | { |
|
d5413616b57b
[gaim-migrate @ 6409]
Christian Hammond <chipx86@chipx86.com>
parents:
5506
diff
changeset
|
41 | MSN_MULTILINE_MSG, |
|
d5413616b57b
[gaim-migrate @ 6409]
Christian Hammond <chipx86@chipx86.com>
parents:
5506
diff
changeset
|
42 | MSN_MULTILINE_IPG, |
|
d5413616b57b
[gaim-migrate @ 6409]
Christian Hammond <chipx86@chipx86.com>
parents:
5506
diff
changeset
|
43 | MSN_MULTILINE_NOT |
|
d5413616b57b
[gaim-migrate @ 6409]
Christian Hammond <chipx86@chipx86.com>
parents:
5506
diff
changeset
|
44 | |
|
d5413616b57b
[gaim-migrate @ 6409]
Christian Hammond <chipx86@chipx86.com>
parents:
5506
diff
changeset
|
45 | } MsnMultilineType; |
|
d5413616b57b
[gaim-migrate @ 6409]
Christian Hammond <chipx86@chipx86.com>
parents:
5506
diff
changeset
|
46 | |
| 5309 | 47 | struct _MsnServConn |
| 48 | { | |
| 49 | MsnSession *session; | |
| 50 | ||
| 51 | gboolean connected; | |
| 52 | ||
| 53 | char *server; | |
| 54 | int port; | |
| 55 | ||
| 56 | int fd; | |
| 57 | int inpa; | |
| 58 | ||
| 59 | char *rxqueue; | |
| 60 | int rxlen; | |
| 61 | ||
|
5506
b53a1acacefe
[gaim-migrate @ 5905]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
62 | GSList *msg_queue; |
|
b53a1acacefe
[gaim-migrate @ 5905]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
63 | |
| 5309 | 64 | GSList *txqueue; |
| 65 | ||
|
5962
d5413616b57b
[gaim-migrate @ 6409]
Christian Hammond <chipx86@chipx86.com>
parents:
5506
diff
changeset
|
66 | gboolean parsing_multiline; |
|
d5413616b57b
[gaim-migrate @ 6409]
Christian Hammond <chipx86@chipx86.com>
parents:
5506
diff
changeset
|
67 | MsnMultilineType multiline_type; |
| 5309 | 68 | char *msg_passport; |
| 69 | char *msg_friendly; | |
|
5962
d5413616b57b
[gaim-migrate @ 6409]
Christian Hammond <chipx86@chipx86.com>
parents:
5506
diff
changeset
|
70 | int multiline_len; |
| 5309 | 71 | |
| 72 | GHashTable *commands; | |
| 73 | GHashTable *msg_types; | |
| 74 | ||
| 75 | gboolean (*connect_cb)(gpointer, gint, GaimInputCondition); | |
| 76 | void (*failed_read_cb)(gpointer, gint, GaimInputCondition); | |
| 77 | void (*login_cb)(gpointer, gint, GaimInputCondition); | |
| 78 | ||
| 79 | void *data; | |
| 80 | }; | |
| 81 | ||
| 82 | MsnServConn *msn_servconn_new(MsnSession *session); | |
| 83 | ||
| 84 | void msn_servconn_destroy(MsnServConn *servconn); | |
| 85 | ||
| 86 | gboolean msn_servconn_connect(MsnServConn *servconn); | |
| 87 | void msn_servconn_disconnect(MsnServConn *servconn); | |
| 88 | ||
| 89 | void msn_servconn_set_server(MsnServConn *servconn, const char *server, | |
| 90 | int port); | |
| 91 | ||
| 92 | const char *msn_servconn_get_server(const MsnServConn *servconn); | |
| 93 | int msn_servconn_get_port(const MsnServConn *servconn); | |
| 94 | ||
| 95 | void msn_servconn_set_connect_cb(MsnServConn *servconn, | |
| 96 | gboolean (*connect_cb)(gpointer, gint, GaimInputCondition)); | |
| 97 | ||
| 98 | void msn_servconn_set_failed_read_cb(MsnServConn *servconn, | |
| 99 | void (*failed_read_cb)(gpointer, gint, GaimInputCondition)); | |
| 100 | ||
| 101 | size_t msn_servconn_write(MsnServConn *servconn, const char *buf, | |
| 102 | size_t size); | |
| 103 | ||
| 104 | gboolean msn_servconn_send_command(MsnServConn *servconn, const char *command, | |
| 105 | const char *params); | |
| 106 | ||
|
5506
b53a1acacefe
[gaim-migrate @ 5905]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
107 | void msn_servconn_queue_message(MsnServConn *servconn, const char *command, |
|
b53a1acacefe
[gaim-migrate @ 5905]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
108 | MsnMessage *msg); |
|
b53a1acacefe
[gaim-migrate @ 5905]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
109 | |
|
b53a1acacefe
[gaim-migrate @ 5905]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
110 | void msn_servconn_unqueue_message(MsnServConn *servconn, MsnMessage *msg); |
|
b53a1acacefe
[gaim-migrate @ 5905]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
111 | |
| 5309 | 112 | void msn_servconn_register_command(MsnServConn *servconn, |
| 113 | const char *command, | |
| 114 | MsnServConnCommandCb cb); | |
| 115 | ||
| 116 | void msn_servconn_register_msg_type(MsnServConn *servconn, | |
| 117 | const char *content_type, | |
| 118 | MsnServConnMsgCb cb); | |
| 119 | ||
| 120 | void msn_servconn_parse_data(gpointer data, gint source, | |
| 121 | GaimInputCondition cond); | |
| 122 | ||
| 123 | #endif /* _MSN_SERVCONN_H_ */ |