source: protocols/yahoo/yahoo2.h @ ac83732

Last change on this file since ac83732 was b7d3cc34, checked in by Wilmer van der Gaast <wilmer@…>, at 2005-11-06T18:23:18Z

Initial repository (0.99 release tree)

  • Property mode set to 100644
File size: 8.8 KB
Line 
1/*
2 * libyahoo2: yahoo2.h
3 *
4 * Copyright (C) 2002-2004, Philip S Tellis <philip.tellis AT gmx.net>
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 YAHOO2_H
23#define YAHOO2_H
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
29/* *** BitlBee: *** */
30#include "bitlbee.h"
31#undef free
32#define free( x )               g_free( x )
33#undef malloc
34#define malloc( x )             g_malloc( x )
35#undef calloc
36#define calloc( x, y )          g_calloc( x, y )
37#undef realloc
38#define realloc( x, y )         g_realloc( x, y )
39#undef strdup
40#define strdup( x )             g_strdup( x )
41#undef strndup
42#define strndup( x,y )          g_strndup( x,y )
43#undef snprintf
44// #define snprintf( x... )     g_snprintf( x )
45#undef strcasecmp
46#define strcasecmp( x,y )       g_strcasecmp( x,y )
47#undef strncasecmp
48#define strncasecmp( x,y,z )    g_strncasecmp( x,y,z )
49
50
51#include "yahoo2_types.h"
52
53/* returns the socket descriptor for a given pager connection. shouldn't be needed */
54int  yahoo_get_fd(int id);
55
56/* says how much logging to do */
57/* see yahoo2_types.h for the different values */
58int  yahoo_set_log_level(enum yahoo_log_level level);
59enum yahoo_log_level  yahoo_get_log_level( void );
60
61/* these functions should be self explanatory */
62/* who always means the buddy you're acting on */
63/* id is the successful value returned by yahoo_init */
64
65
66/* init returns a connection id used to identify the connection hereon */
67/* or 0 on failure */
68/* you must call init before calling any other function */
69/*
70 * The optional parameters to init are key/value pairs that specify
71 * server settings to use.  This list must be NULL terminated - even
72 * if the list is empty.  If a parameter isn't set, a default value
73 * will be used.  Parameter keys are strings, parameter values are
74 * either strings or ints, depending on the key.  Values passed in
75 * are copied, so you can use const/auto/static/pointers/whatever
76 * you want.  Parameters are:
77 *      NAME                    TYPE            DEFAULT
78 *      pager_host              char *          scs.msg.yahoo.com
79 *      pager_port              int             5050
80 *      filetransfer_host       char *          filetransfer.msg.yahoo.com
81 *      filetransfer_port       int             80
82 *      webcam_host             char *          webcam.yahoo.com
83 *      webcam_port             int             5100
84 *      webcam_description      char *          ""
85 *      local_host              char *          ""
86 *      conn_type               int             Y_WCM_DSL
87 *
88 * You should set at least local_host if you intend to use webcams
89 */
90int  yahoo_init_with_attributes(const char *username, const char *password, ...);
91
92/* yahoo_init does the same as yahoo_init_with_attributes, assuming defaults
93 * for all attributes */
94int  yahoo_init(const char *username, const char *password);
95
96
97
98/* release all resources held by this session */
99/* you need to call yahoo_close for a session only if
100 * yahoo_logoff is never called for it (ie, it was never logged in) */
101void yahoo_close(int id);
102/* login logs in to the server */
103/* initial is of type enum yahoo_status.  see yahoo2_types.h */
104void yahoo_login(int id, int initial);
105void yahoo_logoff(int id);
106/* reloads status of all buddies */
107void yahoo_refresh(int id);
108/* activates/deactivates an identity */
109void yahoo_set_identity_status(int id, const char * identity, int active);
110/* regets the entire buddy list from the server */
111void yahoo_get_list(int id);
112/* download buddy contact information from your yahoo addressbook */
113void yahoo_get_yab(int id);
114/* add/modify an address book entry.  if yab->dbid is set, it will */
115/* modify that entry else it creates a new entry */
116void yahoo_set_yab(int id, struct yab * yab);
117void yahoo_keepalive(int id);
118void yahoo_chat_keepalive(int id);
119
120/* from is the identity you're sending from.  if NULL, the default is used */
121/* utf8 is whether msg is a utf8 string or not. */
122void yahoo_send_im(int id, const char *from, const char *who, const char *msg, int utf8);
123/* if type is true, send typing notice, else send stopped typing notice */
124void yahoo_send_typing(int id, const char *from, const char *who, int typ);
125
126/* used to set away/back status. */
127/* away says whether the custom message is an away message or a sig */
128void yahoo_set_away(int id, enum yahoo_status state, const char *msg, int away);
129
130void yahoo_add_buddy(int id, const char *who, const char *group);
131void yahoo_remove_buddy(int id, const char *who, const char *group);
132void yahoo_reject_buddy(int id, const char *who, const char *msg);
133/* if unignore is true, unignore, else ignore */
134void yahoo_ignore_buddy(int id, const char *who, int unignore);
135void yahoo_change_buddy_group(int id, const char *who, const char *old_group, const char *new_group);
136void yahoo_group_rename(int id, const char *old_group, const char *new_group);
137
138void yahoo_conference_invite(int id, const char * from, YList *who, const char *room, const char *msg);
139void yahoo_conference_addinvite(int id, const char * from, const char *who, const char *room, const YList * members, const char *msg);
140void yahoo_conference_decline(int id, const char * from, YList *who, const char *room, const char *msg);
141void yahoo_conference_message(int id, const char * from, YList *who, const char *room, const char *msg, int utf8);
142void yahoo_conference_logon(int id, const char * from, YList *who, const char *room);
143void yahoo_conference_logoff(int id, const char * from, YList *who, const char *room);
144
145/* Get a list of chatrooms */
146void yahoo_get_chatrooms(int id,int chatroomid);
147/* join room with specified roomname and roomid */
148void yahoo_chat_logon(int id, const char *from, const char *room, const char *roomid);
149/* Send message "msg" to room with specified roomname, msgtype is 1-normal message or 2-/me mesage */
150void yahoo_chat_message(int id, const char *from, const char *room, const char *msg, const int msgtype, const int utf8);
151/* Log off chat */
152void yahoo_chat_logoff(int id, const char *from);
153
154/* requests a webcam feed */
155/* who is the person who's webcam you would like to view */
156/* if who is null, then you're the broadcaster */
157void yahoo_webcam_get_feed(int id, const char *who);
158void yahoo_webcam_close_feed(int id, const char *who);
159
160/* sends an image when uploading */
161/* image points to a JPEG-2000 image, length is the length of the image */
162/* in bytes. The timestamp is the time in milliseconds since we started the */
163/* webcam. */
164void yahoo_webcam_send_image(int id, unsigned char *image, unsigned int length, unsigned int timestamp);
165
166/* this function should be called if we want to allow a user to watch the */
167/* webcam. Who is the user we want to accept. */
168/* Accept user (accept = 1), decline user (accept = 0) */
169void yahoo_webcam_accept_viewer(int id, const char* who, int accept);
170
171/* send an invitation to a user to view your webcam */
172void yahoo_webcam_invite(int id, const char *who);
173
174/* will set up a connection and initiate file transfer.
175 * callback will be called with the fd that you should write
176 * the file data to
177 */
178void yahoo_send_file(int id, const char *who, const char *msg, const char *name, unsigned long size,
179                yahoo_get_fd_callback callback, void *data);
180
181/* send a search request
182 */
183void yahoo_search(int id, enum yahoo_search_type t, const char *text, enum yahoo_search_gender g, enum yahoo_search_agerange ar,
184                int photo, int yahoo_only);
185
186/* continue last search
187 * should be called if only (start+found >= total)
188 *
189 * where the above three are passed to ext_yahoo_got_search_result
190 */
191void yahoo_search_again(int id, int start);
192
193/* returns a socket fd to a url for downloading a file. */
194void yahoo_get_url_handle(int id, const char *url, 
195                yahoo_get_url_handle_callback callback, void *data);
196
197/* these should be called when input is available on a fd */
198/* registered by ext_yahoo_add_handler */
199/* if these return negative values, errno may be set */
200int  yahoo_read_ready(int id, int fd, void *data);
201int  yahoo_write_ready(int id, int fd, void *data);
202
203/* utility functions. these do not hit the server */
204enum yahoo_status yahoo_current_status(int id);
205const YList * yahoo_get_buddylist(int id);
206const YList * yahoo_get_ignorelist(int id);
207const YList * yahoo_get_identities(int id);
208/* 'which' could be y, t, c or login.  This may change in later versions. */
209const char  * yahoo_get_cookie(int id, const char *which);
210
211/* returns the url used to get user profiles - you must append the user id */
212/* as of now this is http://profiles.yahoo.com/ */
213/* You'll have to do urlencoding yourself, but see yahoo_httplib.h first */
214const char  * yahoo_get_profile_url( void );
215
216#include "yahoo_httplib.h"
217
218#ifdef __cplusplus
219}
220#endif
221
222#endif
Note: See TracBrowser for help on using the repository browser.