mirror of
https://github.com/moparisthebest/Yaaic
synced 2024-12-25 00:48:50 -05:00
Yaaic now handles private queries :)
This commit is contained in:
parent
9a702f5d1a
commit
09cb4af8f3
@ -33,7 +33,9 @@ import org.yaaic.R;
|
|||||||
import org.yaaic.Yaaic;
|
import org.yaaic.Yaaic;
|
||||||
import org.yaaic.model.Broadcast;
|
import org.yaaic.model.Broadcast;
|
||||||
import org.yaaic.model.Channel;
|
import org.yaaic.model.Channel;
|
||||||
|
import org.yaaic.model.Conversation;
|
||||||
import org.yaaic.model.Message;
|
import org.yaaic.model.Message;
|
||||||
|
import org.yaaic.model.Query;
|
||||||
import org.yaaic.model.Server;
|
import org.yaaic.model.Server;
|
||||||
import org.yaaic.model.Status;
|
import org.yaaic.model.Status;
|
||||||
|
|
||||||
@ -343,14 +345,36 @@ public class IRCConnection extends PircBot
|
|||||||
* On Private Message
|
* On Private Message
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void onPrivateMessage(String sender, String login, String hostname, String message)
|
protected void onPrivateMessage(String sender, String login, String hostname, String text)
|
||||||
{
|
{
|
||||||
debug("PrivateMessage", sender + " " + message);
|
debug("PrivateMessage", sender + " " + text);
|
||||||
|
|
||||||
// Strip mIRC colors and formatting
|
// Strip mIRC colors and formatting
|
||||||
message = Colors.removeFormattingAndColors(message);
|
text = Colors.removeFormattingAndColors(text);
|
||||||
|
|
||||||
// XXX: Open a query if there's none yet
|
Conversation conversation = server.getConversation(sender);
|
||||||
|
|
||||||
|
if (conversation == null) {
|
||||||
|
// Open a query if there's none yet
|
||||||
|
conversation = new Query(sender);
|
||||||
|
server.addConversationl(conversation);
|
||||||
|
|
||||||
|
Message message = new Message("<" + sender + "> " + text);
|
||||||
|
conversation.addMessage(message);
|
||||||
|
|
||||||
|
Intent intent = new Intent(Broadcast.CHANNEL_NEW);
|
||||||
|
intent.putExtra(Broadcast.EXTRA_CHANNEL, sender);
|
||||||
|
intent.putExtra(Broadcast.EXTRA_SERVER, server.getId());
|
||||||
|
service.sendBroadcast(intent);
|
||||||
|
} else {
|
||||||
|
Message message = new Message("<" + sender + "> " + text);
|
||||||
|
conversation.addMessage(message);
|
||||||
|
|
||||||
|
Intent intent = new Intent(Broadcast.CHANNEL_MESSAGE);
|
||||||
|
intent.putExtra(Broadcast.EXTRA_SERVER, server.getId());
|
||||||
|
intent.putExtra(Broadcast.EXTRA_CHANNEL, sender);
|
||||||
|
service.sendBroadcast(intent);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -56,7 +56,6 @@ import org.yaaic.irc.IRCBinder;
|
|||||||
import org.yaaic.irc.IRCService;
|
import org.yaaic.irc.IRCService;
|
||||||
import org.yaaic.listener.ChannelListener;
|
import org.yaaic.listener.ChannelListener;
|
||||||
import org.yaaic.model.Broadcast;
|
import org.yaaic.model.Broadcast;
|
||||||
import org.yaaic.model.Channel;
|
|
||||||
import org.yaaic.model.Conversation;
|
import org.yaaic.model.Conversation;
|
||||||
import org.yaaic.model.Message;
|
import org.yaaic.model.Message;
|
||||||
import org.yaaic.model.Server;
|
import org.yaaic.model.Server;
|
||||||
@ -339,9 +338,9 @@ public class ServerActivity extends Activity implements ServiceConnection, Chann
|
|||||||
*/
|
*/
|
||||||
public void onItemSelected(AdapterView<?> deck, View view, int position, long id)
|
public void onItemSelected(AdapterView<?> deck, View view, int position, long id)
|
||||||
{
|
{
|
||||||
Channel channel = (Channel) deck.getItemAtPosition(position);
|
Conversation conversation = (Conversation) deck.getItemAtPosition(position);
|
||||||
if (channel != null) {
|
if (conversation != null) {
|
||||||
((TextView) findViewById(R.id.title)).setText(server.getTitle() + " - " + channel.getName());
|
((TextView) findViewById(R.id.title)).setText(server.getTitle() + " - " + conversation.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user