Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

conversation.h

Go to the documentation of this file.
00001 
00027 #ifndef _GAIM_CONVERSATION_H_
00028 #define _GAIM_CONVERSATION_H_
00029 
00030 /**************************************************************************/
00032 /**************************************************************************/
00033 
00034 typedef struct _GaimConvWindowUiOps   GaimConvWindowUiOps;
00035 typedef struct _GaimConvWindow        GaimConvWindow;
00036 typedef struct _GaimConversationUiOps GaimConversationUiOps;
00037 typedef struct _GaimConversation      GaimConversation;
00038 typedef struct _GaimConvIm            GaimConvIm;
00039 typedef struct _GaimConvChat          GaimConvChat;
00040 
00044 typedef enum
00045 {
00046     GAIM_CONV_UNKNOWN = 0, 
00047     GAIM_CONV_IM,          
00048     GAIM_CONV_CHAT,        
00049     GAIM_CONV_MISC         
00051 } GaimConversationType;
00052 
00056 typedef enum
00057 {
00058     GAIM_UNSEEN_NONE = 0,  
00059     GAIM_UNSEEN_TEXT,      
00060     GAIM_UNSEEN_NICK,      
00061     GAIM_UNSEEN_EVENT      
00063 } GaimUnseenState;
00064 
00068 typedef enum
00069 {
00070     GAIM_CONV_UPDATE_ADD = 0, 
00072     GAIM_CONV_UPDATE_REMOVE,  
00074     GAIM_CONV_UPDATE_ACCOUNT, 
00075     GAIM_CONV_UPDATE_TYPING,  
00076     GAIM_CONV_UPDATE_UNSEEN,  
00077     GAIM_CONV_UPDATE_LOGGING, 
00079     GAIM_CONV_UPDATE_TOPIC,   
00081     /*
00082      * XXX These need to go when we implement a more generic core/UI event
00083      * system.
00084      */
00085     GAIM_CONV_ACCOUNT_ONLINE,  
00086     GAIM_CONV_ACCOUNT_OFFLINE, 
00087     GAIM_CONV_UPDATE_AWAY,     
00088     GAIM_CONV_UPDATE_ICON,     
00089     GAIM_CONV_UPDATE_TITLE,
00090     GAIM_CONV_UPDATE_CHATLEFT
00091 
00092 } GaimConvUpdateType;
00093 
00097 typedef enum
00098 {
00099     GAIM_NOT_TYPING = 0,  
00100     GAIM_TYPING,          
00101     GAIM_TYPED            
00103 } GaimTypingState;
00104 
00108 typedef enum
00109 {
00110     GAIM_MESSAGE_SEND      = 0x0001, 
00111     GAIM_MESSAGE_RECV      = 0x0002, 
00112     GAIM_MESSAGE_SYSTEM    = 0x0004, 
00113     GAIM_MESSAGE_AUTO_RESP = 0x0008, 
00114     GAIM_MESSAGE_COLORIZE  = 0x0010, 
00115     GAIM_MESSAGE_NICK      = 0x0020, 
00116     GAIM_MESSAGE_NO_LOG    = 0x0040, 
00117     GAIM_MESSAGE_WHISPER   = 0x0080, 
00118     GAIM_MESSAGE_IMAGES    = 0x0100, 
00119     GAIM_MESSAGE_ERROR     = 0x0200  
00120 } GaimMessageFlags;
00121 
00122 #include "account.h"
00123 #include "log.h"
00124 #include "buddyicon.h"
00125 #include "server.h"
00126 
00133 struct _GaimConvWindowUiOps
00134 {
00135     GaimConversationUiOps *(*get_conversation_ui_ops)(void);
00136 
00137     void (*new_window)(GaimConvWindow *win);
00138     void (*destroy_window)(GaimConvWindow *win);
00139 
00140     void (*show)(GaimConvWindow *win);
00141     void (*hide)(GaimConvWindow *win);
00142     void (*raise)(GaimConvWindow *win);
00143     void (*flash)(GaimConvWindow *win);
00144 
00145     void (*switch_conversation)(GaimConvWindow *win, unsigned int index);
00146     void (*add_conversation)(GaimConvWindow *win, GaimConversation *conv);
00147     void (*remove_conversation)(GaimConvWindow *win, GaimConversation *conv);
00148     void (*move_conversation)(GaimConvWindow *win, GaimConversation *conv,
00149                               unsigned int newIndex);
00150     int (*get_active_index)(const GaimConvWindow *win);
00151 };
00152 
00159 struct _GaimConversationUiOps
00160 {
00161     void (*destroy_conversation)(GaimConversation *conv);
00162     void (*write_chat)(GaimConversation *conv, const char *who,
00163                        const char *message, GaimMessageFlags flags,
00164                        time_t mtime);
00165     void (*write_im)(GaimConversation *conv, const char *who,
00166                      const char *message, GaimMessageFlags flags,
00167                      time_t mtime);
00168     void (*write_conv)(GaimConversation *conv, const char *who,
00169                        const char *message, GaimMessageFlags flags,
00170                        time_t mtime);
00171 
00172     void (*chat_add_user)(GaimConversation *conv, const char *user);
00173     void (*chat_add_users)(GaimConversation *conv, GList *users);
00174     void (*chat_rename_user)(GaimConversation *conv,
00175                              const char *old_name, const char *new_name);
00176     void (*chat_remove_user)(GaimConversation *conv, const char *user);
00177     void (*chat_remove_users)(GaimConversation *conv, GList *users);
00178 
00179     void (*update_progress)(GaimConversation *conv, float percent);
00180 
00181     /* Events */
00182     void (*updated)(GaimConversation *conv, GaimConvUpdateType type);
00183 };
00184 
00189 struct _GaimConvWindow
00190 {
00191     GList *conversations;              
00192     size_t conversation_count;         
00194     GaimConvWindowUiOps *ui_ops;       
00195     void *ui_data;                     
00196 };
00197 
00201 struct _GaimConvIm
00202 {
00203     GaimConversation *conv;            
00205     GaimTypingState typing_state;      
00206     guint  typing_timeout;             
00207     time_t type_again;                 
00208     guint  type_again_timeout;         
00210     GSList *images;                    
00212     GaimBuddyIcon *icon;               
00213 };
00214 
00218 struct _GaimConvChat
00219 {
00220     GaimConversation *conv;          
00222     GList *in_room;                  
00223     GList *ignored;                  
00224     char  *who;                      
00225     char  *topic;                    
00226     int    id;                       
00227     char *nick;                      
00229     gboolean left;                   
00230 };
00231 
00238 struct _GaimConversation
00239 {
00240     GaimConversationType type;  
00242     GaimAccount *account;       
00243     GaimConvWindow *window;     
00245     int conversation_pos;       
00247     char *name;                 
00248     char *title;                
00250     gboolean logging;           
00252     GaimLog *log;               
00254     GList *send_history;        
00255     GString *history;           
00257     GaimUnseenState unseen;     
00259     union
00260     {
00261         GaimConvIm   *im;       
00262         GaimConvChat *chat;     
00263         void *misc;             
00265     } u;
00266 
00267     GaimConversationUiOps *ui_ops;           
00268     void *ui_data;                           
00270     GHashTable *data;                        
00271 };
00272 
00273 typedef void (*GaimConvPlacementFunc)(GaimConversation *);
00274 
00275 #ifdef __cplusplus
00276 extern "C" {
00277 #endif
00278 
00279 /**************************************************************************/
00281 /**************************************************************************/
00292 GaimConvWindow *gaim_conv_window_new(void);
00293 
00299 void gaim_conv_window_destroy(GaimConvWindow *win);
00300 
00306 void gaim_conv_window_show(GaimConvWindow *win);
00307 
00313 void gaim_conv_window_hide(GaimConvWindow *win);
00314 
00320 void gaim_conv_window_raise(GaimConvWindow *win);
00321 
00327 void gaim_conv_window_flash(GaimConvWindow *win);
00328 
00335 void gaim_conv_window_set_ui_ops(GaimConvWindow *win,
00336                                  GaimConvWindowUiOps *ops);
00337 
00345 GaimConvWindowUiOps *gaim_conv_window_get_ui_ops(const GaimConvWindow *win);
00346 
00357 int gaim_conv_window_add_conversation(GaimConvWindow *win,
00358                                       GaimConversation *conv);
00359 
00370 GaimConversation *gaim_conv_window_remove_conversation(GaimConvWindow *win,
00371                                                        unsigned int index);
00372 
00380 void gaim_conv_window_move_conversation(GaimConvWindow *win,
00381                                         unsigned int index,
00382                                         unsigned int new_index);
00383 
00394 GaimConversation *gaim_conv_window_get_conversation_at(
00395         const GaimConvWindow *win, unsigned int index);
00396 
00404 size_t gaim_conv_window_get_conversation_count(const GaimConvWindow *win);
00405 
00414 void gaim_conv_window_switch_conversation(GaimConvWindow *win,
00415                                           unsigned int index);
00416 
00424 GaimConversation *gaim_conv_window_get_active_conversation(
00425         const GaimConvWindow *win);
00426 
00434 GList *gaim_conv_window_get_conversations(const GaimConvWindow *win);
00435 
00441 GList *gaim_get_windows(void);
00442 
00450 GaimConvWindow *gaim_get_first_window_with_type(GaimConversationType type);
00451 
00459 GaimConvWindow *gaim_get_last_window_with_type(GaimConversationType type);
00460 
00463 /**************************************************************************/
00465 /**************************************************************************/
00478 GaimConversation *gaim_conversation_new(GaimConversationType type,
00479                                         GaimAccount *account,
00480                                         const char *name);
00481 
00491 void gaim_conversation_destroy(GaimConversation *conv);
00492 
00500 GaimConversationType gaim_conversation_get_type(const GaimConversation *conv);
00501 
00508 void gaim_conversation_set_ui_ops(GaimConversation *conv,
00509                                   GaimConversationUiOps *ops);
00510 
00518 GaimConversationUiOps *gaim_conversation_get_ui_ops(
00519         const GaimConversation *conv);
00520 
00530 void gaim_conversation_set_account(GaimConversation *conv,
00531                                    GaimAccount *account);
00532 
00543 GaimAccount *gaim_conversation_get_account(const GaimConversation *conv);
00544 
00554 GaimConnection *gaim_conversation_get_gc(const GaimConversation *conv);
00555 
00562 void gaim_conversation_set_title(GaimConversation *conv, const char *title);
00563 
00571 const char *gaim_conversation_get_title(const GaimConversation *conv);
00572 
00581 void gaim_conversation_autoset_title(GaimConversation *conv);
00582 
00590 int gaim_conversation_get_index(const GaimConversation *conv);
00591 
00598 void gaim_conversation_set_unseen(GaimConversation *conv,
00599                                   GaimUnseenState state);
00600 
00608 GaimUnseenState gaim_conversation_get_unseen(const GaimConversation *conv);
00609 
00616 void gaim_conversation_set_name(GaimConversation *conv, const char *name);
00617 
00625 const char *gaim_conversation_get_name(const GaimConversation *conv);
00626 
00633 void gaim_conversation_set_logging(GaimConversation *conv, gboolean log);
00634 
00642 gboolean gaim_conversation_is_logging(const GaimConversation *conv);
00643 
00651 GList *gaim_conversation_get_send_history(const GaimConversation *conv);
00652 
00659 void gaim_conversation_set_history(GaimConversation *conv, GString *history);
00660 
00668 GString *gaim_conversation_get_history(const GaimConversation *conv);
00669 
00677 GaimConvWindow *gaim_conversation_get_window(const GaimConversation *conv);
00678 
00688 GaimConvIm *gaim_conversation_get_im_data(const GaimConversation *conv);
00689 
00690 #define GAIM_CONV_IM(c) (gaim_conversation_get_im_data(c))
00691 
00701 GaimConvChat *gaim_conversation_get_chat_data(const GaimConversation *conv);
00702 
00703 #define GAIM_CONV_CHAT(c) (gaim_conversation_get_chat_data(c))
00704 
00712 void gaim_conversation_set_data(GaimConversation *conv, const char *key,
00713                                 gpointer data);
00714 
00723 gpointer gaim_conversation_get_data(GaimConversation *conv, const char *key);
00724 
00732 GList *gaim_get_conversations(void);
00733 
00739 GList *gaim_get_ims(void);
00740 
00746 GList *gaim_get_chats(void);
00747 
00755 GaimConversation *gaim_find_conversation(const char *name);
00756 
00765 GaimConversation *gaim_find_conversation_with_account(
00766         const char *name, const GaimAccount *account);
00767 
00788 void gaim_conversation_write(GaimConversation *conv, const char *who,
00789                              const char *message, GaimMessageFlags flags,
00790                              time_t mtime);
00791 
00801 void gaim_conversation_update_progress(GaimConversation *conv, float percent);
00802 
00809 void gaim_conversation_update(GaimConversation *conv, GaimConvUpdateType type);
00810 
00816 void gaim_conversation_foreach(void (*func)(GaimConversation *conv));
00817 
00821 /**************************************************************************/
00823 /**************************************************************************/
00833 GaimConversation *gaim_conv_im_get_conversation(const GaimConvIm *im);
00834 
00846 void gaim_conv_im_set_icon(GaimConvIm *im, GaimBuddyIcon *icon);
00847 
00855 GaimBuddyIcon *gaim_conv_im_get_icon(const GaimConvIm *im);
00856 
00863 void gaim_conv_im_set_typing_state(GaimConvIm *im, GaimTypingState state);
00864 
00872 GaimTypingState gaim_conv_im_get_typing_state(const GaimConvIm *im);
00873 
00880 void gaim_conv_im_start_typing_timeout(GaimConvIm *im, int timeout);
00881 
00887 void gaim_conv_im_stop_typing_timeout(GaimConvIm *im);
00888 
00896 guint gaim_conv_im_get_typing_timeout(const GaimConvIm *im);
00897 
00904 void gaim_conv_im_set_type_again(GaimConvIm *im, time_t val);
00905 
00913 time_t gaim_conv_im_get_type_again(const GaimConvIm *im);
00914 
00920 void gaim_conv_im_start_type_again_timeout(GaimConvIm *im);
00921 
00927 void gaim_conv_im_stop_type_again_timeout(GaimConvIm *im);
00928 
00936 guint gaim_conv_im_get_type_again_timeout(const GaimConvIm *im);
00937 
00943 void gaim_conv_im_update_typing(GaimConvIm *im);
00944 
00954 void gaim_conv_im_write(GaimConvIm *im, const char *who,
00955                         const char *message, GaimMessageFlags flags,
00956                         time_t mtime);
00957 
00964 void gaim_conv_im_send(GaimConvIm *im, const char *message);
00965 
00969 /**************************************************************************/
00971 /**************************************************************************/
00981 GaimConversation *gaim_conv_chat_get_conversation(const GaimConvChat *chat);
00982 
00995 GList *gaim_conv_chat_set_users(GaimConvChat *chat, GList *users);
00996 
01004 GList *gaim_conv_chat_get_users(const GaimConvChat *chat);
01005 
01012 void gaim_conv_chat_ignore(GaimConvChat *chat, const char *name);
01013 
01020 void gaim_conv_chat_unignore(GaimConvChat *chat, const char *name);
01021 
01030 GList *gaim_conv_chat_set_ignored(GaimConvChat *chat, GList *ignored);
01031 
01039 GList *gaim_conv_chat_get_ignored(const GaimConvChat *chat);
01040 
01055 const char *gaim_conv_chat_get_ignored_user(const GaimConvChat *chat,
01056                                             const char *user);
01057 
01066 gboolean gaim_conv_chat_is_user_ignored(const GaimConvChat *chat,
01067                                         const char *user);
01068 
01076 void gaim_conv_chat_set_topic(GaimConvChat *chat, const char *who,
01077                               const char *topic);
01078 
01086 const char *gaim_conv_chat_get_topic(const GaimConvChat *chat);
01087 
01094 void gaim_conv_chat_set_id(GaimConvChat *chat, int id);
01095 
01103 int gaim_conv_chat_get_id(const GaimConvChat *chat);
01104 
01114 void gaim_conv_chat_write(GaimConvChat *chat, const char *who,
01115                           const char *message, GaimMessageFlags flags,
01116                           time_t mtime);
01117 
01124 void gaim_conv_chat_send(GaimConvChat *chat, const char *message);
01125 
01133 void gaim_conv_chat_add_user(GaimConvChat *chat, const char *user,
01134                              const char *extra_msg);
01135 
01145 void gaim_conv_chat_add_users(GaimConvChat *chat, GList *users);
01146 
01154 void gaim_conv_chat_rename_user(GaimConvChat *chat, const char *old_user,
01155                                 const char *new_user);
01156 
01166 void gaim_conv_chat_remove_user(GaimConvChat *chat, const char *user,
01167                                 const char *reason);
01168 
01176 void gaim_conv_chat_remove_users(GaimConvChat *chat, GList *users,
01177                                  const char *reason);
01178 
01184 void gaim_conv_chat_clear_users(GaimConvChat *chat);
01185 
01192 void gaim_conv_chat_set_nick(GaimConvChat *chat, const char *nick);
01193 
01200 const char *gaim_conv_chat_get_nick(GaimConvChat *chat);
01201 
01210 GaimConversation *gaim_find_chat(const GaimConnection *gc, int id);
01211 
01218 void gaim_conv_chat_left(GaimConvChat *chat);
01219 
01229 gboolean gaim_conv_chat_has_left(GaimConvChat *chat);
01230 
01233 /**************************************************************************/
01235 /**************************************************************************/
01244 GList *gaim_conv_placement_get_options(void);
01245 
01253 void gaim_conv_placement_add_fnc(const char *id, const char *name,
01254                                  GaimConvPlacementFunc fnc);
01255 
01262 void gaim_conv_placement_remove_fnc(const char *id);
01263 
01272 const char *gaim_conv_placement_get_name(const char *id);
01273 
01282 GaimConvPlacementFunc gaim_conv_placement_get_fnc(const char *id);
01283 
01289 void gaim_conv_placement_set_current_func(GaimConvPlacementFunc func);
01290 
01296 GaimConvPlacementFunc gaim_conv_placement_get_current_func(void);
01297 
01306 const char *gaim_conv_placement_get_fnc_id(GaimConvPlacementFunc fnc);
01307 
01310 /**************************************************************************/
01312 /**************************************************************************/
01321 void gaim_conversations_set_win_ui_ops(GaimConvWindowUiOps *ops);
01322 
01329 GaimConvWindowUiOps *gaim_conversations_get_win_ui_ops(void);
01330 
01333 /**************************************************************************/
01335 /**************************************************************************/
01343 void *gaim_conversations_get_handle(void);
01344 
01348 void gaim_conversations_init(void);
01349 
01353 void gaim_conversations_uninit(void);
01354 
01357 #ifdef __cplusplus
01358 }
01359 #endif
01360 
01361 #endif /* _GAIM_CONVERSATION_H_ */

Generated on Sun Aug 29 03:45:05 2004 for gaim by doxygen 1.3.4