add sms for curses (untested)

This commit is contained in:
Eric House 2022-08-26 09:57:43 -07:00
parent b4e197f8af
commit 8a91970ba8
2 changed files with 14 additions and 0 deletions

View file

@ -1188,6 +1188,7 @@ handleReplace( void* closure, int XP_UNUSED(key) )
return XP_TRUE; return XP_TRUE;
} /* handleReplace */ } /* handleReplace */
#ifndef XWFEATURE_COMMS_INVITE
static bool static bool
inviteList( CommonGlobals* cGlobals, CommsAddrRec* addr, GSList* invitees, inviteList( CommonGlobals* cGlobals, CommsAddrRec* addr, GSList* invitees,
CommsConnType typ ) CommsConnType typ )
@ -1231,6 +1232,7 @@ inviteList( CommonGlobals* cGlobals, CommsAddrRec* addr, GSList* invitees,
} }
return haveAddressees; return haveAddressees;
} }
#endif
static bool static bool
handleInvite( void* closure, int XP_UNUSED(key) ) handleInvite( void* closure, int XP_UNUSED(key) )
@ -1251,6 +1253,11 @@ handleInvite( void* closure, int XP_UNUSED(key) )
if ( SERVER_ISSERVER != cGlobals->gi->serverRole ) { if ( SERVER_ISSERVER != cGlobals->gi->serverRole ) {
ca_inform( bGlobals->boardWin, "Only hosts can invite" ); ca_inform( bGlobals->boardWin, "Only hosts can invite" );
#ifdef XWFEATURE_COMMS_INVITE
} else if ( XP_TRUE ) {
comms_invite( cGlobals->game.comms, NULL_XWE, &nli, &addr );
#else
/* Invite first based on an invitee provided. Otherwise, fall back to /* Invite first based on an invitee provided. Otherwise, fall back to
doing a send-to-self. Let the recipient code reject a duplicate if doing a send-to-self. Let the recipient code reject a duplicate if
the user so desires. */ the user so desires. */
@ -1281,6 +1288,7 @@ handleInvite( void* closure, int XP_UNUSED(key) )
if ( 0 != relayID ) { if ( 0 != relayID ) {
relaycon_invite( params, relayID, NULL, &nli ); relaycon_invite( params, relayID, NULL, &nli );
} }
#endif
} else { } else {
ca_inform( bGlobals->boardWin, "Cannot invite via relayID, MQTT or by \"sms phone\"." ); ca_inform( bGlobals->boardWin, "Cannot invite via relayID, MQTT or by \"sms phone\"." );
} }

View file

@ -1494,6 +1494,7 @@ linux_send( XWEnv XP_UNUSED(xwe), const XP_U8* buf, XP_U16 buflen,
return nSent; return nSent;
} /* linux_send */ } /* linux_send */
#ifdef XWFEATURE_COMMS_INVITE
XP_S16 XP_S16
linux_send_invt( XWEnv XP_UNUSED(xwe), const NetLaunchInfo* nli, linux_send_invt( XWEnv XP_UNUSED(xwe), const NetLaunchInfo* nli,
XP_U32 createdStamp, XP_U32 createdStamp,
@ -1509,12 +1510,17 @@ linux_send_invt( XWEnv XP_UNUSED(xwe), const NetLaunchInfo* nli,
mqttc_invite( cGlobals->params, createdStamp, nli, mqttc_invite( cGlobals->params, createdStamp, nli,
&destAddr->u.mqtt.devID ); &destAddr->u.mqtt.devID );
break; break;
case COMMS_CONN_SMS:
linux_sms_invite( cGlobals->params, nli,
destAddr->u.sms.phone, destAddr->u.sms.port );
break;
default: default:
XP_ASSERT(0); XP_ASSERT(0);
} }
} }
return nSent; return nSent;
} }
#endif
static int static int
blocking_read( int fd, unsigned char* buf, const int len ) blocking_read( int fd, unsigned char* buf, const int len )