source: protocols/yahoo/yahoo2.h @ c377417

Last change on this file since c377417 was cfc8d58, checked in by Wilmer van der Gaast <wilmer@…>, at 2007-04-16T04:31:52Z

Updating the Yahoo! module. This seems to fix handling of incoming away
states/messages, should fix some issues with group chats, and unfortunately
also adds some crap which I don't want to clean up for now.

  • Property mode set to 100644
File size: 9.0 KB
2 * libyahoo2: yahoo2.h
3 *
4 * Copyright (C) 2002-2004, Philip S Tellis <philip.tellis AT>
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
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 */
22#ifndef YAHOO2_H
23#define YAHOO2_H
25#ifdef __cplusplus
26extern "C" {
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 )
51#include "yahoo2_types.h"
53/* returns the socket descriptor for a given pager connection. shouldn't be needed */
54int  yahoo_get_fd(int id);
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 );
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 */
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 */
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 *
79 *      pager_port              int             5050
80 *      filetransfer_host       char *
81 *      filetransfer_port       int             80
82 *      webcam_host             char *
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, ...);
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);
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);
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, int picture);
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);
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);
130void yahoo_add_buddy(int id, const char *who, const char *group, const char *msg);
131void yahoo_remove_buddy(int id, const char *who, const char *group);
132void yahoo_reject_buddy(int id, const char *who, const char *msg);
133void yahoo_stealth_buddy(int id, const char *who, int unstealth);
134/* if unignore is true, unignore, else ignore */
135void yahoo_ignore_buddy(int id, const char *who, int unignore);
136void yahoo_change_buddy_group(int id, const char *who, const char *old_group, const char *new_group);
137void yahoo_group_rename(int id, const char *old_group, const char *new_group);
139void yahoo_conference_invite(int id, const char * from, YList *who, const char *room, const char *msg);
140void yahoo_conference_addinvite(int id, const char * from, const char *who, const char *room, const YList * members, const char *msg);
141void yahoo_conference_decline(int id, const char * from, YList *who, const char *room, const char *msg);
142void yahoo_conference_message(int id, const char * from, YList *who, const char *room, const char *msg, int utf8);
143void yahoo_conference_logon(int id, const char * from, YList *who, const char *room);
144void yahoo_conference_logoff(int id, const char * from, YList *who, const char *room);
146/* Get a list of chatrooms */
147void yahoo_get_chatrooms(int id,int chatroomid);
148/* join room with specified roomname and roomid */
149void yahoo_chat_logon(int id, const char *from, const char *room, const char *roomid);
150/* Send message "msg" to room with specified roomname, msgtype is 1-normal message or 2-/me mesage */
151void yahoo_chat_message(int id, const char *from, const char *room, const char *msg, const int msgtype, const int utf8);
152/* Log off chat */
153void yahoo_chat_logoff(int id, const char *from);
155/* requests a webcam feed */
156/* who is the person who's webcam you would like to view */
157/* if who is null, then you're the broadcaster */
158void yahoo_webcam_get_feed(int id, const char *who);
159void yahoo_webcam_close_feed(int id, const char *who);
161/* sends an image when uploading */
162/* image points to a JPEG-2000 image, length is the length of the image */
163/* in bytes. The timestamp is the time in milliseconds since we started the */
164/* webcam. */
165void yahoo_webcam_send_image(int id, unsigned char *image, unsigned int length, unsigned int timestamp);
167/* this function should be called if we want to allow a user to watch the */
168/* webcam. Who is the user we want to accept. */
169/* Accept user (accept = 1), decline user (accept = 0) */
170void yahoo_webcam_accept_viewer(int id, const char* who, int accept);
172/* send an invitation to a user to view your webcam */
173void yahoo_webcam_invite(int id, const char *who);
175/* will set up a connection and initiate file transfer.
176 * callback will be called with the fd that you should write
177 * the file data to
178 */
179void yahoo_send_file(int id, const char *who, const char *msg, const char *name, unsigned long size,
180                yahoo_get_fd_callback callback, void *data);
182/* send a search request
183 */
184void yahoo_search(int id, enum yahoo_search_type t, const char *text, enum yahoo_search_gender g, enum yahoo_search_agerange ar,
185                int photo, int yahoo_only);
187/* continue last search
188 * should be called if only (start+found >= total)
189 *
190 * where the above three are passed to ext_yahoo_got_search_result
191 */
192void yahoo_search_again(int id, int start);
194/* returns a socket fd to a url for downloading a file. */
195void yahoo_get_url_handle(int id, const char *url, 
196                yahoo_get_url_handle_callback callback, void *data);
198/* these should be called when input is available on a fd */
199/* registered by ext_yahoo_add_handler */
200/* if these return negative values, errno may be set */
201int  yahoo_read_ready(int id, int fd, void *data);
202int  yahoo_write_ready(int id, int fd, void *data);
204/* utility functions. these do not hit the server */
205enum yahoo_status yahoo_current_status(int id);
206const YList * yahoo_get_buddylist(int id);
207const YList * yahoo_get_ignorelist(int id);
208const YList * yahoo_get_identities(int id);
209/* 'which' could be y, t, c or login.  This may change in later versions. */
210const char  * yahoo_get_cookie(int id, const char *which);
212/* returns the url used to get user profiles - you must append the user id */
213/* as of now this is */
214/* You'll have to do urlencoding yourself, but see yahoo_httplib.h first */
215const char  * yahoo_get_profile_url( void );
217void yahoo_buddyicon_request(int id, const char *who);
219#include "yahoo_httplib.h"
221#ifdef __cplusplus
Note: See TracBrowser for help on using the repository browser.