/soc/2012/sanket/statscollector-2.x.y: b8ff90df752a: Remove pidg...
Sanket Agarwal
sanket at soc.pidgin.im
Fri Apr 5 02:03:14 EDT 2013
Changeset: b8ff90df752a4158d0ed1adfc95f84f28ad796a7
Author: Sanket Agarwal <sanket at soc.pidgin.im>
Date: 2013-04-04 22:03 +0530
Branch: soc.2012.statscollector
URL: https://hg.pidgin.im/soc/2012/sanket/statscollector-2.x.y/rev/b8ff90df752a
Description:
Remove pidgin plugin, as we don't need it.
diffstat:
pidgin/plugins/statscollector.c | 1247 ---------------------------------------
1 files changed, 0 insertions(+), 1247 deletions(-)
diffs (truncated from 1252 to 300 lines):
diff --git a/pidgin/plugins/statscollector.c b/pidgin/plugins/statscollector.c
deleted file mode 100644
--- a/pidgin/plugins/statscollector.c
+++ /dev/null
@@ -1,1247 +0,0 @@
-/* Log the activity of users */
-
-#include "internal.h"
-
-#include "debug.h"
-#include "log.h"
-#include "notify.h"
-#include "signals.h"
-#include "util.h"
-#include "version.h"
-#include "cipher.h"
-#include "prpl.h"
-#include "core.h"
-#include "accountopt.h"
-#include "pidginstock.h"
-#include "request.h"
-
-#include <glib.h>
-/* #include <gtkplugin.h> */
-#include<gtkutils.h>
-#include "gtkblist.h"
-
-#ifdef _WIN32
-#include<windows.h>
-#endif
-
-#ifdef __APPLE__
-#include<CoreServices/CoreServices.h>
-#include<sys/types.h>
-#include<sys/sysctl.h>
-#endif
-
-/* Allow/Deny Constants */
-#define ALLOW 0
-#define DENY 1
-#define ASK 2
-/* Timeout */
-#define RESEND_SEC (24*3600)
-
-/* Sending URL */
-#define SEND_URL "http://localhost:8000/collectstats/collect/"
-
-/* Version of XML this plugin supports writing */
-
-#define STATS_XML_MAJOR_V "1"
-#define STATS_XML_MINOR_V "0"
-
-/* POSIX compliance is an issue that I have looked into some detail now
- * It seems like presence of unistd.h and _POSIX_VERSION being defined
- * confirms the presence of POSIX compliance. For this ofcourse we need
- * to ensure that unistd.h is defined. As it is *already* a part of
- * internal.h, we could directly go ahead with the testing if the
- * system is POSIX or not
- */
-
-#ifdef _POSIX_VERSION
-# include <sys/utsname.h>
-# include <dlfcn.h>
-#endif
-
-PurplePlugin *plugin_g;
-xmlnode *root_stats, *cpuinfo_xml, *ui_info;
-GHashTable *stats_acc_ht, *stats_plugins_ht, *stats_uis_ht;
-int save_timer = 0, send_handle = 0;
-
-/* Types of Operating Systems */
-enum OS_TYPES {WINDOWS, APPLE, UNIX};
-enum BIT_32_64 {BIT_32, BIT_64};
-
-static void schedule_send(void);
-static gboolean send_stats();
-static gboolean plugin_load(PurplePlugin *);
-
-static void
-confirm_allow(){
-
- /* Set the allow variable in prefs to ALLOW */
- purple_prefs_set_int("/plugins/core/statscollector/allow", ALLOW);
- plugin_load(plugin_g);
-
-}
-
-static void
-confirm_deny(){
-
- /* Set the allow variable in prefs to ALLOW */
- purple_prefs_set_int("/plugins/core/statscollector/allow", DENY);
-
-}
-
-static void
-confirm_later(){
-
- /* No-op right now, but can contain logic wherein we have
- * a timeout before the next callout for authorize/deny
- */
-
-}
-
-static glong
-get_time_sec(){
-
- /* Gets current time in seconds */
- GTimeVal res;
- g_get_current_time(&res);
- return res.tv_sec;
-
-}
-
-static void
-save_xml(){
-
- /* Uses the Hash tables and other XML nodes
- * that have been saved/modified and create
- * final modified XML out of it to be flushed
- */
-
- GHashTableIter iter;
- gpointer key, value;
- xmlnode *nroot, *nacc, *nplugins, *nuis, *node;
- char *data, *version;
-
- nroot = xmlnode_new("stats");
-
- /* Set the string information */
- version = g_strdup_printf("%s.%s", STATS_XML_MAJOR_V,\
- STATS_XML_MINOR_V);
- xmlnode_set_attrib(nroot, "version", version);
-
- /* Load CPUinfo strucutre */
- xmlnode_insert_child(nroot, cpuinfo_xml);
-
- /* Load UI info */
- xmlnode_insert_child(nroot, ui_info);
-
- nacc = xmlnode_new_child(nroot, "accounts");
- nplugins = xmlnode_new_child(nroot, "plugins");
- nuis = xmlnode_new_child(nroot, "uis");
-
- /* Use the hash tables to populate acc and plugins */
-
- g_hash_table_iter_init(&iter, stats_acc_ht);
-
- while(g_hash_table_iter_next(&iter, &key, &value)){
-
- node = xmlnode_from_str(value, -1);
- xmlnode_insert_child(nacc, node);
-
- }
-
-
- g_hash_table_iter_init(&iter, stats_plugins_ht);
-
- while(g_hash_table_iter_next(&iter, &key, &value)){
-
- node = xmlnode_from_str(value, -1);
- xmlnode_insert_child(nplugins, node);
-
- }
-
- g_hash_table_iter_init(&iter, stats_uis_ht);
-
- while(g_hash_table_iter_next(&iter, &key, &value)){
-
- node = xmlnode_from_str(value, -1);
- xmlnode_insert_child(nuis, node);
-
- }
-
- data = xmlnode_to_formatted_str(nroot, NULL);
- purple_util_write_data_to_file("stats.xml", data, -1);
-
-}
-
-static gboolean
-save_cb(gpointer data){
- save_xml();
- save_timer = 0;
- return FALSE;
-}
-
-static void
-schedule_stats_save(void){
- if(save_timer == 0)
- save_timer = purple_timeout_add_seconds(5, save_cb, NULL);
-}
-
-static xmlnode *
-get_app_32_64(){
-
- /* Determines if the application is running in 32 or 64 bit mode */
- int pt_size;
- xmlnode *bit_size_xml;
-
- pt_size = sizeof(int *)*8;
- bit_size_xml = xmlnode_new("app-bit");
- xmlnode_insert_data(bit_size_xml, g_strdup_printf("%d",pt_size), -1);
- return bit_size_xml;
-
-}
-
-static xmlnode *
-get_os_32_64(){
-
- /* Determines whether the kernel we are running is 32 or 64 bit */
- int bit_size=-1;
- xmlnode *bit_size_xml;
-#ifdef _WIN32
-
- BOOL bIsWow64;
- typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL);
- LPFN_ISWOW64PROCESS fnIsWow64Process;
-
-#elif defined _POSIX_VERSION
-
- struct utsname os_utsname;
- char *m_name;
-
-#endif
-
- bit_size_xml = xmlnode_new("os-bit");
-
-#ifdef _WIN64
-
- bit_size = 64;
-
-#elif defined _WIN32
-
- /* Check if we are running as wow64 process */
- bIsWow64 = FALSE;
- fnIsWow64Process = (LPFN_ISWOW64PROCESS) GetProcAddress( \
- GetModuleHandle(TEXT("kernel32")),"IsWow64Process");
-
- if(NULL != fnIsWow64Process)
- {
- if (!fnIsWow64Process(GetCurrentProcess(),&bIsWow64))
- {
- bit_size = -1; /* Cannot say! */
- }
- }
- if(bIsWow64) bit_size= 64;
- else bit_size = 32;
-
-#elif _POSIX_VERSION
-
- /* Use uname to find kernel architecture and infer bit-size */
- uname(&os_utsname);
- m_name = os_utsname.machine;
-
- /* Identifying 64 bit OS is tricky. We use the following identifiers
- * on basis of experience with uname(2) call.
- */
-
- if(!g_strcmp0(m_name, "x86_64") || !g_strcmp0(m_name, "ia64") \
- || !g_strcmp0(m_name, "amd64") || !g_strcmp0(m_name, "ppc64")) \
- bit_size = 64;
- else bit_size = 32;
-
-#endif
-
- xmlnode_insert_data(bit_size_xml, g_strdup_printf("%d", bit_size), -1);
-
- return bit_size_xml;
-
-}
-
-static xmlnode *
-get_arch(){
-
- /* Obtains the architecture type */
-
- xmlnode *arch_xml;
- char *arch_str;
-
-#ifdef _WIN32
- SYSTEM_INFO sys_info;
- typedef void (WINAPI *PGNSI)(LPSYSTEM_INFO);
- typedef BOOL (WINAPI *PGPI)(DWORD, DWORD, DWORD, DWORD, PDWORD);
- PGNSI pGNSI;
-#elif defined _POSIX_VERSION
- struct utsname os_utsname;
-#endif
-
- arch_xml = xmlnode_new("arch");
-
-
-#ifdef _WIN32
- pGNSI = (PGNSI) GetProcAddress(
- GetModuleHandle(TEXT("kernel32.dll")), "GetNativeSystemInfo");
-
- if(NULL != pGNSI)
- pGNSI(&sys_info);
- else GetSystemInfo(&sys_info);
-
- switch(sys_info.wProcessorArchitecture){
More information about the Commits
mailing list