comparison libpurple/protocols/msn/table.h @ 31292:47b6eda87723

propagate from branch 'im.pidgin.pidgin' (head 07d0765c444a097af45c2650f54323afb900a07b) to branch 'im.pidgin.soc.2010.msn-tlc' (head f3998422a4724ab424e4e2328f58fc0504856557)
author masca@cpw.pidgin.im
date Mon, 19 Jul 2010 21:11:32 +0000
parents 7a0ae0a9d716
children
comparison
equal deleted inserted replaced
30698:e874875a74a7 31292:47b6eda87723
32 32
33 typedef void (*MsnMsgTypeCb)(MsnCmdProc *cmdproc, MsnMessage *msg); 33 typedef void (*MsnMsgTypeCb)(MsnCmdProc *cmdproc, MsnMessage *msg);
34 34
35 struct _MsnTable 35 struct _MsnTable
36 { 36 {
37 GHashTable *cmds; 37 GHashTable *cmds; /**< Callbacks that manage command response. */
38 GHashTable *msgs; 38 GHashTable *msgs; /**< Callbacks that manage incoming messages. */
39 GHashTable *errors; 39 GHashTable *errors; /**< Callbacks that manage command errors. */
40 40
41 GHashTable *async; 41 GHashTable *async; /**< Callbacks that manage incoming asyncronous messages. */
42 GHashTable *fallback; 42 /* TODO: Does this one is really needed? */
43 GHashTable *fallback; /**< Fallback callback. */
43 }; 44 };
44 45
46 /**
47 * Create a new instance of a MsnTable which map commands, errors and messages
48 * with callbacks that will handle it.
49 *
50 * @return A new MsnTable.
51 */
45 MsnTable *msn_table_new(void); 52 MsnTable *msn_table_new(void);
53
54 /**
55 * Destroy a MsnTable.
56 *
57 * @param table The MsnTable to be destroyed.
58 */
46 void msn_table_destroy(MsnTable *table); 59 void msn_table_destroy(MsnTable *table);
47 60
61 /**
62 * Relate an incomming command from server with a callback able to handle
63 * the event.
64 *
65 * @param table The MsnTable.
66 * @param command If NULL this add an incoming asyncronous command set in answer.
67 * Else, the command sent.
68 * @param answer The server answer to 'command'. If 'command' is NULL,
69 * the asyncronous command sent by the server.
70 * @param cb Callback to handle this event.
71 */
48 void msn_table_add_cmd(MsnTable *table, char *command, char *answer, 72 void msn_table_add_cmd(MsnTable *table, char *command, char *answer,
49 MsnTransCb cb); 73 MsnTransCb cb);
74
75 /**
76 * Set a callback to handle incoming command errors.
77 *
78 * @param table The MsnTable.
79 * @param answer Incoming command with error.
80 * @param cb Callback to handle this error.
81 */
50 void msn_table_add_error(MsnTable *table, char *answer, MsnErrorCb cb); 82 void msn_table_add_error(MsnTable *table, char *answer, MsnErrorCb cb);
83
84 /**
85 * Relate a message Content-type with a callback able to handle it.
86 *
87 * @param table The MsnTable.
88 * @param type The Message Content-Type.
89 * @param cb Callback to handle this Content-type.
90 */
51 void msn_table_add_msg_type(MsnTable *table, char *type, MsnMsgTypeCb cb); 91 void msn_table_add_msg_type(MsnTable *table, char *type, MsnMsgTypeCb cb);
52 92
53 #endif /* MSN_TABLE_H */ 93 #endif /* MSN_TABLE_H */