📄 ftrans.c
字号:
/*
* This program 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.
*
* This program 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 this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* Jabber
* Copyright (C) 2004 Xie Tian Lu http://sabber.jabberstudio.org/
*/
#include "ftrans.h"
void jabm_send_msg( jconn j, char* to, const char* msg )
{
xmlnode x;
x = jutil_msgnew( MS_CHAT, to, NULL, msg );
jab_send( j, x );
xmlnode_free( x );
}
void jabm_multi_send_msg( jconn j, char* to[], int num, const char* msg )
{
xmlnode x;
char str[ 1024 ];
int i;
strcpy( str, to[ 0 ] );
for ( i = 1; i < num; i++ ) {
strcat( str, ";" );
strcat( str, to[ i ] );
}
x = jutil_msgnew( MS_CHAT, str, NULL, msg );
jab_send( j, x );
xmlnode_free( x );
}
void jabf_send_hypertext( jconn j, char* to[], int num, const char* body, const char* url, const char* desc )
{
char str[ 1024 ];
//char *result;
xmlnode x;
xmlnode c;
xmlnode g;
int i;
strcpy( str, to[ 0 ] );
for ( i = 1; i < num; i++ ) {
strcat( str, ";" );
strcat( str, to[ i ] );
}
x = jutil_msgnew( MS_CHAT, str, NULL, body );
c = xmlnode_insert_tag( x, "x" );
xmlnode_put_attrib( c, "xmlns", NS_XOOB );
g = xmlnode_insert_tag( c, "url" );
xmlnode_insert_cdata( g, url, -1 );
g = xmlnode_insert_tag( c, "desc" );
xmlnode_insert_cdata( g, desc, -1 );
jab_send( j, x );
//result = xmlnode2str( x );
xmlnode_free( x );
}
void jabf_send_url( jconn j, char* to, char* url, char* desc )
{
char* id;
xmlnode xml,itm, tmp;
char *result;
//char rurl[ 1024 ];
xml = jutil_iqnew(JPACKET__SET, NS_OOB );
id = jab_getid(j);
xmlnode_put_attrib(xml,"id",id);
xmlnode_put_attrib(xml,"to",to);
itm = xmlnode_get_tag(xml,"query");
tmp = xmlnode_insert_tag( itm, "url" );
//strcpy( rurl, url );
xmlnode_insert_cdata(tmp, url, -1);
tmp = xmlnode_insert_tag( itm, "desc" );
xmlnode_insert_cdata(tmp, desc, -1);
jab_send(j,xml);
result = xmlnode2str( xml );
xmlnode_free(xml);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -