comparison src/protocols/msn/servconn.h @ 5309:e2e53316a21d

[gaim-migrate @ 5681] Announcing the new MSN prpl! It probably has some bugs, and for the time being, there is no file transfer. That's good though, because the current MSN file transfer is a little broken. I've had many corrupted files. I'll commit new file transfer code when it's written. I want this heavily tested before 0.63! If you use MSN, please talk to people on it. Let me know of any oddities, crashes, bugs, whatever. I'll fix things as I find them. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Tue, 06 May 2003 02:06:56 +0000
parents
children 4f72b611f0ee
comparison
equal deleted inserted replaced
5308:6aa785e55d0f 5309:e2e53316a21d
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
33 typedef gboolean (*MsnServConnMsgCb)(MsnServConn *servconn,
34 const MsnMessage *msg);
35
36 #include "session.h"
37
38 struct _MsnServConn
39 {
40 MsnSession *session;
41
42 gboolean connected;
43
44 char *server;
45 int port;
46
47 int fd;
48 int inpa;
49
50 char *rxqueue;
51 int rxlen;
52
53 GSList *txqueue;
54
55 gboolean parsing_msg;
56 char *msg_passport;
57 char *msg_friendly;
58 int msg_len;
59
60 GHashTable *commands;
61 GHashTable *msg_types;
62
63 gboolean (*connect_cb)(gpointer, gint, GaimInputCondition);
64 void (*failed_read_cb)(gpointer, gint, GaimInputCondition);
65 void (*login_cb)(gpointer, gint, GaimInputCondition);
66
67 void *data;
68 };
69
70 MsnServConn *msn_servconn_new(MsnSession *session);
71
72 void msn_servconn_destroy(MsnServConn *servconn);
73
74 gboolean msn_servconn_connect(MsnServConn *servconn);
75 void msn_servconn_disconnect(MsnServConn *servconn);
76
77 void msn_servconn_set_server(MsnServConn *servconn, const char *server,
78 int port);
79
80 const char *msn_servconn_get_server(const MsnServConn *servconn);
81 int msn_servconn_get_port(const MsnServConn *servconn);
82
83 void msn_servconn_set_connect_cb(MsnServConn *servconn,
84 gboolean (*connect_cb)(gpointer, gint, GaimInputCondition));
85
86 void msn_servconn_set_failed_read_cb(MsnServConn *servconn,
87 void (*failed_read_cb)(gpointer, gint, GaimInputCondition));
88
89 size_t msn_servconn_write(MsnServConn *servconn, const char *buf,
90 size_t size);
91
92 gboolean msn_servconn_send_command(MsnServConn *servconn, const char *command,
93 const char *params);
94
95 void msn_servconn_register_command(MsnServConn *servconn,
96 const char *command,
97 MsnServConnCommandCb cb);
98
99 void msn_servconn_register_msg_type(MsnServConn *servconn,
100 const char *content_type,
101 MsnServConnMsgCb cb);
102
103 void msn_servconn_parse_data(gpointer data, gint source,
104 GaimInputCondition cond);
105
106 #endif /* _MSN_SERVCONN_H_ */