libpurple/protocols.h

branch
soc.2013.gobjectification.plugins
changeset 36624
38043ecaf4a6
parent 36621
3edd164b6a1a
child 36627
a3b0d16f69ef
equal deleted inserted replaced
36623:caaadef03507 36624:38043ecaf4a6
47 typedef enum { 47 typedef enum {
48 PURPLE_ICON_SCALE_DISPLAY = 0x01, /**< We scale the icon when we display it */ 48 PURPLE_ICON_SCALE_DISPLAY = 0x01, /**< We scale the icon when we display it */
49 PURPLE_ICON_SCALE_SEND = 0x02 /**< We scale the icon before we send it to the server */ 49 PURPLE_ICON_SCALE_SEND = 0x02 /**< We scale the icon before we send it to the server */
50 } PurpleIconScaleRules; 50 } PurpleIconScaleRules;
51 51
52 #define PURPLE_TYPE_BUDDY_ICON_SPEC (purple_buddy_icon_spec_get_type())
53
54 /**
55 * A description of a Buddy Icon specification. This tells Purple what kind of image file
56 * it should give this protocol, and what kind of image file it should expect back.
57 * Dimensions less than 1 should be ignored and the image not scaled.
58 */
59 typedef struct _PurpleBuddyIconSpec PurpleBuddyIconSpec;
60
61 #define PURPLE_TYPE_THUMBNAIL_SPEC (purple_thumbnail_spec_get_type())
62
63 /**
64 * A description of a file transfer thumbnail specification.
65 * This tells the UI if and what image formats the protocol support for file
66 * transfer thumbnails.
67 */
68 typedef struct _PurpleThumbnailSpec PurpleThumbnailSpec;
69
70 /** 52 /**
71 * Represents an entry containing information that must be supplied by the 53 * Represents an entry containing information that must be supplied by the
72 * user when joining a chat. 54 * user when joining a chat.
73 */ 55 */
74 typedef struct _PurpleProtocolChatEntry PurpleProtocolChatEntry; 56 typedef struct _PurpleProtocolChatEntry PurpleProtocolChatEntry;
166 */ 148 */
167 OPT_PROTO_AUTHORIZATION_DENIED_MESSAGE = 0x00002000 149 OPT_PROTO_AUTHORIZATION_DENIED_MESSAGE = 0x00002000
168 150
169 } PurpleProtocolOptions; 151 } PurpleProtocolOptions;
170 152
171 /** @copydoc PurpleBuddyIconSpec */
172 struct _PurpleBuddyIconSpec {
173 /** This is a comma-delimited list of image formats or @c NULL if icons
174 * are not supported. Neither the core nor the protocol will actually
175 * check to see if the data it's given matches this; it's entirely up
176 * to the UI to do what it wants
177 */
178 char *format;
179
180 int min_width; /**< Minimum width of this icon */
181 int min_height; /**< Minimum height of this icon */
182 int max_width; /**< Maximum width of this icon */
183 int max_height; /**< Maximum height of this icon */
184 size_t max_filesize; /**< Maximum size in bytes */
185 PurpleIconScaleRules scale_rules; /**< How to stretch this icon */
186 };
187
188 #include "media.h"
189 #include "protocol.h" 153 #include "protocol.h"
190 #include "status.h"
191 154
192 #define PURPLE_TYPE_PROTOCOL_CHAT_ENTRY (purple_protocol_chat_entry_get_type()) 155 #define PURPLE_TYPE_PROTOCOL_CHAT_ENTRY (purple_protocol_chat_entry_get_type())
193 156
194 /** @copydoc PurpleProtocolChatEntry */ 157 /** @copydoc PurpleProtocolChatEntry */
195 struct _PurpleProtocolChatEntry { 158 struct _PurpleProtocolChatEntry {
218 /**************************************************************************/ 181 /**************************************************************************/
219 /** @name Attention Type API */ 182 /** @name Attention Type API */
220 /**************************************************************************/ 183 /**************************************************************************/
221 /*@{*/ 184 /*@{*/
222 185
223 /** TODO 186 /**
224 * Returns the GType for the #PurpleAttentionType boxed structure. 187 * Returns the GType for the #PurpleAttentionType boxed structure.
225 */ 188 */
226 GType purple_attention_type_get_type(void); 189 GType purple_attention_type_get_type(void);
227 190
228 /** 191 /**
335 /**************************************************************************/ 298 /**************************************************************************/
336 /** @name Protocol Action API */ 299 /** @name Protocol Action API */
337 /**************************************************************************/ 300 /**************************************************************************/
338 /*@{*/ 301 /*@{*/
339 302
340 /** TODO 303 /**
341 * Returns the GType for the #PurpleProtocolAction boxed structure. 304 * Returns the GType for the #PurpleProtocolAction boxed structure.
342 */ 305 */
343 GType purple_protocol_action_get_type(void); 306 GType purple_protocol_action_get_type(void);
344 307
345 /** TODO A sanity check is needed 308 /**
346 * Allocates and returns a new PurpleProtocolAction. Use this to add actions in 309 * Allocates and returns a new PurpleProtocolAction. Use this to add actions in
347 * a list in the get_actions function of the protocol. 310 * a list in the get_actions function of the protocol.
348 * 311 *
349 * @param label The description of the action to show to the user. 312 * @param label The description of the action to show to the user.
350 * @param callback The callback to call when the user selects this action. 313 * @param callback The callback to call when the user selects this action.
351 */ 314 */
352 PurpleProtocolAction *purple_protocol_action_new(const char* label, 315 PurpleProtocolAction *purple_protocol_action_new(const char* label,
353 PurpleProtocolActionCallback callback); 316 PurpleProtocolActionCallback callback);
354 317
355 /** TODO A sanity check is needed 318 /**
356 * Frees a PurpleProtocolAction 319 * Frees a PurpleProtocolAction
357 * 320 *
358 * @param action The PurpleProtocolAction to free. 321 * @param action The PurpleProtocolAction to free.
359 */ 322 */
360 void purple_protocol_action_free(PurpleProtocolAction *action); 323 void purple_protocol_action_free(PurpleProtocolAction *action);
361 324
362 /*@}*/ 325 /*@}*/
363 326
364 /**************************************************************************/ 327 /**************************************************************************/
365 /** @name Buddy Icon Spec API */ 328 /** @name Protocol Chat Entry API */
366 /**************************************************************************/ 329 /**************************************************************************/
367 /*@{*/ 330 /*@{*/
368 331
369 /** TODO 332 /**
370 * Returns the GType for the #PurpleBuddyIconSpec boxed structure.
371 */
372 GType purple_buddy_icon_spec_get_type(void);
373
374 /** TODO
375 * Creates a new #PurpleBuddyIconSpec instance.
376 *
377 * @param format A comma-delimited list of image formats or @c NULL if
378 * icons are not supported
379 * @param min_width Minimum width of an icon
380 * @param min_height Minimum height of an icon
381 * @param max_width Maximum width of an icon
382 * @param max_height Maximum height of an icon
383 * @param max_filesize Maximum file size in bytes
384 * @param scale_rules How to stretch this icon
385 *
386 * @return A new buddy icon spec.
387 */
388 PurpleBuddyIconSpec *purple_buddy_icon_spec_new(char *format, int min_width,
389 int min_height, int max_width, int max_height, size_t max_filesize,
390 PurpleIconScaleRules scale_rules);
391
392 /** TODO needed?
393 * Destroys a #PurpleBuddyIconSpec instance.
394 *
395 * @param icon_spec The icon spec to destroy.
396 */
397 void purple_buddy_icon_spec_destroy(PurpleBuddyIconSpec *icon_spec);
398
399 /*@}*/
400
401 /**************************************************************************/
402 /** @name Thumbnail API */
403 /**************************************************************************/
404 /*@{*/
405
406 /** TODO
407 * Returns the GType for the #PurpleThumbnailSpec boxed structure.
408 */
409 GType purple_thumbnail_spec_get_type(void);
410
411 /*@}*/
412
413 /**************************************************************************/
414 /** @name Protocol Chat Entry API */
415 /**************************************************************************/
416 /*@{*/
417
418 /** TODO
419 * Returns the GType for the #PurpleProtocolChatEntry boxed structure. 333 * Returns the GType for the #PurpleProtocolChatEntry boxed structure.
420 */ 334 */
421 GType purple_protocol_chat_entry_get_type(void); 335 GType purple_protocol_chat_entry_get_type(void);
422 336
423 /*@}*/ 337 /*@}*/
637 /**************************************************************************/ 551 /**************************************************************************/
638 /** @name Protocols API */ 552 /** @name Protocols API */
639 /**************************************************************************/ 553 /**************************************************************************/
640 /*@{*/ 554 /*@{*/
641 555
642 /** TODO rename 556 /**
643 * Finds a protocol by ID. 557 * Finds a protocol by ID.
644 * 558 *
645 * @param id The protocol's ID. 559 * @param id The protocol's ID.
646 */ 560 */
647 PurpleProtocol *purple_find_protocol_info(const char *id); 561 PurpleProtocol *purple_protocols_find(const char *id);
648 562
649 /** TODO A sanity check is needed 563 /**
650 * Adds a protocol to the list of protocols. 564 * Adds a protocol to the list of protocols.
651 * 565 *
652 * @param protocol_type The type of the protocol to add. 566 * @param protocol_type The type of the protocol to add.
653 * 567 *
654 * @return The protocol instance if the protocol was added, else @c NULL. 568 * @return The protocol instance if the protocol was added, else @c NULL.
655 */ 569 */
656 PurpleProtocol *purple_protocols_add(GType protocol_type); 570 PurpleProtocol *purple_protocols_add(GType protocol_type);
657 571
658 /** TODO A sanity check is needed 572 /**
659 * Removes a protocol from the list of protocols. This will disconnect all 573 * Removes a protocol from the list of protocols. This will disconnect all
660 * connected accounts using this protocol, and free the protocol's user splits 574 * connected accounts using this protocol, and free the protocol's user splits
661 * and protocol options. 575 * and protocol options.
662 * 576 *
663 * @param protocol The protocol to remove. 577 * @param protocol The protocol to remove.
664 * 578 *
665 * @return TRUE if the protocol was removed, else FALSE. 579 * @return TRUE if the protocol was removed, else FALSE.
666 */ 580 */
667 gboolean purple_protocols_remove(PurpleProtocol *protocol); 581 gboolean purple_protocols_remove(PurpleProtocol *protocol);
668 582
669 /** TODO A sanity check is needed 583 /**
670 * Returns a list of all loaded protocols. 584 * Returns a list of all loaded protocols.
671 * 585 *
672 * @constreturn A list of all loaded protocols. 586 * @constreturn A list of all loaded protocols.
673 */ 587 */
674 GList *purple_protocols_get_all(void); 588 GList *purple_protocols_get_all(void);
683 /** 597 /**
684 * Initializes the protocols subsystem. 598 * Initializes the protocols subsystem.
685 */ 599 */
686 void purple_protocols_init(void); 600 void purple_protocols_init(void);
687 601
688 /** TODO Make protocols use this handle, instead of plugins handle 602 /**
689 * Returns the protocols subsystem handle. 603 * Returns the protocols subsystem handle.
690 * 604 *
691 * @return The protocols subsystem handle. 605 * @return The protocols subsystem handle.
692 */ 606 */
693 void *purple_protocols_get_handle(void); 607 void *purple_protocols_get_handle(void);

mercurial