Compare commits
2 Commits
b204d9e076
...
248fd1deb6
Author | SHA1 | Date |
---|---|---|
Pascal Abresch | 248fd1deb6 | |
Pascal Abresch | 21ad34618d |
|
@ -153,7 +153,6 @@ void BuddyWindow::AddNewUser() {
|
|||
}
|
||||
|
||||
// internally replace the username with a proper one if necessary (transports)
|
||||
Agent *agent;
|
||||
string username = _handle->Text();
|
||||
|
||||
// if not Jabber
|
||||
|
@ -161,14 +160,6 @@ void BuddyWindow::AddNewUser() {
|
|||
username = GenericFunctions::CrushOutWhitespace(username);
|
||||
}
|
||||
|
||||
if (!strcasecmp(_chat_services->Menu()->FindMarked()->Label(), "ICQ")) {
|
||||
agent = AgentList::Instance()->GetAgentByService("icq");
|
||||
|
||||
if (agent) {
|
||||
username += "@";
|
||||
username += agent->JID();
|
||||
}
|
||||
}
|
||||
|
||||
// make a user to validate against
|
||||
std::string validate = UserID::WhyNotValidJabberHandle(username);
|
||||
|
|
|
@ -110,7 +110,6 @@
|
|||
#define BLAB_SLEEP 0x17003009
|
||||
|
||||
// transports
|
||||
#define AGENT_MENU_CHANGED_TO_ICQ 0x18000002 // TODO remove?
|
||||
#define AGENT_MENU_CHANGED_TO_IRC 0x18000003
|
||||
#define AGENT_MENU_CHANGED_TO_JABBER 0x18000004
|
||||
#define REGISTER_TRANSPORT 0x18000005
|
||||
|
|
|
@ -26,20 +26,20 @@
|
|||
SendTalkWindow::SendTalkWindow(gloox::Message::MessageType type)
|
||||
: BWindow(BRect(0, 0, 0, 0), NULL, B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE) {
|
||||
_type = type;
|
||||
|
||||
|
||||
// determine window size
|
||||
BRect rect;
|
||||
|
||||
float login_window_width = 410;
|
||||
float login_window_height = 100;
|
||||
|
||||
|
||||
// create window frame position
|
||||
rect = GenericFunctions::CenteredFrame(login_window_width, login_window_height);
|
||||
|
||||
|
||||
// set it
|
||||
ResizeTo(rect.Width(), rect.Height());
|
||||
MoveTo(rect.LeftTop());
|
||||
|
||||
|
||||
// encompassing view
|
||||
rect = Bounds();
|
||||
rect.OffsetTo(B_ORIGIN);
|
||||
|
@ -51,7 +51,7 @@ SendTalkWindow::SendTalkWindow(gloox::Message::MessageType type)
|
|||
|
||||
// lightbulb
|
||||
PictureView *picture = new PictureView("bulb-normal");
|
||||
|
||||
|
||||
// query
|
||||
rect.left = 80.0;
|
||||
rect.InsetBy(5.0, 5.0);
|
||||
|
@ -62,16 +62,15 @@ SendTalkWindow::SendTalkWindow(gloox::Message::MessageType type)
|
|||
} else {
|
||||
_surrounding->SetLabel("Select a User");
|
||||
}
|
||||
|
||||
|
||||
rect.OffsetTo(B_ORIGIN);
|
||||
rect.InsetBy(6.0, 12.0);
|
||||
rect.bottom = rect.top + 18;
|
||||
|
||||
// chat service
|
||||
_chat_services_selection = new BPopUpMenu("Jabber");
|
||||
_chat_services = new BMenuField(rect, "chat_services", "Online Service: ", _chat_services_selection);
|
||||
_chat_services = new BMenuField(rect, "chat_services", "Online Service: ", _chat_services_selection);
|
||||
_chat_services->SetDivider(_chat_services->Divider() - 33);
|
||||
_chat_services_selection->AddItem(new BMenuItem("ICQ", new BMessage(AGENT_MENU_CHANGED_TO_ICQ)));
|
||||
BMenuItem *default_item = new BMenuItem("Jabber", new BMessage(AGENT_MENU_CHANGED_TO_JABBER));
|
||||
_chat_services_selection->AddItem(default_item);
|
||||
default_item->SetMarked(true);
|
||||
|
@ -79,7 +78,7 @@ SendTalkWindow::SendTalkWindow(gloox::Message::MessageType type)
|
|||
if (_type == gloox::Message::Groupchat) {
|
||||
rect.OffsetBy(0.0, 1.0);
|
||||
}
|
||||
|
||||
|
||||
_name = new BTextControl(rect, "name", "Username: ", NULL, NULL, B_FOLLOW_ALL_SIDES);
|
||||
|
||||
rect.OffsetBy(0.0, 24.0);
|
||||
|
@ -118,7 +117,7 @@ SendTalkWindow::SendTalkWindow(gloox::Message::MessageType type)
|
|||
_handle->SetText("somebody@jabber.org");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// cancel button
|
||||
rect.OffsetBy(135.0, 24.0);
|
||||
rect.right = rect.left + 65;
|
||||
|
@ -145,7 +144,7 @@ SendTalkWindow::SendTalkWindow(gloox::Message::MessageType type)
|
|||
|
||||
ok->MakeDefault(true);
|
||||
ok->SetTarget(this);
|
||||
|
||||
|
||||
_full_view->AddChild(picture);
|
||||
|
||||
if (_type == gloox::Message::Groupchat) {
|
||||
|
@ -153,12 +152,12 @@ SendTalkWindow::SendTalkWindow(gloox::Message::MessageType type)
|
|||
} else {
|
||||
_surrounding->AddChild(_chat_services);
|
||||
}
|
||||
|
||||
|
||||
_surrounding->AddChild(_handle);
|
||||
_surrounding->AddChild(cancel);
|
||||
_surrounding->AddChild(ok);
|
||||
_full_view->AddChild(_surrounding);
|
||||
|
||||
|
||||
AddChild(_full_view);
|
||||
|
||||
// focus
|
||||
|
@ -176,19 +175,13 @@ void SendTalkWindow::MessageReceived(BMessage *msg) {
|
|||
break;
|
||||
}
|
||||
|
||||
case AGENT_MENU_CHANGED_TO_ICQ: {
|
||||
// _enter_note->SetText("Please enter the user's ICQ numeric ID (e.g., 99818234).");
|
||||
_handle->SetLabel("ICQ #:");
|
||||
break;
|
||||
}
|
||||
|
||||
//// JAB_OK
|
||||
case JAB_OK: {
|
||||
if (_type == gloox::Message::Groupchat) {
|
||||
if (!ValidateGroupRoom()) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
BlabberSettings::Instance()->SetData("last-group-joined", _handle->Text());
|
||||
BlabberSettings::Instance()->SetData("last-group-username", _name->Text());
|
||||
|
||||
|
@ -211,8 +204,8 @@ void SendTalkWindow::MessageReceived(BMessage *msg) {
|
|||
}
|
||||
|
||||
PostMessage(B_QUIT_REQUESTED);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -228,21 +221,21 @@ bool SendTalkWindow::ValidateGroupRoom() {
|
|||
char buffer[4096];
|
||||
|
||||
if (!strcmp(_handle->Text(), "")) {
|
||||
sprintf(buffer, "Please specify the group's roomname.");
|
||||
sprintf(buffer, "Please specify the group's roomname.");
|
||||
ModalAlertFactory::Alert(buffer, "Oops!");
|
||||
_handle->MakeFocus(true);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (!strcmp(_name->Text(), "")) {
|
||||
sprintf(buffer, "Please specify your handle.");
|
||||
sprintf(buffer, "Please specify your handle.");
|
||||
ModalAlertFactory::Alert(buffer, "Oops!");
|
||||
_handle->MakeFocus(true);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -250,15 +243,14 @@ string SendTalkWindow::ValidateUser() {
|
|||
char buffer[4096];
|
||||
|
||||
if (!strcmp(_handle->Text(), "")) {
|
||||
sprintf(buffer, "Please specify a user's handle.");
|
||||
sprintf(buffer, "Please specify a user's handle.");
|
||||
ModalAlertFactory::Alert(buffer, "Oops!");
|
||||
_handle->MakeFocus(true);
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
// internally replace the username with a proper one if necessary (transports)
|
||||
Agent *agent;
|
||||
string username = _handle->Text();
|
||||
|
||||
// if not Jabber
|
||||
|
@ -266,25 +258,17 @@ string SendTalkWindow::ValidateUser() {
|
|||
username = GenericFunctions::CrushOutWhitespace(username);
|
||||
}
|
||||
|
||||
if (!strcasecmp(_chat_services->Menu()->FindMarked()->Label(), "ICQ")) {
|
||||
agent = AgentList::Instance()->GetAgentByService("icq");
|
||||
|
||||
if (agent) {
|
||||
username += "@";
|
||||
username += agent->JID();
|
||||
}
|
||||
}
|
||||
|
||||
// make a user to validate against
|
||||
// make a user to validate against
|
||||
std::string validate = UserID::WhyNotValidJabberHandle(username);
|
||||
|
||||
|
||||
if (!strcasecmp(_handle->Label(), "Jabber ID:") && validate.size()) {
|
||||
sprintf(buffer, "%s is not a valid Jabber ID for the following reason:\n\n%s\n\nPlease correct it.", _handle->Text(), validate.c_str());
|
||||
sprintf(buffer, "%s is not a valid Jabber ID for the following reason:\n\n%s\n\nPlease correct it.", _handle->Text(), validate.c_str());
|
||||
ModalAlertFactory::Alert(buffer, "Hmm, better check that...");
|
||||
_handle->MakeFocus(true);
|
||||
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
return username;
|
||||
}
|
||||
|
|
|
@ -18,11 +18,11 @@ TransportPreferencesView::TransportPreferencesView(BRect frame)
|
|||
_current_transport_registered = false;
|
||||
_curr_transport = "";
|
||||
_surrounding = NULL;
|
||||
|
||||
|
||||
// BUGBUG also part of the outrageous hack
|
||||
_register = NULL;
|
||||
_unregister = NULL;
|
||||
|
||||
|
||||
SetViewColor(216, 216, 216, 255);
|
||||
}
|
||||
|
||||
|
@ -35,12 +35,6 @@ void TransportPreferencesView::AttachedToWindow() {
|
|||
return;
|
||||
}
|
||||
|
||||
AgentList *agents = AgentList::Instance();
|
||||
|
||||
if (false) {
|
||||
return;
|
||||
}
|
||||
|
||||
BRect rect(Bounds());
|
||||
|
||||
// box frame
|
||||
|
@ -49,32 +43,26 @@ void TransportPreferencesView::AttachedToWindow() {
|
|||
_surrounding->SetLabel("External Chat Systems");
|
||||
|
||||
rect = _surrounding->Bounds();
|
||||
|
||||
|
||||
// transport prefs
|
||||
rect.InsetBy(25.0, 45.0);
|
||||
rect.right = rect.left + 375.0;
|
||||
rect.bottom = rect.top + 18;
|
||||
|
||||
// transport selection (ICQ)
|
||||
// transport selection
|
||||
_agent_entries = new BPopUpMenu("<select a service>");
|
||||
|
||||
if (agents->GetAgentByService("icq")) {
|
||||
BMenuItem *icq = new BMenuItem("Mirabilis ICQ", new BMessage(AGENT_MENU_CHANGED_TO_ICQ));
|
||||
icq->SetTarget(this);
|
||||
_agent_entries->AddItem(icq);
|
||||
}
|
||||
_agent_list = new BMenuField(rect, "agent_registrations", "Online Service: ", _agent_entries);
|
||||
|
||||
_agent_list = new BMenuField(rect, "agent_registrations", "Online Service: ", _agent_entries);
|
||||
|
||||
// username/password fields
|
||||
rect.OffsetBy(0.0, 35.0);
|
||||
|
||||
|
||||
rect.bottom = rect.top + 18;
|
||||
_username = new BTextControl(rect, "username", "Username: ", NULL, NULL, B_FOLLOW_ALL_SIDES);
|
||||
_username->SetDivider(_username->Divider() - 3);
|
||||
|
||||
rect.OffsetBy(0.0, 20.0);
|
||||
|
||||
|
||||
rect.bottom = rect.top + 19;
|
||||
_password = new BTextControl(rect, "password", "Password: ", NULL, NULL, B_FOLLOW_ALL_SIDES);
|
||||
_password->TextView()->HideTyping(true);
|
||||
|
@ -88,10 +76,10 @@ void TransportPreferencesView::AttachedToWindow() {
|
|||
black_9.SetSize(9.0);
|
||||
|
||||
rect.bottom += 3;
|
||||
|
||||
|
||||
BRect text_rect(rect);
|
||||
text_rect.OffsetTo(B_ORIGIN);
|
||||
|
||||
|
||||
_transport_id_info = new BTextView(rect, NULL, text_rect, &black_9, ¬e, B_FOLLOW_H_CENTER, B_WILL_DRAW);
|
||||
_transport_id_info->SetViewColor(216, 216, 216, 255);
|
||||
_transport_id_info->MakeEditable(false);
|
||||
|
@ -102,23 +90,23 @@ void TransportPreferencesView::AttachedToWindow() {
|
|||
|
||||
rect.bottom -= 3;
|
||||
|
||||
_register = new BButton(rect, "register", "Register", new BMessage(REGISTER_TRANSPORT));
|
||||
_register = new BButton(rect, "register", "Register", new BMessage(REGISTER_TRANSPORT));
|
||||
_register->SetTarget(this);
|
||||
_register->SetEnabled(false);
|
||||
|
||||
|
||||
rect.OffsetBy(0.0, 23.0);
|
||||
|
||||
_unregister = new BButton(rect, "register", "UnRegister", new BMessage(UNREGISTER_TRANSPORT));
|
||||
_unregister = new BButton(rect, "register", "UnRegister", new BMessage(UNREGISTER_TRANSPORT));
|
||||
_unregister->SetTarget(this);
|
||||
_unregister->SetEnabled(false);
|
||||
|
||||
rect.OffsetBy(0.0, 40.0);
|
||||
rect.bottom = rect.top + 50.0;
|
||||
|
||||
|
||||
text_rect = rect;
|
||||
|
||||
|
||||
text_rect.OffsetTo(B_ORIGIN);
|
||||
|
||||
|
||||
/*
|
||||
// text run array
|
||||
rgb_color blue = {0, 0, 255, 255};
|
||||
|
@ -128,7 +116,7 @@ void TransportPreferencesView::AttachedToWindow() {
|
|||
text_run two = {251, be_plain_font, red};
|
||||
|
||||
// text_run one_two[2] = {one, two};
|
||||
|
||||
|
||||
text_run_array be = {1, {one}};
|
||||
*/
|
||||
BTextView *enter_note = new BTextView(rect, NULL, text_rect, &black_9, ¬e, B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW);
|
||||
|
@ -136,10 +124,9 @@ void TransportPreferencesView::AttachedToWindow() {
|
|||
enter_note->MakeEditable(false);
|
||||
enter_note->MakeSelectable(false);
|
||||
enter_note->SetText("Note: Transports serve as the means by which XMPP "
|
||||
"communicates with external chat systems such as ICQ. They "
|
||||
"are add-on components to the XMPP server you are logged on to and "
|
||||
"thus can be ERRATIC and/or BUGGY. If you are having trouble with a "
|
||||
"transport, it is likely the server's fault and not Renga.");
|
||||
"communicates with external chat systems such as IRC. They "
|
||||
"are add-on components of the XMPP server you are logged on and "
|
||||
"not part of Renga.");
|
||||
|
||||
_surrounding->AddChild(enter_note);
|
||||
_surrounding->AddChild(_agent_list);
|
||||
|
@ -153,7 +140,7 @@ void TransportPreferencesView::AttachedToWindow() {
|
|||
|
||||
void TransportPreferencesView::MessageReceived(BMessage *msg) {
|
||||
AgentList *agents = AgentList::Instance();
|
||||
|
||||
|
||||
switch (msg->what) {
|
||||
case REGISTER_TRANSPORT: {
|
||||
if (agents->GetAgentByService(_curr_transport)) {
|
||||
|
@ -175,7 +162,7 @@ void TransportPreferencesView::MessageReceived(BMessage *msg) {
|
|||
|
||||
JabberSpeak::Instance()->RegisterWithAgent(_curr_transport);
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -197,25 +184,14 @@ void TransportPreferencesView::MessageReceived(BMessage *msg) {
|
|||
|
||||
break;
|
||||
}
|
||||
|
||||
case AGENT_MENU_CHANGED_TO_ICQ: {
|
||||
_curr_transport = "icq";
|
||||
|
||||
if (agents->GetAgentByService(_curr_transport)) {
|
||||
_username->SetLabel("ICQ #:");
|
||||
_username->SetText(agents->GetAgentByService(_curr_transport)->Username().c_str());
|
||||
_password->SetText(agents->GetAgentByService(_curr_transport)->Password().c_str());
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// buttons enabled
|
||||
if (agents->GetAgentByService(_curr_transport)) {
|
||||
_current_transport_registered = agents->GetAgentByService(_curr_transport)->IsRegistered();
|
||||
}
|
||||
|
||||
|
||||
// BUGBUG workaround for an outrageous hack! ;)
|
||||
if (_register && _unregister) {
|
||||
if (_current_transport_registered) {
|
||||
|
|
|
@ -97,7 +97,7 @@ bool UserID::HaveSubscriptionTo() const {
|
|||
}
|
||||
|
||||
bool UserID::IsUser() const {
|
||||
return (UserType() == JABBER || UserType() == ICQ);
|
||||
return (UserType() == JABBER);
|
||||
}
|
||||
|
||||
const std::string UserID::JabberHandle() const {
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
class UserID {
|
||||
public:
|
||||
enum online_status {UNKNOWN, UNACCEPTED, OFFLINE, ONLINE, TRANSPORT_ONLINE};
|
||||
enum user_type {INVALID, JABBER, ICQ, TRANSPORT};
|
||||
enum user_type {INVALID, JABBER, TRANSPORT};
|
||||
|
||||
public:
|
||||
virtual ~UserID();
|
||||
|
|
|
@ -53,7 +53,7 @@ BuddyInfoWindow::BuddyInfoWindow(UserID *querying_user)
|
|||
|
||||
if (!querying_user->ExactOnlineStatus().empty()) {
|
||||
realstatus_label = new BStringView(NULL, "Official Status:");
|
||||
|
||||
|
||||
if (querying_user->ExactOnlineStatus() == "xa") {
|
||||
realstatus_name = new BStringView(NULL, "Extended Away");
|
||||
} else if (querying_user->ExactOnlineStatus() == "away") {
|
||||
|
@ -72,12 +72,7 @@ BuddyInfoWindow::BuddyInfoWindow(UserID *querying_user)
|
|||
jabberid_label = new BStringView(NULL, "Jabber ID:");
|
||||
jabberid_name = new BStringView(NULL, querying_user->Handle().c_str());
|
||||
} else {
|
||||
if (querying_user->UserType() == UserID::ICQ) {
|
||||
jabberid_label = new BStringView(NULL, "ICQ #:");
|
||||
} else {
|
||||
jabberid_label = new BStringView(NULL, "Jabber ID:");
|
||||
}
|
||||
|
||||
jabberid_label = new BStringView(NULL, "Jabber ID:");
|
||||
jabberid_name = new BStringView(NULL, querying_user->JabberUsername().c_str());
|
||||
}
|
||||
|
||||
|
|
|
@ -682,7 +682,6 @@ void BlabberMainWindow::MenusBeginning() {
|
|||
if (i) {
|
||||
talk = (TalkView*)i->View();
|
||||
isGroup = talk->IsGroupChat();
|
||||
isLogging = talk->IsLogging();
|
||||
}
|
||||
|
||||
if(_record_item != nullptr) {
|
||||
|
|
|
@ -46,8 +46,6 @@ TalkView::TalkView(const gloox::JID *user, string group_room,
|
|||
: BGroupView("<talk window>", B_VERTICAL)
|
||||
, _session(session)
|
||||
{
|
||||
_am_logging = false;
|
||||
_log = NULL;
|
||||
_chat_index = -1;
|
||||
|
||||
UserID* uid = NULL;
|
||||
|
@ -151,18 +149,6 @@ TalkView::TalkView(const gloox::JID *user, string group_room,
|
|||
if (user_representation.empty())
|
||||
user_representation = uid->JabberUsername();
|
||||
|
||||
if (uid->UserType() == UserID::ICQ) {
|
||||
user_representation += " (ICQ)";
|
||||
|
||||
// identify the user
|
||||
if (!AgentList::Instance()->GetAgentByService("icq")->Username().empty()) {
|
||||
sprintf(buffer, "your identity is %s", AgentList::Instance()->GetAgentByService("icq")->Username().c_str());
|
||||
_status_view->SetMessage(buffer);
|
||||
} else {
|
||||
sprintf(buffer, "you are communicating via the ICQ service");
|
||||
_status_view->SetMessage(buffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!IsGroupChat() && user_representation.empty()) {
|
||||
|
@ -193,10 +179,6 @@ TalkView::~TalkView() {
|
|||
strftime(&message[0], message.size()-1, "Session finished %e %b %y [%R:%S]\n---", time_struct);
|
||||
AddToTalk("", message.c_str(), OTHER);
|
||||
|
||||
// close log cleanly if it's open
|
||||
if (_log)
|
||||
fclose(_log);
|
||||
|
||||
if (IsGroupChat())
|
||||
JabberSpeak::Instance()->SendGroupUnvitation(_group_room, _group_username);
|
||||
|
||||
|
|
|
@ -71,7 +71,6 @@ public:
|
|||
void RevealPreviousHistory();
|
||||
void RevealNextHistory();
|
||||
|
||||
bool IsLogging() { return _am_logging; }
|
||||
bool IsGroupChat();
|
||||
|
||||
void SetStatus(std::string message);
|
||||
|
@ -107,7 +106,5 @@ private:
|
|||
int _chat_index;
|
||||
|
||||
BFilePanel *_fp;
|
||||
bool _am_logging;
|
||||
FILE *_log;
|
||||
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue