📄 mybegin.c
字号:
/* * send sms through www.mybegin.com * siet not working at the moment 6/2000 * * Authors: Michael Jochum <e9725005@stud3.tuwien.ac.at> * * TODO: * * Fixes: * * For license terms, see the file COPYING in the project directory. */#include <string.h>#include <glib.h>#include <gsms-plugin.h>#include <stdio.h>#include "networks.h"#define LINE 128#define MAXMSG (8192*2)#define SERVERHOST "www.mybegin.com"#define PORT 80gint init_plugin (PluginData *pd);static void destroy_plugin (PluginData *pd);static gint send_sms(PluginData *pd, gchar * text, gchar * tel); static gint send_sms(PluginData *pd, gchar * text, gchar * tel){ gint err; gchar buffer[MAXMSG]; GSmsHttp ht; gchar *text_ue, *number_ue;/*********** DISABLE sending (site not working)******************/ return -1;/****************************************************************/ text_ue = gsms_http_url_encode(text); number_ue = gsms_http_url_encode(tel); ht.method = g_strdup("GET"); ht.url = g_strdup_printf("/sms/sms/?number=%s&message=%s&CharCount=140", number_ue, text_ue); ht.protokoll = g_strdup("HTTP/1.0"); ht.host = g_strdup("ms.mybegin.com"); ht.referer = g_strdup("http://sms.mybegin.com/sms/"); ht.accept = g_strdup("image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, image/png, */*"); ht.acceptlang = g_strdup("en"); ht.acceptchar = g_strdup("iso-8859-1,*,utf-8"); ht.connection = g_strdup("Keep-Alive"); ht.cookie = NULL; ht.useragent = g_strdup("Mozilla/4.73 [en] (X11; U; Linux)"); ht.body = NULL; if ( (err = gsms_send_http_request(SERVERHOST, PORT, &ht, buffer, MAXMSG)) != 0) g_log(MODULE_LOG_DOMAIN, G_LOG_LEVEL_WARNING, "Could not send http request"); puts(buffer); return err;}voiddestroy_plugin (PluginData *pd){/* TODO FREE g_free(pd->networks->data); */}gintinit_plugin (PluginData *pd){ GSMNetwork *network; gint i; /* initialize */ pd->destroy_plugin = destroy_plugin; pd->send_sms = send_sms; pd->name = "www.mybegin.com"; pd->authors = "Michael Jochum <e9725005@student.tuwien.ac.at>"; pd->default_priority = 800; for(i=0; networks[i] != NULL;) { network = g_new(GSMNetwork, 1); network->prefix = networks[i++]; network->name = networks[i++]; pd->networks = g_slist_append(pd->networks, network); } return PLUGIN_OK;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -