annotate plugins/yay/outgoing.c @ 2042:d5033540df18

[gaim-migrate @ 2052] i finally made up my mind about this. if you're specifying --login then it shouldn't reorder them, because you might not want them to be in a different order. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Sat, 16 Jun 2001 19:53:23 +0000
parents ac9dd6b00b34
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1546
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1 /*
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2 * libyay
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3 *
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4 * Copyright (C) 2001 Eric Warmenhoven <warmenhoven@yahoo.com>
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
5 *
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
6 * This program is free software; you can redistribute it and/or modify
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
7 * it under the terms of the GNU General Public License as published by
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
8 * the Free Software Foundation; either version 2 of the License, or
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
9 * (at your option) any later version.
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
10 *
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
11 * This program is distributed in the hope that it will be useful,
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
14 * GNU General Public License for more details.
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
15 *
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
16 * You should have received a copy of the GNU General Public License
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
17 * along with this program; if not, write to the Free Software
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
19 *
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
20 */
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
21
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
22 #include "internal.h"
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
23 #include <string.h>
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
24
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
25 int yahoo_write(struct yahoo_session *session, struct yahoo_conn *conn, void *buf, int len)
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
26 {
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
27 if (!session || !conn)
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
28 return 0;
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
29
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
30 if (!g_list_find(session->connlist, conn))
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
31 return 0;
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
32
1554
c3afde736a8a [gaim-migrate @ 1564]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1546
diff changeset
33 if (send(conn->socket, buf, len, 0) != len) {
1546
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
34 int type = conn->type;
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
35 yahoo_close(session, conn);
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
36 YAHOO_PRINT(session, YAHOO_LOG_CRITICAL, "error sending");
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
37 if (type == YAHOO_CONN_TYPE_DUMB)
1570
4a47a459cc98 [gaim-migrate @ 1580]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1554
diff changeset
38 if (session->callbacks[YAHOO_HANDLE_DISCONNECT].function)
4a47a459cc98 [gaim-migrate @ 1580]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1554
diff changeset
39 (*session->callbacks[YAHOO_HANDLE_DISCONNECT].function)(session);
1546
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
40 return 0;
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
41 }
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
42
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
43 return len;
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
44 }
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
45
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
46 int yahoo_write_cmd(struct yahoo_session *session, struct yahoo_conn *conn,
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
47 int service, const char *active_id, void *buf, guint msgtype)
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
48 {
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
49 struct yahoo_packet *pkt;
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
50 int ret;
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
51
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
52 if (!session || !conn)
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
53 return 0;
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
54
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
55 if (!(pkt = g_new0(struct yahoo_packet, 1)))
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
56 return 0;
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
57
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
58 strcpy(pkt->version, "YPNS2.0");
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
59 yahoo_storeint(pkt->len, sizeof(struct yahoo_packet));
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
60 yahoo_storeint(pkt->service, service);
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
61
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
62 yahoo_storeint(pkt->magic_id, conn->magic_id);
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
63 yahoo_storeint(pkt->msgtype, msgtype);
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
64
1884
f7114b4d1f96 [gaim-migrate @ 1894]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1845
diff changeset
65 strcpy(pkt->nick1, session->login);
1546
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
66 strcpy(pkt->nick2, active_id);
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
67
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
68 strncpy(pkt->content, buf, 1024);
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
69
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
70 ret = yahoo_write(session, conn, pkt, sizeof(struct yahoo_packet));
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
71 g_free(pkt);
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
72 return ret;
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
73 }
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
74
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
75 int yahoo_activate_id(struct yahoo_session *session, char *id)
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
76 {
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
77 struct yahoo_conn *conn;
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
78
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
79 if (!session || !id)
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
80 return 0;
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
81
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
82 if (!(conn = yahoo_getconn_type(session, YAHOO_CONN_TYPE_MAIN)))
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
83 return 0;
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
84
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
85 return yahoo_write_cmd(session, conn, YAHOO_SERVICE_IDACT, id, id, 0);
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
86 }
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
87
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
88 int yahoo_deactivate_id(struct yahoo_session *session, char *id)
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
89 {
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
90 struct yahoo_conn *conn;
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
91
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
92 if (!session || !id)
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
93 return 0;
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
94
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
95 if (!(conn = yahoo_getconn_type(session, YAHOO_CONN_TYPE_MAIN)))
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
96 return 0;
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
97
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
98 return yahoo_write_cmd(session, conn, YAHOO_SERVICE_IDDEACT, id, id, 0);
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
99 }
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
100
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
101 int yahoo_send_message(struct yahoo_session *session, const char *active_id,
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
102 const char *user, const char *msg)
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
103 {
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
104 struct yahoo_conn *conn;
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
105 char *buf;
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
106 int ret;
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
107
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
108 if (!session || !user || !msg)
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
109 return 0;
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
110
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
111 if (!(conn = yahoo_getconn_type(session, YAHOO_CONN_TYPE_MAIN)))
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
112 return 0;
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
113
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
114 if (!(buf = g_strconcat(user, ",", msg, NULL)))
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
115 return 0;
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
116
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
117 ret = yahoo_write_cmd(session, conn, YAHOO_SERVICE_MESSAGE,
2009
ac9dd6b00b34 [gaim-migrate @ 2019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1884
diff changeset
118 active_id ? active_id : session->name, buf, 0);
ac9dd6b00b34 [gaim-migrate @ 2019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1884
diff changeset
119 g_free(buf);
ac9dd6b00b34 [gaim-migrate @ 2019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1884
diff changeset
120
ac9dd6b00b34 [gaim-migrate @ 2019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1884
diff changeset
121 return ret;
ac9dd6b00b34 [gaim-migrate @ 2019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1884
diff changeset
122 }
ac9dd6b00b34 [gaim-migrate @ 2019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1884
diff changeset
123
ac9dd6b00b34 [gaim-migrate @ 2019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1884
diff changeset
124 int yahoo_send_message_offline(struct yahoo_session *session, const char *active_id,
ac9dd6b00b34 [gaim-migrate @ 2019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1884
diff changeset
125 const char *user, const char *msg)
ac9dd6b00b34 [gaim-migrate @ 2019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1884
diff changeset
126 {
ac9dd6b00b34 [gaim-migrate @ 2019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1884
diff changeset
127 struct yahoo_conn *conn;
ac9dd6b00b34 [gaim-migrate @ 2019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1884
diff changeset
128 char *buf;
ac9dd6b00b34 [gaim-migrate @ 2019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1884
diff changeset
129 int ret;
ac9dd6b00b34 [gaim-migrate @ 2019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1884
diff changeset
130
ac9dd6b00b34 [gaim-migrate @ 2019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1884
diff changeset
131 if (!session || !user || !msg)
ac9dd6b00b34 [gaim-migrate @ 2019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1884
diff changeset
132 return 0;
ac9dd6b00b34 [gaim-migrate @ 2019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1884
diff changeset
133
ac9dd6b00b34 [gaim-migrate @ 2019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1884
diff changeset
134 if (!(conn = yahoo_getconn_type(session, YAHOO_CONN_TYPE_MAIN)))
ac9dd6b00b34 [gaim-migrate @ 2019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1884
diff changeset
135 return 0;
ac9dd6b00b34 [gaim-migrate @ 2019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1884
diff changeset
136
ac9dd6b00b34 [gaim-migrate @ 2019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1884
diff changeset
137 if (!(buf = g_strconcat(user, ",", msg, NULL)))
ac9dd6b00b34 [gaim-migrate @ 2019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1884
diff changeset
138 return 0;
ac9dd6b00b34 [gaim-migrate @ 2019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1884
diff changeset
139
ac9dd6b00b34 [gaim-migrate @ 2019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1884
diff changeset
140 ret = yahoo_write_cmd(session, conn, YAHOO_SERVICE_MESSAGE,
1845
e739d3dddf4c [gaim-migrate @ 1855]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1570
diff changeset
141 active_id ? active_id : session->name, buf, YAHOO_MESSAGE_SEND);
1546
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
142 g_free(buf);
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
143
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
144 return ret;
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
145 }
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
146
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
147 int yahoo_logoff(struct yahoo_session *session)
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
148 {
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
149 struct yahoo_conn *conn;
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
150
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
151 if (!session)
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
152 return 0;
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
153
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
154 if (!(conn = yahoo_getconn_type(session, YAHOO_CONN_TYPE_MAIN)))
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
155 return 0;
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
156
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
157 return yahoo_write_cmd(session, conn, YAHOO_SERVICE_LOGOFF, session->name, session->name, 0);
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
158 }
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
159
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
160 int yahoo_ping(struct yahoo_session *session)
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
161 {
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
162 struct yahoo_conn *conn;
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
163
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
164 if (!session)
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
165 return 0;
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
166
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
167 if (!(conn = yahoo_getconn_type(session, YAHOO_CONN_TYPE_MAIN)))
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
168 return 0;
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
169
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
170 return yahoo_write_cmd(session, conn, YAHOO_SERVICE_PING, session->name, "", 0);
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
171 }
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
172
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
173 int yahoo_away(struct yahoo_session *session, enum yahoo_status status, char *msg)
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
174 {
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
175 struct yahoo_conn *conn;
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
176 char buf[1024];
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
177
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
178 if (!session)
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
179 return 0;
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
180
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
181 if (!(conn = yahoo_getconn_type(session, YAHOO_CONN_TYPE_MAIN)))
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
182 return 0;
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
183
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
184 g_snprintf(buf, sizeof(buf), "%d%c%s", status, 1, msg ? msg : "---");
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
185
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
186 return yahoo_write_cmd(session, conn, YAHOO_SERVICE_ISAWAY, session->name, buf, 0);
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
187 }
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
188
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
189 int yahoo_back(struct yahoo_session *session, enum yahoo_status status, char *msg)
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
190 {
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
191 struct yahoo_conn *conn;
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
192 char buf[1024];
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
193
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
194 if (!session)
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
195 return 0;
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
196
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
197 if (!(conn = yahoo_getconn_type(session, YAHOO_CONN_TYPE_MAIN)))
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
198 return 0;
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
199
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
200 g_snprintf(buf, sizeof(buf), "%d%c%s", status, 1, msg ? msg : "---");
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
201
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
202 return yahoo_write_cmd(session, conn, YAHOO_SERVICE_ISBACK, session->name, buf, 0);
92b3dd1e4129 [gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
203 }