Advertisement
Guest User

Simple Pidgin Protocol Plugin

a guest
Oct 20th, 2016
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 4.88 KB | None | 0 0
  1.  
  2. #include <plugin.h>
  3. #include <prpl.h>
  4. #include <debug.h>
  5. #include <version.h>
  6. #include <account.h>
  7.  
  8. #define TESTP_PRPL_ID "prpl-testplugin"
  9.  
  10. void testp_login(PurpleAccount* _pAccount)
  11. {
  12. }
  13.  
  14. void testp_close(PurpleConnection* _pConnection)
  15. {
  16. }
  17.  
  18. int testp_send_im(PurpleConnection* _pConnection, const char* _pWho, const char* _pMessage, PurpleMessageFlags _flags)
  19. {
  20.     return 1;
  21. }
  22.  
  23. const char* testp_normalize(const PurpleAccount* _pAccount, const char* _pWho)
  24. {
  25.     return _pWho;
  26. }
  27.  
  28. const char* testp_list_icon(PurpleAccount* _pAccount, PurpleBuddy* _pBuddy)
  29. {
  30.     return "testp";
  31. }
  32.  
  33.  
  34. extern "C"
  35. {
  36.  
  37. static PurplePluginProtocolInfo testp_protocol_info =
  38. {
  39.     (PurpleProtocolOptions)0, /* options */
  40.     NULL,    /* user_splits */
  41.     NULL,            /* protocol_options */
  42.     {           /* icon_spec, a PurpleBuddyIconSpec */
  43.         "png,gif,bmp,tiff,jpg",         /* format */
  44.         1,          /* min_width */
  45.         1,          /* min_height */
  46.         4096,           /* max_width */
  47.         4096,           /* max_height */
  48.         8*1024*1024,    /* max_filesize */
  49.         PURPLE_ICON_SCALE_SEND, /* scale_rules */
  50.     },
  51.     testp_list_icon,    /* list_icon */
  52.     NULL,            /* list_emblems */
  53.     NULL,    /* status_text */
  54.     NULL,            /* tooltip_text */
  55.     NULL,    /* status_types */
  56.     NULL,            /* blist_node_menu */
  57.     NULL,    /* chat_info */
  58.     NULL,            /* chat_info_defaults */
  59.     testp_login,        /* login */
  60.     testp_close,        /* close */
  61.     testp_send_im,    /* send_im */
  62.     NULL,            /* set_info */
  63.     NULL, /* send_typing */
  64.     NULL,            /* get_info */
  65.     NULL,    /* set_status */
  66.     NULL,            /* set_idle */
  67.     NULL,            /* change_passwd */
  68.     NULL,            /* add_buddy */
  69.     NULL,            /* add_buddies */
  70.     NULL,            /* remove_buddy */
  71.     NULL,            /* remove_buddies */
  72.     NULL,            /* add_permit */
  73.     NULL,            /* add_deny */
  74.     NULL,            /* rem_permit */
  75.     NULL,            /* rem_deny */
  76.     NULL,            /* set_permit_deny */
  77.     NULL,    /* join_chat */
  78.     NULL,            /* reject chat invite */
  79.     NULL,    /* get_chat_name */
  80.     NULL,            /* chat_invite */
  81.     NULL,    /* chat_leave */
  82.     NULL,            /* chat_whisper */
  83.     NULL,    /* chat_send */
  84.     NULL,            /* keepalive */
  85.     NULL,            /* register_user */
  86.     NULL,            /* get_cb_info */
  87.     NULL,            /* get_cb_away */
  88.     NULL,            /* alias_buddy */
  89.     NULL,            /* group_buddy */
  90.     NULL,            /* rename_group */
  91.     NULL,            /* buddy_free */
  92.     NULL,            /* convo_closed */
  93.     testp_normalize,            /* normalize */
  94.     NULL,            /* set_buddy_icon */
  95.     NULL,            /* remove_group */
  96.     NULL,            /* get_cb_real_name */
  97.     NULL,            /* set_chat_topic */
  98.     NULL,            /* find_blist_chat */
  99.     NULL,            /* roomlist_get_list */
  100.     NULL,            /* roomlist_cancel */
  101.     NULL,            /* roomlist_expand_category */
  102.     NULL,            /* can_receive_file */
  103.     NULL,            /* send_file */
  104.     NULL,            /* new_xfer */
  105.     NULL,            /* offline_message */
  106.     NULL,            /* whiteboard_prpl_ops */
  107.     NULL,            /* send_raw */
  108.     NULL,            /* roomlist_room_serialize */
  109.     NULL,            /* unregister_user */
  110.     NULL,            /* send_attention */
  111.     NULL,            /* attention_types */
  112.     sizeof(PurplePluginProtocolInfo),    /* struct_size */
  113.     NULL,            /*campfire_get_account_text_table *//* get_account_text_table */
  114.     NULL,            /* initiate_media */
  115.     NULL,            /* get_media_caps */
  116.     NULL,            /* get_moods */
  117.     NULL,            /* set_public_alias */
  118.     NULL,            /* get_public_alias */
  119.     NULL,            /* add_buddy_with_invite */
  120.     NULL,            /* add_buddies_with_invite */
  121. };
  122.  
  123. #define GPLUGIN_ID          TESTP_PRPL_ID
  124. #define GPLUGIN_NAME        "TestPlugin"
  125. #define GPLUGIN_VERSION     "0.1"
  126. #define GPLUGIN_SUMMARY     "TestPlugin"
  127. #define GPLUGIN_DESCRIPTION "Test Protocol Plugin"
  128. #define GPLUGIN_AUTHOR      "My Name <email@helloworld.tld>"
  129. #define GPLUGIN_HOMEPAGE    "http://example.com"
  130.  
  131. static PurplePluginInfo info =
  132. {
  133.     PURPLE_PLUGIN_MAGIC,
  134.     PURPLE_MAJOR_VERSION,
  135.     PURPLE_MINOR_VERSION,
  136.     PURPLE_PLUGIN_PROTOCOL,
  137.     NULL,
  138.     0,
  139.     NULL,
  140.     PURPLE_PRIORITY_DEFAULT,
  141. GPLUGIN_ID         ,
  142. GPLUGIN_NAME       ,
  143. GPLUGIN_VERSION    ,
  144. GPLUGIN_SUMMARY    ,
  145. GPLUGIN_DESCRIPTION,
  146. GPLUGIN_AUTHOR     ,
  147. GPLUGIN_HOMEPAGE   ,
  148.     NULL,
  149.     NULL,
  150.     NULL,
  151.     NULL,
  152.     &testp_protocol_info,
  153.     NULL,
  154.     NULL,
  155.     NULL,
  156.     NULL,
  157.     NULL,
  158.     NULL
  159. };
  160.  
  161. static void init_plugin(PurplePlugin* plugin)
  162. {
  163. }
  164.  
  165. PURPLE_INIT_PLUGIN(testplugin, init_plugin, info)
  166.  
  167. } // extern "C"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement