R4stl1n/allianceauth — pull request #27 by ostrichtechnique (2014-12-05 13:39:16+00:00)
Title: Ignore most of this

The relevant code is the in services/views.py
add these imports

from eveonline.models import EveCorporationInfo
from eveonline.models import EveCharacter
from authentication.models import AuthServicesInfo

and replace the jabber broadcast method with this

@login_required
@permission_required('auth.jabber_broadcast')
def jabber_broadcast_view(request):
success = False
if request.method == 'POST':
form = JabberBroadcastForm(request.POST)
if form.is_valid():
user_info = AuthServicesInfo.objects.get(user=request.user)
main_char = EveCharacter.objects.get(character_id=user_info.main_char_id)
if auth_infoTEST.main_char_id != "":
OpenfireManager.send_broadcast_message(form.cleaned_data['group'], form.cleaned_data['message'] + "\n ##### SENT BY: " + main_char.character_name + " TO: " + form.cleaned_data['group'] + " #####\n")
else:
OpenfireManager.send_broadcast_message(form.cleaned_data['group'], form.cleaned_data['message'] + "\n ##### SENT BY: " + "No character but can send pings?" + " TO: " + form.cleaned_data['group'] + " #####\n")
success = True
else:
form = JabberBroadcastForm()

context = {'form': form, 'success': success}
return render_to_response('registered/jabberbroadcast.html', context, context_instance=RequestContext(request))