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