Skip to content
This repository has been archived by the owner on Nov 28, 2020. It is now read-only.

Commit

Permalink
Absturz behoben
Browse files Browse the repository at this point in the history
  • Loading branch information
mathiasrabe committed Apr 10, 2011
1 parent 47be6ff commit a695dfd
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
3 changes: 2 additions & 1 deletion README
Expand Up @@ -7,8 +7,9 @@ geplante Features:
-Bei Anmeldung: Abfrage von Server-IP und Benutzernamen
-Flüstern (persönlicher Nachrichtenversand an spezielle Adressanten möglich)
-Statusabfrage (Wer ist gerade online?)
-/me Funktion

Bugs:
-IP Adresse wird nicht überprüft
-Benutzernamen sind Momentan noch nutzlos
-Probleme mit meta characters (regex) z.B. \ ? *
-Eingaben werden doppelt angezeigt
Binary file modified bin/client.class
Binary file not shown.
15 changes: 5 additions & 10 deletions src/client.java
Expand Up @@ -11,8 +11,6 @@ public class client implements Runnable
{
public static final int PORT = 8765;
Socket socket;
//DataInputStream in;
//PrintStream out;
Scanner in;
private volatile Thread connect;
String consoleinput;
Expand All @@ -31,7 +29,7 @@ public client()
System.out.println("In Ihrem Benutzernamen darf kein Leerzeichen enthalten sein." +
" Bitte geben Sie erneut ein:");
username = in.nextLine();
} while( username == null || username.contains(" ") );
} while( username.isEmpty() || username.contains(" ") );

try
{
Expand Down Expand Up @@ -83,13 +81,10 @@ public static void main(String[] args)

public void display(String line)
{
if (consoleinput != null) {
if ( !consoleinput.matches( line ) ) {
// könnte blöd werden, wenn anderer Teilnehmer das gleiche schreibt
// mit Benutzernamen im String dürfte die Filterung einfacher werden
System.out.println(line);
consoleinput = "";
}
if ( !line.startsWith(username) ) {
//TODO Der Server sollte dann auch Daten schicken die mit
// dem Benutzernamen beginnen: USERNAME: hallo
System.out.println(line);
}
}
}

0 comments on commit a695dfd

Please sign in to comment.