Mercurial > pidgin
annotate plugins/yay/yay.h @ 1999:591ebfe8ec00
[gaim-migrate @ 2009]
can be in two rooms of the same name
committer: Tailor Script <tailor@pidgin.im>
| author | Eric Warmenhoven <eric@warmenhoven.org> |
|---|---|
| date | Tue, 12 Jun 2001 07:57:27 +0000 |
| parents | 6497ee3751cf |
| children | ac9dd6b00b34 |
| rev | line source |
|---|---|
| 1546 | 1 /* |
| 2 * libyay | |
| 3 * | |
| 4 * Copyright (C) 2001 Eric Warmenhoven <warmenhoven@yahoo.com> | |
| 5 * | |
| 6 * This program is free software; you can redistribute it and/or modify | |
| 7 * it under the terms of the GNU General Public License as published by | |
| 8 * the Free Software Foundation; either version 2 of the License, or | |
| 9 * (at your option) any later version. | |
| 10 * | |
| 11 * This program is distributed in the hope that it will be useful, | |
| 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 14 * GNU General Public License for more details. | |
| 15 * | |
| 16 * You should have received a copy of the GNU General Public License | |
| 17 * along with this program; if not, write to the Free Software | |
| 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 19 * | |
| 20 */ | |
| 21 | |
| 22 #ifndef _LIBYAY_H | |
| 23 #define _LIBYAY_H | |
| 24 | |
| 25 #include <glib.h> | |
| 26 #include <unistd.h> | |
| 27 #include <errno.h> | |
| 28 #include <stdarg.h> | |
| 29 #include <sys/types.h> | |
| 30 #include <fcntl.h> | |
| 31 #include <netdb.h> | |
| 32 #include <sys/socket.h> | |
| 33 #include <netinet/in.h> | |
| 34 | |
| 35 struct yahoo_session; | |
| 36 | |
|
1565
2c66d386be90
[gaim-migrate @ 1575]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1563
diff
changeset
|
37 #define YAHOO_PROXY_NONE 0 |
|
2c66d386be90
[gaim-migrate @ 1575]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1563
diff
changeset
|
38 #define YAHOO_PROXY_HTTP 1 |
|
2c66d386be90
[gaim-migrate @ 1575]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1563
diff
changeset
|
39 |
| 1546 | 40 #define YAHOO_AUTH_HOST "msg.edit.yahoo.com" |
| 41 #define YAHOO_AUTH_PORT 80 | |
| 42 #define YAHOO_PAGER_HOST "cs.yahoo.com" | |
| 43 #define YAHOO_PAGER_PORT 5050 | |
| 44 #define YAHOO_DATA_HOST YAHOO_AUTH_HOST | |
| 45 #define YAHOO_DATA_PORT YAHOO_AUTH_PORT | |
| 46 | |
| 47 enum yahoo_status { | |
| 48 YAHOO_STATUS_AVAILABLE, | |
| 49 YAHOO_STATUS_BRB, | |
| 50 YAHOO_STATUS_BUSY, | |
| 51 YAHOO_STATUS_NOTATHOME, | |
| 52 YAHOO_STATUS_NOTATDESK, | |
| 53 YAHOO_STATUS_NOTINOFFICE, | |
| 54 YAHOO_STATUS_ONPHONE, | |
| 55 YAHOO_STATUS_ONVACATION, | |
| 56 YAHOO_STATUS_OUTTOLUNCH, | |
| 57 YAHOO_STATUS_STEPPEDOUT, | |
| 58 YAHOO_STATUS_INVISIBLE = 12, | |
| 59 YAHOO_STATUS_CUSTOM = 99, | |
| 60 YAHOO_STATUS_IDLE = 999 | |
| 61 }; | |
| 62 | |
| 63 struct yahoo_session *yahoo_new(); | |
|
1565
2c66d386be90
[gaim-migrate @ 1575]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1563
diff
changeset
|
64 void yahoo_set_proxy(struct yahoo_session *session, int proxy_type, char *proxy_host, int proxy_port); |
| 1546 | 65 int yahoo_connect(struct yahoo_session *session, const char *host, int port); |
| 66 int yahoo_send_login(struct yahoo_session *session, const char *name, const char *password); | |
| 67 int yahoo_major_connect(struct yahoo_session *session, const char *host, int port); | |
| 68 int yahoo_finish_logon(struct yahoo_session *session, enum yahoo_status status); | |
| 69 int yahoo_logoff(struct yahoo_session *session); | |
| 70 int yahoo_disconnect(struct yahoo_session *session); | |
| 71 int yahoo_delete(struct yahoo_session *session); | |
| 72 | |
| 73 int yahoo_activate_id(struct yahoo_session *session, char *id); | |
| 74 int yahoo_deactivate_id(struct yahoo_session *session, char *id); | |
| 75 int yahoo_send_message(struct yahoo_session *session, const char *id, const char *user, const char *msg); | |
| 76 int yahoo_away(struct yahoo_session *session, enum yahoo_status stats, char *msg); | |
| 77 int yahoo_back(struct yahoo_session *session, enum yahoo_status stats, char *msg); | |
| 78 int yahoo_ping(struct yahoo_session *session); | |
| 79 | |
| 80 int yahoo_add_buddy(struct yahoo_session *session, const char *active_id, | |
| 81 const char *group, const char *buddy, const char *message); | |
| 82 int yahoo_remove_buddy(struct yahoo_session *session, const char *active_id, | |
| 83 const char *group, const char *buddy, const char *message); | |
| 84 | |
| 85 extern void (*yahoo_socket_notify)(struct yahoo_session *session, int socket, int type, gboolean status); | |
| 86 #define YAHOO_SOCKET_READ 1 | |
| 87 #define YAHOO_SOCKET_WRITE 2 | |
| 88 void yahoo_socket_handler(struct yahoo_session *session, int socket, int type); | |
| 89 | |
| 90 extern void (*yahoo_print)(struct yahoo_session *session, int level, const char *log); | |
| 91 #define YAHOO_LOG_DEBUG 4 | |
| 92 #define YAHOO_LOG_NOTICE 3 | |
| 93 #define YAHOO_LOG_WARNING 2 | |
| 94 #define YAHOO_LOG_ERROR 1 | |
| 95 #define YAHOO_LOG_CRITICAL 0 | |
| 96 | |
|
1879
6497ee3751cf
[gaim-migrate @ 1889]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1565
diff
changeset
|
97 extern int (*yahoo_connector)(struct yahoo_session *session, const char *host, int port, gpointer data); |
|
6497ee3751cf
[gaim-migrate @ 1889]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1565
diff
changeset
|
98 int yahoo_connected(struct yahoo_session *session, gpointer data, int fd); |
|
6497ee3751cf
[gaim-migrate @ 1889]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1565
diff
changeset
|
99 |
| 1546 | 100 typedef int (*yahoo_callback)(struct yahoo_session *session, ...); |
| 101 void yahoo_add_handler(struct yahoo_session *session, int type, yahoo_callback function); | |
| 102 #define YAHOO_HANDLE_DISCONNECT 0 | |
| 103 #define YAHOO_HANDLE_AUTHCONNECT 1 | |
| 104 #define YAHOO_HANDLE_BADPASSWORD 2 | |
| 105 #define YAHOO_HANDLE_LOGINCOOKIE 3 | |
| 106 #define YAHOO_HANDLE_MAINCONNECT 4 | |
| 107 #define YAHOO_HANDLE_ONLINE 5 | |
| 108 #define YAHOO_HANDLE_NEWMAIL 6 | |
| 109 #define YAHOO_HANDLE_MESSAGE 7 | |
|
1562
12f16a852540
[gaim-migrate @ 1572]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1546
diff
changeset
|
110 #define YAHOO_HANDLE_BOUNCE 8 |
|
12f16a852540
[gaim-migrate @ 1572]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1546
diff
changeset
|
111 #define YAHOO_HANDLE_STATUS 9 |
|
12f16a852540
[gaim-migrate @ 1572]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1546
diff
changeset
|
112 #define YAHOO_HANDLE_ACTIVATE 10 |
|
1563
393b23c8f494
[gaim-migrate @ 1573]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1562
diff
changeset
|
113 #define YAHOO_HANDLE_BUDDYADDED 11 |
|
393b23c8f494
[gaim-migrate @ 1573]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1562
diff
changeset
|
114 #define YAHOO_HANDLE_MAX 12 |
| 1546 | 115 |
| 116 struct callback { | |
| 117 yahoo_callback function; | |
| 118 void *data; | |
| 119 }; | |
| 120 | |
| 121 struct yahoo_group { | |
| 122 char *name; | |
| 123 char **buddies; | |
| 124 }; | |
| 125 | |
| 126 struct yahoo_session { | |
| 127 void *user_data; | |
| 128 struct callback callbacks[YAHOO_HANDLE_MAX]; | |
| 129 | |
|
1565
2c66d386be90
[gaim-migrate @ 1575]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1563
diff
changeset
|
130 int proxy_type; |
|
2c66d386be90
[gaim-migrate @ 1575]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1563
diff
changeset
|
131 char *proxy_host; |
|
2c66d386be90
[gaim-migrate @ 1575]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1563
diff
changeset
|
132 int proxy_port; |
|
2c66d386be90
[gaim-migrate @ 1575]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1563
diff
changeset
|
133 |
| 1546 | 134 char *name; |
| 135 | |
| 136 char *cookie; | |
| 137 char *login_cookie; | |
| 138 GList *connlist; | |
| 139 | |
| 140 GList *groups; | |
| 141 GList *ignored; | |
| 142 | |
| 143 char **identities; | |
| 144 int mail; | |
| 145 char *login; | |
| 146 }; | |
| 147 | |
| 148 #endif |
