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