⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 plugin_core.c

📁 partysip 插件开发 用于实时在线管理
💻 C
字号:
/*  The NOTIFY plugin is a GPL plugin for partysip.  Copyright (C) 2002 2003  Aymeric MOIZARD - <jack@atosc.org>    The NOTIFY plugin is free software; you can redistribute it and/or modify  it under the terms of the GNU General Public License as published by  the Free Software Foundation; either version 2 of the License, or  (at your option) any later version.    The NOTIFY plugin is distributed in the hope that it will be useful,  but WITHOUT ANY WARRANTY; without even the implied warranty of  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  GNU General Public License for more details.  You should have received a copy of the GNU General Public License  along with Foobar; if not, write to the Free Software  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA*/#include <partysip/partysip.h>#include "plugin.h"/* this structure is retreived by the core application   with dlsym */psp_plugin_t PSP_PLUGIN_DECLARE_DATA mysqldb_notify_plugin;/* element shared with the core application layer *//* all xxx_plugin elements MUST be DYNAMICLY ALLOCATED   as the core application will assume they are */sfp_plugin_t *apsp_plugin1;char name_config[50];extern plugin_ctx_t *plugin_context;/* this is called by the core application when the module   is loaded (the address of this method is located in   the structure mysqldb_notify_plugin->plugin_init() */PSP_PLUGIN_DECLARE (int)plugin_init (char *_name_config){  sfp_snd_func_t *fn2;  int i;  /* plugin MUST create their own structure and give them     back to the core by calling:     psp_core_load_xxx_plugin();     where xxx is the module name related to the plugin.     psp_plugins can have more than one xxx_plugins attached   */  OSIP_TRACE (osip_trace (__FILE__, __LINE__, OSIP_INFO2, NULL,                          "%s plugin: plugin_init()!\n", PLUGIN_NAME));  /* default config name */#ifndef WIN32  if (_name_config==NULL)    snprintf(name_config, 49, "mysqldb_notify");  else    snprintf(name_config, 49, _name_config);#else  if (_name_config==NULL)    _snprintf(name_config, 49, "mysqldb_notify");  else    _snprintf(name_config, 49, _name_config);#endif  i = plugin_ctx_init ();  if (i != 0)    goto pi_error1;  psp_plugin_take_ownership (&mysqldb_notify_plugin);  i = psp_core_load_sfp_plugin (&apsp_plugin1, &mysqldb_notify_plugin);  if (i != 0)    goto pi_error2;  /* INIT HOOK METHOD FOR UAP */  i = sfp_snd_func_init (&fn2, &cb_plugin_catch_2xxanswer, mysqldb_notify_plugin.plug_id);  if (i != 0)    goto pi_error5;  i = psp_core_add_sfp_snd_2xx_hook (fn2, PSP_HOOK_MIDDLE);  if (i != 0)    goto pi_error5;  return 0;  /* TODO */pi_error5:pi_error2:  plugin_ctx_free ();  plugin_context = NULL;pi_error1:  return -1;}PSP_PLUGIN_DECLARE (int)plugin_start (){  /*  Really useless!     OSIP_TRACE(osip_trace(__FILE__,__LINE__,OSIP_INFO1,NULL,     "%s plugin: plugin_start()!\n", PLUGIN_NAME));   */  return -1;}PSP_PLUGIN_DECLARE (int)plugin_release (){  OSIP_TRACE (osip_trace (__FILE__, __LINE__, OSIP_INFO1, NULL,                          "%s plugin: plugin_release()!\n", PLUGIN_NAME));  plugin_ctx_free ();  plugin_context = NULL;  return -1;}psp_plugin_t PSP_PLUGIN_DECLARE_DATA mysqldb_notify_plugin = {  0,                            /* uninitialized */  "mysqldb_notify",  "2.1.0",  "plugin acting as a presence server (sends notify).",  PLUGIN_SFP,  0,                            /* number of owners is always 0 at the begining */  NULL,                         /* future place for the dso_handle */  &plugin_init,  &plugin_start,  &plugin_release};

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -