mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-02-11 08:48:06 +01:00
add logging
This commit is contained in:
parent
f46f8ed560
commit
bba0b79763
1 changed files with 5 additions and 3 deletions
|
@ -116,11 +116,12 @@ send_sms( LinSMS2Data* storage, XWStreamCtxt* stream,
|
||||||
gchar* str64 = g_base64_encode( buf, buflen );
|
gchar* str64 = g_base64_encode( buf, buflen );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
XP_U16 count = ++storage->count;
|
||||||
makeQueuePath( phone, port, path, sizeof(path) );
|
makeQueuePath( phone, port, path, sizeof(path) );
|
||||||
XP_LOGF( "%s: writing to %s", __func__, path );
|
XP_LOGF( "%s: writing msg %d to %s", __func__, count, path );
|
||||||
g_mkdir_with_parents( path, 0777 ); /* just in case */
|
g_mkdir_with_parents( path, 0777 ); /* just in case */
|
||||||
int len = strlen( path );
|
int len = strlen( path );
|
||||||
snprintf( &path[len], sizeof(path)-len, "/%d", ++storage->count );
|
snprintf( &path[len], sizeof(path)-len, "/%d", count );
|
||||||
|
|
||||||
XP_UCHAR sms[buflen*2]; /* more like (buflen*4/3) */
|
XP_UCHAR sms[buflen*2]; /* more like (buflen*4/3) */
|
||||||
XP_U16 smslen = sizeof(sms);
|
XP_U16 smslen = sizeof(sms);
|
||||||
|
@ -285,7 +286,7 @@ sms2_receive( void* closure, int socket )
|
||||||
XP_S16 nRead = -1;
|
XP_S16 nRead = -1;
|
||||||
char shortest[256] = { '\0' };
|
char shortest[256] = { '\0' };
|
||||||
GDir* dir = g_dir_open( storage->myQueue, 0, NULL );
|
GDir* dir = g_dir_open( storage->myQueue, 0, NULL );
|
||||||
XP_LOGF( "%s: opening %s", __func__, storage->myQueue );
|
XP_LOGF( "%s: opening queue %s", __func__, storage->myQueue );
|
||||||
for ( ; ; ) {
|
for ( ; ; ) {
|
||||||
const gchar* name = g_dir_read_name( dir );
|
const gchar* name = g_dir_read_name( dir );
|
||||||
if ( NULL == name ) {
|
if ( NULL == name ) {
|
||||||
|
@ -302,6 +303,7 @@ sms2_receive( void* closure, int socket )
|
||||||
uint8_t buf[256];
|
uint8_t buf[256];
|
||||||
CommsAddrRec fromAddr = {0};
|
CommsAddrRec fromAddr = {0};
|
||||||
if ( !!shortest[0] ) {
|
if ( !!shortest[0] ) {
|
||||||
|
XP_LOGF( "%s: decoding message %s", __func__, shortest );
|
||||||
nRead = decodeAndDelete2( storage, shortest, buf,
|
nRead = decodeAndDelete2( storage, shortest, buf,
|
||||||
sizeof(buf), &fromAddr );
|
sizeof(buf), &fromAddr );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue