mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-04 23:02:02 +01:00
add index of sending player to chat transmission, and on receiving
side translate that into showing the sender's name in notification. Not yet done: replacing silly "not me" in chat listing with same, but now it should be easy. Conflicts: xwords4/android/XWords4/archive/R.java
This commit is contained in:
parent
4e1a382f1e
commit
47954f82d0
18 changed files with 78 additions and 32 deletions
|
@ -501,12 +501,19 @@ and_util_warnIllegalWord( XW_UtilCtxt* uc, BadWordInfo* bwi,
|
||||||
|
|
||||||
#ifdef XWFEATURE_CHAT
|
#ifdef XWFEATURE_CHAT
|
||||||
static void
|
static void
|
||||||
and_util_showChat( XW_UtilCtxt* uc, const XP_UCHAR const* msg )
|
and_util_showChat( XW_UtilCtxt* uc, const XP_UCHAR const* msg, XP_S16 from )
|
||||||
{
|
{
|
||||||
UTIL_CBK_HEADER("showChat", "(Ljava/lang/String;)V" );
|
UTIL_CBK_HEADER( "showChat", "(Ljava/lang/String;Ljava/lang/String;)V" );
|
||||||
|
jstring jname = NULL;
|
||||||
|
if ( 0 <= from ) {
|
||||||
|
LocalPlayer* lp = &uc->gameInfo->players[from];
|
||||||
|
XP_ASSERT( !lp->isLocal );
|
||||||
|
jname = (*env)->NewStringUTF( env, lp->name );
|
||||||
|
}
|
||||||
|
|
||||||
jstring jmsg = (*env)->NewStringUTF( env, msg );
|
jstring jmsg = (*env)->NewStringUTF( env, msg );
|
||||||
(*env)->CallVoidMethod( env, util->jutil, mid, jmsg );
|
(*env)->CallVoidMethod( env, util->jutil, mid, jmsg, jname );
|
||||||
deleteLocalRef( env, jmsg );
|
deleteLocalRefs( env, jmsg, jname, DELETE_NO_REF );
|
||||||
UTIL_CBK_TAIL();
|
UTIL_CBK_TAIL();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1872,13 +1872,13 @@ Java_org_eehouse_android_xw4_jni_XwJNI_server_1endGame
|
||||||
|
|
||||||
#ifdef XWFEATURE_CHAT
|
#ifdef XWFEATURE_CHAT
|
||||||
JNIEXPORT void JNICALL
|
JNIEXPORT void JNICALL
|
||||||
Java_org_eehouse_android_xw4_jni_XwJNI_server_1sendChat
|
Java_org_eehouse_android_xw4_jni_XwJNI_board_1sendChat
|
||||||
( JNIEnv* env, jclass C, jint gamePtr, jstring jmsg )
|
( JNIEnv* env, jclass C, jint gamePtr, jstring jmsg )
|
||||||
{
|
{
|
||||||
XWJNI_START();
|
XWJNI_START();
|
||||||
XP_ASSERT( !!state->game.server );
|
XP_ASSERT( !!state->game.server );
|
||||||
const char* msg = (*env)->GetStringUTFChars( env, jmsg, NULL );
|
const char* msg = (*env)->GetStringUTFChars( env, jmsg, NULL );
|
||||||
server_sendChat( state->game.server, msg );
|
board_sendChat( state->game.board, msg );
|
||||||
(*env)->ReleaseStringUTFChars( env, jmsg, msg );
|
(*env)->ReleaseStringUTFChars( env, jmsg, msg );
|
||||||
XWJNI_END();
|
XWJNI_END();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1464,7 +1464,7 @@
|
||||||
down. -->
|
down. -->
|
||||||
<string name="notify_title_fmt">Move in game %1$s</string>
|
<string name="notify_title_fmt">Move in game %1$s</string>
|
||||||
<string name="notify_chat_title_fmt">Chat message in game %1$s</string>
|
<string name="notify_chat_title_fmt">Chat message in game %1$s</string>
|
||||||
|
<string name="notify_chat_body_fmt">%1$s: %2$s</string>
|
||||||
<!--
|
<!--
|
||||||
############################################################
|
############################################################
|
||||||
# Dialogs
|
# Dialogs
|
||||||
|
|
|
@ -1257,6 +1257,7 @@
|
||||||
down. -->
|
down. -->
|
||||||
<string name="notify_title_fmt">Evom ni emag %1$s</string>
|
<string name="notify_title_fmt">Evom ni emag %1$s</string>
|
||||||
<string name="notify_chat_title_fmt">Tahc egassem ni emag %1$s</string>
|
<string name="notify_chat_title_fmt">Tahc egassem ni emag %1$s</string>
|
||||||
|
<string name="notify_chat_body_fmt">%1$s: %2$s</string>
|
||||||
<!--
|
<!--
|
||||||
############################################################
|
############################################################
|
||||||
# Dialogs
|
# Dialogs
|
||||||
|
|
|
@ -1257,6 +1257,7 @@
|
||||||
down. -->
|
down. -->
|
||||||
<string name="notify_title_fmt">MOVE IN GAME %1$s</string>
|
<string name="notify_title_fmt">MOVE IN GAME %1$s</string>
|
||||||
<string name="notify_chat_title_fmt">CHAT MESSAGE IN GAME %1$s</string>
|
<string name="notify_chat_title_fmt">CHAT MESSAGE IN GAME %1$s</string>
|
||||||
|
<string name="notify_chat_body_fmt">%1$s: %2$s</string>
|
||||||
<!--
|
<!--
|
||||||
############################################################
|
############################################################
|
||||||
# Dialogs
|
# Dialogs
|
||||||
|
|
|
@ -1927,7 +1927,7 @@ public class BoardDelegate extends DelegateBase
|
||||||
// and may stack dialogs on top of this one. Including later
|
// and may stack dialogs on top of this one. Including later
|
||||||
// chat-messages.
|
// chat-messages.
|
||||||
@Override
|
@Override
|
||||||
public void showChat( final String msg )
|
public void showChat( final String msg, String fromPlayer )
|
||||||
{
|
{
|
||||||
if ( BuildConstants.CHAT_SUPPORTED ) {
|
if ( BuildConstants.CHAT_SUPPORTED ) {
|
||||||
post( new Runnable() {
|
post( new Runnable() {
|
||||||
|
|
|
@ -72,6 +72,7 @@ public class GameUtils {
|
||||||
public static class BackMoveResult {
|
public static class BackMoveResult {
|
||||||
LastMoveInfo m_lmi; // instantiated on demand
|
LastMoveInfo m_lmi; // instantiated on demand
|
||||||
String m_chat;
|
String m_chat;
|
||||||
|
String m_chatFrom;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Object s_syncObj = new Object();
|
private static Object s_syncObj = new Object();
|
||||||
|
@ -854,6 +855,7 @@ public class GameUtils {
|
||||||
public String m_chat;
|
public String m_chat;
|
||||||
public boolean m_gotMsg;
|
public boolean m_gotMsg;
|
||||||
public boolean m_gotChat;
|
public boolean m_gotChat;
|
||||||
|
public String m_chatFrom;
|
||||||
public boolean m_gameOver;
|
public boolean m_gameOver;
|
||||||
|
|
||||||
public FeedUtilsImpl( Context context, long rowid )
|
public FeedUtilsImpl( Context context, long rowid )
|
||||||
|
@ -864,10 +866,12 @@ public class GameUtils {
|
||||||
m_gotMsg = false;
|
m_gotMsg = false;
|
||||||
m_gameOver = false;
|
m_gameOver = false;
|
||||||
}
|
}
|
||||||
public void showChat( String msg )
|
@Override
|
||||||
|
public void showChat( String msg, String fromName )
|
||||||
{
|
{
|
||||||
DBUtils.appendChatHistory( m_context, m_rowid, msg, false );
|
DBUtils.appendChatHistory( m_context, m_rowid, msg, false );
|
||||||
m_gotChat = true;
|
m_gotChat = true;
|
||||||
|
m_chatFrom = fromName;
|
||||||
m_chat = msg;
|
m_chat = msg;
|
||||||
}
|
}
|
||||||
public void turnChanged( int newTurn )
|
public void turnChanged( int newTurn )
|
||||||
|
@ -919,6 +923,7 @@ public class GameUtils {
|
||||||
if ( null != bmr ) {
|
if ( null != bmr ) {
|
||||||
if ( null != feedImpl.m_chat ) {
|
if ( null != feedImpl.m_chat ) {
|
||||||
bmr.m_chat = feedImpl.m_chat;
|
bmr.m_chat = feedImpl.m_chat;
|
||||||
|
bmr.m_chatFrom = feedImpl.m_chatFrom;
|
||||||
} else {
|
} else {
|
||||||
LastMoveInfo lmi = new LastMoveInfo();
|
LastMoveInfo lmi = new LastMoveInfo();
|
||||||
XwJNI.model_getPlayersLastScore( gamePtr, -1, lmi );
|
XwJNI.model_getPlayersLastScore( gamePtr, -1, lmi );
|
||||||
|
@ -1100,7 +1105,13 @@ public class GameUtils {
|
||||||
int titleID;
|
int titleID;
|
||||||
if ( null != bmr.m_chat ) {
|
if ( null != bmr.m_chat ) {
|
||||||
titleID = R.string.notify_chat_title_fmt;
|
titleID = R.string.notify_chat_title_fmt;
|
||||||
msg = "\"" + bmr.m_chat + "\"";
|
if ( null != bmr.m_chatFrom ) {
|
||||||
|
msg = LocUtils
|
||||||
|
.getString( context, R.string.notify_chat_body_fmt,
|
||||||
|
bmr.m_chatFrom, bmr.m_chat );
|
||||||
|
} else {
|
||||||
|
msg = bmr.m_chat;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
titleID = R.string.notify_title_fmt;
|
titleID = R.string.notify_title_fmt;
|
||||||
msg = bmr.m_lmi.format( context );
|
msg = bmr.m_lmi.format( context );
|
||||||
|
|
|
@ -564,7 +564,7 @@ public class JNIThread extends Thread {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CMD_SENDCHAT:
|
case CMD_SENDCHAT:
|
||||||
XwJNI.server_sendChat( m_jniGamePtr, (String)args[0] );
|
XwJNI.board_sendChat( m_jniGamePtr, (String)args[0] );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CMD_NETSTATS:
|
case CMD_NETSTATS:
|
||||||
|
|
|
@ -146,7 +146,7 @@ public interface UtilCtxt {
|
||||||
boolean warnIllegalWord( String dict, String[] words, int turn,
|
boolean warnIllegalWord( String dict, String[] words, int turn,
|
||||||
boolean turnLost );
|
boolean turnLost );
|
||||||
|
|
||||||
void showChat( String msg );
|
void showChat( String msg, String fromPlayer );
|
||||||
|
|
||||||
boolean phoneNumbersSame( String num1, String num2 );
|
boolean phoneNumbersSame( String num1, String num2 );
|
||||||
}
|
}
|
||||||
|
|
|
@ -293,7 +293,7 @@ public class UtilCtxtImpl implements UtilCtxt {
|
||||||
}
|
}
|
||||||
|
|
||||||
// These need to go into some sort of chat DB, not dropped.
|
// These need to go into some sort of chat DB, not dropped.
|
||||||
public void showChat( String msg )
|
public void showChat( String msg, String fromPlayer )
|
||||||
{
|
{
|
||||||
subclassOverride( "showChat" );
|
subclassOverride( "showChat" );
|
||||||
}
|
}
|
||||||
|
|
|
@ -277,6 +277,7 @@ public class XwJNI {
|
||||||
public static native boolean board_endTrade( int gamePtr );
|
public static native boolean board_endTrade( int gamePtr );
|
||||||
|
|
||||||
public static native String board_formatRemainingTiles( int gamePtr );
|
public static native String board_formatRemainingTiles( int gamePtr );
|
||||||
|
public static native void board_sendChat( int gamePtr, String msg );
|
||||||
|
|
||||||
public enum XP_Key {
|
public enum XP_Key {
|
||||||
XP_KEY_NONE,
|
XP_KEY_NONE,
|
||||||
|
@ -319,7 +320,6 @@ public class XwJNI {
|
||||||
public static native String server_writeFinalScores( int gamePtr );
|
public static native String server_writeFinalScores( int gamePtr );
|
||||||
public static native boolean server_initClientConnection( int gamePtr );
|
public static native boolean server_initClientConnection( int gamePtr );
|
||||||
public static native void server_endGame( int gamePtr );
|
public static native void server_endGame( int gamePtr );
|
||||||
public static native void server_sendChat( int gamePtr, String msg );
|
|
||||||
|
|
||||||
// hybrid to save work
|
// hybrid to save work
|
||||||
public static native boolean board_server_prefsChanged( int gamePtr,
|
public static native boolean board_server_prefsChanged( int gamePtr,
|
||||||
|
|
|
@ -796,6 +796,12 @@ board_canHint( const BoardCtxt* board )
|
||||||
return canHint;
|
return canHint;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
board_sendChat( const BoardCtxt* board, const XP_UCHAR const* msg )
|
||||||
|
{
|
||||||
|
server_sendChat( board->server, msg, board->selPlayer );
|
||||||
|
}
|
||||||
|
|
||||||
static XP_U16
|
static XP_U16
|
||||||
adjustOffset( XP_U16 curOffset, XP_S16 zoomBy )
|
adjustOffset( XP_U16 curOffset, XP_S16 zoomBy )
|
||||||
{
|
{
|
||||||
|
|
|
@ -129,6 +129,7 @@ XP_Bool board_canHideRack( const BoardCtxt* board );
|
||||||
XP_Bool board_canTrade( BoardCtxt* board );
|
XP_Bool board_canTrade( BoardCtxt* board );
|
||||||
XP_Bool board_canTogglePending( const BoardCtxt* board );
|
XP_Bool board_canTogglePending( const BoardCtxt* board );
|
||||||
XP_Bool board_canHint( const BoardCtxt* board );
|
XP_Bool board_canHint( const BoardCtxt* board );
|
||||||
|
void board_sendChat( const BoardCtxt* board, const XP_UCHAR const* msg );
|
||||||
|
|
||||||
/* zoomBy: >0: zoom in; < 0: zoom out; 0: query only */
|
/* zoomBy: >0: zoom in; < 0: zoom out; 0: query only */
|
||||||
XP_Bool board_zoom( BoardCtxt* board, XP_S16 zoomBy, XP_Bool* canInOut );
|
XP_Bool board_zoom( BoardCtxt* board, XP_S16 zoomBy, XP_Bool* canInOut );
|
||||||
|
|
|
@ -636,12 +636,14 @@ server_initClientConnection( ServerCtxt* server, XWStreamCtxt* stream )
|
||||||
|
|
||||||
#ifdef XWFEATURE_CHAT
|
#ifdef XWFEATURE_CHAT
|
||||||
static void
|
static void
|
||||||
sendChatTo( ServerCtxt* server, XP_U16 devIndex, const XP_UCHAR const* msg )
|
sendChatTo( ServerCtxt* server, XP_U16 devIndex, const XP_UCHAR const* msg,
|
||||||
|
XP_S8 from )
|
||||||
{
|
{
|
||||||
if ( comms_canChat( server->vol.comms ) ) {
|
if ( comms_canChat( server->vol.comms ) ) {
|
||||||
XWStreamCtxt* stream = messageStreamWithHeader( server, devIndex,
|
XWStreamCtxt* stream = messageStreamWithHeader( server, devIndex,
|
||||||
XWPROTO_CHAT );
|
XWPROTO_CHAT );
|
||||||
stringToStream( stream, msg );
|
stringToStream( stream, msg );
|
||||||
|
stream_putU8( stream, from );
|
||||||
stream_destroy( stream );
|
stream_destroy( stream );
|
||||||
} else {
|
} else {
|
||||||
XP_LOGF( "%s: dropping chat %s; queue too full?", __func__, msg );
|
XP_LOGF( "%s: dropping chat %s; queue too full?", __func__, msg );
|
||||||
|
@ -650,23 +652,23 @@ sendChatTo( ServerCtxt* server, XP_U16 devIndex, const XP_UCHAR const* msg )
|
||||||
|
|
||||||
static void
|
static void
|
||||||
sendChatToClientsExcept( ServerCtxt* server, XP_U16 skip,
|
sendChatToClientsExcept( ServerCtxt* server, XP_U16 skip,
|
||||||
const XP_UCHAR const* msg )
|
const XP_UCHAR const* msg, XP_S8 from )
|
||||||
{
|
{
|
||||||
XP_U16 devIndex;
|
XP_U16 devIndex;
|
||||||
for ( devIndex = 1; devIndex < server->nv.nDevices; ++devIndex ) {
|
for ( devIndex = 1; devIndex < server->nv.nDevices; ++devIndex ) {
|
||||||
if ( devIndex != skip ) {
|
if ( devIndex != skip ) {
|
||||||
sendChatTo( server, devIndex, msg );
|
sendChatTo( server, devIndex, msg, from );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
server_sendChat( ServerCtxt* server, const XP_UCHAR const* msg )
|
server_sendChat( ServerCtxt* server, const XP_UCHAR const* msg, XP_S16 from )
|
||||||
{
|
{
|
||||||
if ( server->vol.gi->serverRole == SERVER_ISCLIENT ) {
|
if ( server->vol.gi->serverRole == SERVER_ISCLIENT ) {
|
||||||
sendChatTo( server, SERVER_DEVICE, msg );
|
sendChatTo( server, SERVER_DEVICE, msg, from );
|
||||||
} else {
|
} else {
|
||||||
sendChatToClientsExcept( server, SERVER_DEVICE, msg );
|
sendChatToClientsExcept( server, SERVER_DEVICE, msg, from );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -2813,12 +2815,14 @@ server_receiveMessage( ServerCtxt* server, XWStreamCtxt* incoming )
|
||||||
#ifdef XWFEATURE_CHAT
|
#ifdef XWFEATURE_CHAT
|
||||||
} else if ( code == XWPROTO_CHAT ) {
|
} else if ( code == XWPROTO_CHAT ) {
|
||||||
XP_UCHAR* msg = stringFromStream( server->mpool, incoming );
|
XP_UCHAR* msg = stringFromStream( server->mpool, incoming );
|
||||||
|
XP_S16 from = 1 <= stream_getSize( incoming )
|
||||||
|
? stream_getU8( incoming ) : -1;
|
||||||
if ( isServer ) {
|
if ( isServer ) {
|
||||||
XP_U16 sourceClientIndex =
|
XP_U16 sourceClientIndex =
|
||||||
getIndexForDevice( server, stream_getAddress( incoming ) );
|
getIndexForDevice( server, stream_getAddress( incoming ) );
|
||||||
sendChatToClientsExcept( server, sourceClientIndex, msg );
|
sendChatToClientsExcept( server, sourceClientIndex, msg, from );
|
||||||
}
|
}
|
||||||
util_showChat( server->vol.util, msg );
|
util_showChat( server->vol.util, msg, from );
|
||||||
XP_FREE( server->mpool, msg );
|
XP_FREE( server->mpool, msg );
|
||||||
#endif
|
#endif
|
||||||
} else if ( readStreamHeader( server, incoming ) ) {
|
} else if ( readStreamHeader( server, incoming ) ) {
|
||||||
|
|
|
@ -122,7 +122,8 @@ XP_Bool server_initClientConnection( ServerCtxt* server, XWStreamCtxt* stream );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef XWFEATURE_CHAT
|
#ifdef XWFEATURE_CHAT
|
||||||
void server_sendChat( ServerCtxt* server, const XP_UCHAR const* msg );
|
void server_sendChat( ServerCtxt* server, const XP_UCHAR const* msg,
|
||||||
|
XP_S16 from );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void server_formatDictCounts( ServerCtxt* server, XWStreamCtxt* stream,
|
void server_formatDictCounts( ServerCtxt* server, XWStreamCtxt* stream,
|
||||||
|
|
|
@ -199,7 +199,8 @@ typedef struct UtilVtable {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef XWFEATURE_CHAT
|
#ifdef XWFEATURE_CHAT
|
||||||
void (*m_util_showChat)( XW_UtilCtxt* uc, const XP_UCHAR* const msg );
|
void (*m_util_showChat)( XW_UtilCtxt* uc, const XP_UCHAR* const msg,
|
||||||
|
XP_S16 from );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SHOW_PROGRESS
|
#ifdef SHOW_PROGRESS
|
||||||
|
@ -346,7 +347,7 @@ struct XW_UtilCtxt {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef XWFEATURE_CHAT
|
#ifdef XWFEATURE_CHAT
|
||||||
# define util_showChat( uc, m ) (uc)->vtable->m_util_showChat((uc),(m))
|
# define util_showChat( uc, m, f ) (uc)->vtable->m_util_showChat((uc),(m),(f))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# ifdef SHOW_PROGRESS
|
# ifdef SHOW_PROGRESS
|
||||||
|
|
|
@ -1428,15 +1428,22 @@ curses_util_makeStreamFromAddr(XW_UtilCtxt* uc, XP_PlayerAddr channelNo )
|
||||||
#ifdef XWFEATURE_CHAT
|
#ifdef XWFEATURE_CHAT
|
||||||
static void
|
static void
|
||||||
curses_util_showChat( XW_UtilCtxt* uc,
|
curses_util_showChat( XW_UtilCtxt* uc,
|
||||||
const XP_UCHAR* const XP_UNUSED_DBG(msg) )
|
const XP_UCHAR* const XP_UNUSED_DBG(msg),
|
||||||
|
XP_S16 XP_UNUSED_DBG(from) )
|
||||||
{
|
{
|
||||||
CursesAppGlobals* globals = (CursesAppGlobals*)uc->closure;
|
CursesAppGlobals* globals = (CursesAppGlobals*)uc->closure;
|
||||||
globals->nChatsSent = 0;
|
globals->nChatsSent = 0;
|
||||||
XP_LOGF( "%s: got \"%s\"", __func__, msg );
|
# ifdef DEBUG
|
||||||
|
const XP_UCHAR* name = "<unknown>";
|
||||||
|
if ( 0 <= from ) {
|
||||||
|
CommonGlobals* cGlobals = &globals->cGlobals;
|
||||||
|
name = cGlobals->gi->players[from].name;
|
||||||
|
}
|
||||||
|
XP_LOGF( "%s: got \"%s\" from %s", __func__, msg, name );
|
||||||
|
# endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
setupCursesUtilCallbacks( CursesAppGlobals* globals, XW_UtilCtxt* util )
|
setupCursesUtilCallbacks( CursesAppGlobals* globals, XW_UtilCtxt* util )
|
||||||
{
|
{
|
||||||
|
@ -1770,7 +1777,7 @@ chatsTimerFired( gpointer data )
|
||||||
comms_getChannelSeed( game->comms ),
|
comms_getChannelSeed( game->comms ),
|
||||||
timp->tm_hour, timp->tm_min, timp->tm_sec );
|
timp->tm_hour, timp->tm_min, timp->tm_sec );
|
||||||
XP_LOGF( "%s: sending \"%s\"", __func__, msg );
|
XP_LOGF( "%s: sending \"%s\"", __func__, msg );
|
||||||
server_sendChat( game->server, msg );
|
board_sendChat( game->board, msg );
|
||||||
++globals->nChatsSent;
|
++globals->nChatsSent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1538,7 +1538,7 @@ handle_chat_button( GtkWidget* XP_UNUSED(widget), GtkGameGlobals* globals )
|
||||||
{
|
{
|
||||||
gchar* msg = gtkGetChatMessage( globals );
|
gchar* msg = gtkGetChatMessage( globals );
|
||||||
if ( NULL != msg ) {
|
if ( NULL != msg ) {
|
||||||
server_sendChat( globals->cGlobals.game.server, msg );
|
board_sendChat( globals->cGlobals.game.board, msg );
|
||||||
g_free( msg );
|
g_free( msg );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2191,10 +2191,16 @@ gtk_util_makeStreamFromAddr(XW_UtilCtxt* uc, XP_PlayerAddr channelNo )
|
||||||
|
|
||||||
#ifdef XWFEATURE_CHAT
|
#ifdef XWFEATURE_CHAT
|
||||||
static void
|
static void
|
||||||
gtk_util_showChat( XW_UtilCtxt* uc, const XP_UCHAR* const msg )
|
gtk_util_showChat( XW_UtilCtxt* uc, const XP_UCHAR* const msg, XP_S16 from )
|
||||||
{
|
{
|
||||||
GtkGameGlobals* globals = (GtkGameGlobals*)uc->closure;
|
GtkGameGlobals* globals = (GtkGameGlobals*)uc->closure;
|
||||||
(void)gtkask( globals->window, msg, GTK_BUTTONS_OK, NULL );
|
XP_UCHAR buf[1024];
|
||||||
|
XP_UCHAR* name = "<unknown>";
|
||||||
|
if ( 0 <= from ) {
|
||||||
|
name = globals->cGlobals.gi->players[from].name;
|
||||||
|
}
|
||||||
|
XP_SNPRINTF( buf, VSIZE(buf), "quoth %s: %s", name, msg );
|
||||||
|
(void)gtkask( globals->window, buf, GTK_BUTTONS_OK, NULL );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue