Advertisement
Hauke

WBB Connect 1.4.1 - Include

Aug 14th, 2011
487
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 10.35 KB | None | 0 0
  1. // WBB Connect 1.4.1 include by Hauke Marquardt alias |-|auke - 08.05.2012
  2. /*
  3. License:
  4.         This code is free: you can redistribute it and/or modify
  5.         it under the terms of the GNU General Public License as published by
  6.         the Free Software Foundation, either version 3 of the License, or
  7.         (at your option) any later version.
  8.  
  9.         This code is distributed in the hope that it will be useful,
  10.         but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12.         GNU General Public License for more details.
  13.  
  14.         You should have received a copy of the GNU General Public License
  15.         along with this program.  If not, see <http://www.gnu.org/licenses/>.
  16.         You´re not allowed to copy any code from this, into your code without
  17.         naming authors name in credits!
  18. */
  19.  
  20. #if !defined _h_library_norm_included
  21.     #define PAWN_TYPE_INT                   1
  22.     #define PAWN_TYPE_FLOAT                 2
  23.     #define PAWN_TYPE_ARRAY                 3
  24.     #define _h_library_norm_included
  25. #endif
  26.  
  27. #define WBB_USER_POSTS              0x0008
  28. #define WBB_USER_LAST_VISIT         0x0016
  29. #define WBB_USER_ACTIVATIO_CODE     0x0032
  30. #define WBB_USER_ACTIVITY_POINTS    0x0064
  31. #define WBB_USER_PROFILE_HITS       0x0128
  32. #define WBB_USER_UNREAD_PM          0x0256
  33.  
  34. /* Initializes connection. Must be called first!
  35.  * param:       string      MySQL Server IP
  36.  *              string      MySQL User
  37.  *              string      MySQL Password
  38.  *              string      MySQL Database
  39.  *  [optional]  int         Installation count of WCF.
  40.  *
  41.  * return:      bool        true if connected successfully
  42.  *              bool        false if connection failed
  43.  */
  44. stock WBB_SetMySQLData ( Server[ ] , User[ ] , Password[ ] , Database[ ] , InstallationCount = 1 )
  45.     return CallRemoteFunction ( "_WBB_SetMySQLData" , "ssssd" , Server , User , Password , Database , InstallationCount );
  46.  
  47.  
  48. /* Checks if username exists
  49.  * param:       string      Username
  50.  *
  51.  * return:      bool        true if user exists
  52.  *              bool        false if don´t exists
  53.  */
  54. stock WBB_IsValidUser ( wbbUsername[ ] )
  55.     return CallRemoteFunction ( "_WBB_IsValidUser" , "s" , wbbUsername );
  56.  
  57.  
  58. /* Checks if password is equal to account password
  59.  * param:       string      Username
  60.  *              string      Password
  61.  *
  62.  * return:      bool        true if password is correct
  63.  *              bool        false if password is incorrect
  64.  */
  65. stock WBB_CheckPassword ( wbbUsername[ ] , Password[ ] )
  66.     return CallRemoteFunction ( "_WBB_CheckPassword" , "ss" , wbbUsername , Password );
  67.    
  68.    
  69. /* Creates a new user
  70.  * param:       string      Username
  71.  *              string      Password
  72.  *              string      Email-Adress
  73.  *  [optional]  int         Activation state. 1 = Activated
  74.  *
  75.  * return:      int         -1 if mail-adress exists already
  76.  *              int         0 if username already exists
  77.  *              int         1 if user was created successfully
  78.  */
  79. stock WBB_AddNewUser ( Username[ ] , Password[ ] , Email[ ] , ActivationState = 1 )
  80.     return CallRemoteFunction ( "_WBB_AddNewUser" , "sssi" , Username , Password , Email , ActivationState );
  81.  
  82.  
  83. /* Sets user to activated
  84.  * param:       string      Username
  85.  *
  86.  * return:      int         -1 if user is already activated
  87.  *              int         0 if user don´t exists
  88.  *              int         1 if user was activated
  89.  */
  90. stock WBB_ActivateUser ( Username[ ] )
  91.     return CallRemoteFunction ( "_WBB_ActivateUser" , "s" , Username );
  92.  
  93.  
  94. /* Sets user to banned
  95.  * param:       string      Username
  96.  *              string      Reason
  97.  *
  98.  * return:      bool        true if user was banned successfully
  99.  *              bool        false if user don´t exists
  100.  */
  101. stock WBB_BanUser ( Username[ ] , Reason[ ] )
  102.     return CallRemoteFunction ( "_WBB_BanUser" , "ss" , Username , Reason );
  103.  
  104.  
  105. /* Reset ban of user
  106.  * param:       string      Username
  107.  *
  108.  * return:      bool        true if user was unbanned successfully
  109.  *              bool        false if user don´t exists
  110.  */
  111. stock WBB_UnBanUser ( Username[ ] )
  112.     return CallRemoteFunction ( "_WBB_UnBanUser" , "s" , Username );
  113.  
  114.  
  115. /* Send private message from user to user
  116.  * param:       string      Username
  117.  *              string      Recipient name
  118.  *              string      Message subject
  119.  *              string      Message
  120.  *
  121.  * return:      int         -1 if user don´t exists
  122.  *              int         0 is resipient do not exists
  123.  *              int         1 if message was sendet
  124.  */
  125. stock WBB_NewPrivateMessage ( Username[ ] , RecipientName[ ] , Subject[ ] , Message[ ] )
  126.     return CallRemoteFunction ( "_WBB_NewPrivateMessage" , "ssss" , Username , RecipientName , Subject , Message );
  127.    
  128.  
  129. /* Checks user activation state
  130.  * param:       string      Username
  131.  *
  132.  * return:      bool        true if user is activated
  133.  *              bool        false isn´t activated
  134.  */
  135. stock WBB_GetUserActivationState ( Username[ ] )
  136.     return CallRemoteFunction ( "_WBB_GetUserActivationState" , "s" , Username );
  137.    
  138.    
  139. /* Sets new password for user
  140.  * param:       string      Username
  141.  *              string      Password
  142.  *
  143.  * return:      bool        true if password changed
  144.  *              bool        false if user don´t exists
  145.  */
  146. stock WBB_SetUserPassword ( Username[ ] , Password[ ] )
  147.     return CallRemoteFunction ( "_WBB_SetUserPassword" , "ss" , Username , Password );
  148.    
  149.  
  150. /* Sets a new profile field value like birthday or location
  151.  * param:       string      Username
  152.  *              string      Fieldname (e.g.hobbies)
  153.  *              string      New value of field
  154.  *              int         type of Value
  155.  *
  156.  * return:      int         1 if option changed
  157.  *              int         0 if field dont exists
  158.  *              int         -1 if user dont exists
  159.  */
  160. stock WBB_SetProfileField ( Username[ ] , Field[ ] , Value[ ] , Type = PAWN_TYPE_INT )
  161.     return CallRemoteFunction ( "_WBB_SetProfileField" , "sssd" , Username , Field , Value , Type );
  162.  
  163.  
  164. /* Gets profile info field of user
  165.  * param:       string      Username
  166.  *              string      Fieldname
  167.  *
  168.  * return:      int         value of field
  169.  *              int         0 if field dont exists
  170.  *              int         -1 if user dont exists
  171.  */
  172. stock WBB_GetProfileField ( Username[ ] , Field[ ] )
  173.     return CallRemoteFunction ( "_WBB_GetProfileField" , "ss" , Username , Field );
  174.  
  175.  
  176. /* Sends a mail with activationcode to user
  177.  * param:       string      Username
  178.  *              string      Name of sender. E.g. XYZ Reallife
  179.  *              string      Name of domain. E.g. xyz-reallife.net. Without www!!
  180.  *              string      WBB forum index.php link. E.g. www.xyz-reallife.net/forum/index.php. Witout http and _GET variables!
  181.  *
  182.  * return:      bool        true if mail was sended successfully
  183.  *              bool        false if user dont exists
  184.  */
  185. stock WBB_SendUserActivationMail ( Username[ ] , Sendername[ ] , Servername[ ] , ForumIndexURL[ ] )
  186.     return CallRemoteFunction ( "_WBB_SendUserActivationMail" , "ssss" , Username , Sendername , Servername , ForumIndexURL );
  187.  
  188.  
  189. /* Adds a new post to thread
  190.  * param:       int         Thread ID where the post should be added
  191.  *              string      Subject of post
  192.  *              string      Message
  193.  *              string      Username
  194.  *              int         1 if html should be enabled
  195.  *              int         1 if bb codes should be enabled
  196.  *
  197.  * return:      bool        true if post was saved successfully
  198.  *              bool        false if user dont exists
  199.  */
  200. stock WBB_AddPost ( Thread , Subject[ ] , Message[ ] , Username[ ] , BBCodes = 0 , HTML = 0 )
  201.     return CallRemoteFunction ( "_WBB_AddPost" , "dsssdd" , Thread , Subject , Message , Username , BBCodes , HTML );
  202.  
  203.  
  204. /* Checks if user is in a specific group
  205.  * param:       string      Username
  206.  *              int         ID of Group
  207.  *
  208.  * return:      int         1 if is in group
  209.  *              int         0 if user is not in group
  210.  *              int         -1 if user dont exists
  211.  */
  212. stock WBB_IsUserInGroup ( Username[ ] , GroupID )
  213.     return CallRemoteFunction ( "WBB_IsUserInGroup" , "sd" , Username , GroupID );
  214.  
  215.    
  216. /* Adds a user to a group
  217.  * param:       string      Username
  218.  *              int         ID of Group
  219.  *
  220.  * return:      bool        true if user was settet to group successfully
  221.  *              bool        false if user dont exists
  222.  */
  223. stock WBB_SetUserToGroup ( Username[ ] , GroupID )
  224.     return CallRemoteFunction ( "_WBB_SetUserToGroup" , "sd" , Username , GroupID );
  225.    
  226.  
  227. /* Removes a user from a group
  228.  * param:       string      Username
  229.  *              int         ID of Group
  230.  *
  231.  * return:      int         1 if user was removed from group
  232.  *              int         0 if user was not removed
  233.  *              int         -1 if user dont exists
  234.  *              int         -2 if user is not in group
  235.  */
  236. stock WBB_RemoveUserFromGroup ( Username[ ] , GroupID )
  237.     return CallRemoteFunction ( "_WBB_RemoveUserFromGroup" , "sd" , Username , GroupID );
  238.    
  239.    
  240. /* Changes users email adress
  241.  * param:       string      Username
  242.  *              string      New email adress
  243.  *
  244.  * return:      bool        true if mail adress changed
  245.  *              bool        0 if user is invalid
  246.  */
  247. stock WBB_UpdateUserMail ( Username[ ] , Mail[ ] )
  248.     return CallRemoteFunction ( "_WBB_UpdateUserMail" , "ss" , Username , Mail );
  249.  
  250.  
  251. /* Reads out user statistics
  252.  * param:       string      Username
  253.  *              int         Data
  254.  *
  255.  * return:      int         value
  256.  *              bool        false if data or user is invalid
  257.  */
  258. stock WBB_GetUserStats ( Username[ ] , Data )
  259.     return CallRemoteFunction ( "_WBB_GetUserStats" , "sd" , Username , Data );
  260.    
  261.  
  262. /* Creates a new thread with first post in specific board               Unstable! Not testet much!
  263.  * param:       int         Board ID where thread should be stored in
  264.  *              string      Topic (Thread headline)
  265.  *              string      Username of writer
  266.  *              int         1 to disable thread. 0 to enable thread
  267.  *              int         1 to close thread. 0 to open thread
  268.  *              string      Post subject (Headline)
  269.  *              string      Post message
  270.  *              int         1 to enable bb codes. 0 to disable
  271.  *              int         1 to enable html. 0 to disable
  272.  *
  273.  * return:      bool        true if thread was successfull created
  274.  *              bool        false if data or user is invalid
  275.  */
  276. stock WBB_CreateThread ( Board , Topic[ ] , Username[ ] , Disabled , Closed , Subject[ ] , Message[ ] , BBCodes , HTML )
  277.     return CallRemoteFunction ( "_WBB_CreateThread" , "dssddssdd" , Board , Topic , Username , Disabled , Closed , Subject , Message , BBCodes , HTML );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement